diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs
index 30382c444f..aab8ff6bd6 100644
--- a/osu.Game/Beatmaps/WorkingBeatmap.cs
+++ b/osu.Game/Beatmaps/WorkingBeatmap.cs
@@ -266,6 +266,26 @@ namespace osu.Game.Beatmaps
[NotNull]
public Track LoadTrack() => loadedTrack = GetBeatmapTrack() ?? GetVirtualTrack(1000);
+ ///
+ /// Reads the correct track restart point from beatmap metadata and sets looping to enabled.
+ ///
+ public void PrepareTrackForPreviewLooping()
+ {
+ Track.Looping = true;
+ Track.RestartPoint = Metadata.PreviewTime;
+
+ if (Track.RestartPoint == -1)
+ {
+ if (!Track.IsLoaded)
+ {
+ // force length to be populated (https://github.com/ppy/osu-framework/issues/4202)
+ Track.Seek(Track.CurrentTime);
+ }
+
+ Track.RestartPoint = 0.4f * Track.Length;
+ }
+ }
+
///
/// Transfer a valid audio track into this working beatmap. Used as an optimisation to avoid reload / track swap
/// across difficulties in the same beatmap set.