diff --git a/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs b/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs index e74992e37a..471f67b7b6 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneScreenNavigation.cs @@ -92,8 +92,9 @@ namespace osu.Game.Tests.Visual.Menus exitViaEscapeAndConfirm(); } - [Test] - public void TestSongContinuesAfterExitPlayer() + [TestCase(true)] + [TestCase(false)] + public void TestSongContinuesAfterExitPlayer(bool withUserPause) { Player player = null; @@ -106,6 +107,9 @@ namespace osu.Game.Tests.Visual.Menus AddUntilStep("wait for selected", () => !game.Beatmap.IsDefault); + if (withUserPause) + AddStep("pause", () => game.Dependencies.Get().Stop()); + AddStep("press enter", () => pressAndRelease(Key.Enter)); AddUntilStep("wait for player", () => (player = game.ScreenStack.CurrentScreen as Player) != null); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 2547d7515e..9ec0364420 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -129,11 +129,9 @@ namespace osu.Game.Overlays { var track = current?.Track; - if (track.IsRunning) - { - IsUserPaused = true; + IsUserPaused = true; + if (track?.IsRunning == true) track.Stop(); - } } /// diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 8187dd04d1..2d0c2e254c 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -490,7 +490,9 @@ namespace osu.Game.Screens.Select if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending) { UpdateBeatmap(Beatmap.Value); - ensurePlayingSelected(false); + + // restart playback on returning to song select, regardless. + music?.Play(); } base.OnResuming(last); @@ -587,8 +589,7 @@ namespace osu.Game.Screens.Select /// Ensures some music is playing for the current track. /// Will resume playback from a manual user pause if the track has changed. /// - /// Whether to restart from the preview point, rather than resuming from previous location. - private void ensurePlayingSelected(bool fromPreviewPoint = true) + private void ensurePlayingSelected() { Track track = Beatmap.Value.Track; @@ -597,7 +598,7 @@ namespace osu.Game.Screens.Select track.RestartPoint = Beatmap.Value.Metadata.PreviewTime; if (!track.IsRunning && (music?.IsUserPaused != true || isNewTrack)) - music?.Play(fromPreviewPoint); + music?.Play(true); lastTrack.SetTarget(track); }