mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 21:22:53 +00:00
Start playlist Play at a random video in shuffle mode (#988)
Play always started from the first video, so shuffle only affected the rest of the session. When the queue mode is Shuffle, rotate the list to a random start so the remaining videos stay queued.
This commit is contained in:
@@ -1221,8 +1221,17 @@ struct UnifiedPlaylistDetailView: View {
|
||||
private func playAll() {
|
||||
guard !videos.isEmpty, let appEnvironment else { return }
|
||||
|
||||
// In shuffle mode start from a random video (#988). Rotate rather than
|
||||
// pick an index so every other video stays in the queue instead of
|
||||
// being pushed to history as "already played".
|
||||
var orderedVideos = videos
|
||||
if appEnvironment.playerService.state.queueMode == .shuffle {
|
||||
let start = Int.random(in: 0..<videos.count)
|
||||
orderedVideos = Array(videos[start...] + videos[..<start])
|
||||
}
|
||||
|
||||
appEnvironment.queueManager.playFromList(
|
||||
videos: videos,
|
||||
videos: orderedVideos,
|
||||
index: 0,
|
||||
queueSource: queueSource,
|
||||
sourceLabel: title
|
||||
|
||||
Reference in New Issue
Block a user