mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Add back Shuffle All and fix Play All
This commit is contained in:
parent
1744210615
commit
14b0316724
@ -8,7 +8,9 @@ extension PlayerModel {
|
||||
currentItem?.video
|
||||
}
|
||||
|
||||
func play(_ videos: [Video]) {
|
||||
func play(_ videos: [Video], shuffling: Bool = false) {
|
||||
playbackMode = shuffling ? .shuffle : .queue
|
||||
|
||||
videos.forEach { enqueueVideo($0, loadDetails: false) }
|
||||
|
||||
#if os(iOS)
|
||||
|
@ -18,6 +18,9 @@ struct AppSidebarPlaylists: View {
|
||||
Button("Play All") {
|
||||
player.play(playlists.find(id: playlist.id)?.videos ?? [])
|
||||
}
|
||||
Button("Shuffle All") {
|
||||
player.play(playlists.find(id: playlist.id)?.videos ?? [], shuffling: true)
|
||||
}
|
||||
Button("Edit") {
|
||||
navigation.presentEditPlaylistForm(playlists.find(id: playlist.id))
|
||||
}
|
||||
|
@ -299,13 +299,21 @@ struct PlaylistsView: View {
|
||||
|
||||
private var playButton: some View {
|
||||
Button {
|
||||
player.playbackMode = .queue
|
||||
player.play(items.compactMap(\.video))
|
||||
} label: {
|
||||
Image(systemName: "play")
|
||||
.padding(8)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.contextMenu {
|
||||
Button {
|
||||
player.play(items.compactMap(\.video), shuffling: true)
|
||||
} label: {
|
||||
Label("Shuffle", systemImage: "shuffle")
|
||||
.padding(8)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var currentPlaylist: Playlist? {
|
||||
|
@ -121,11 +121,17 @@ struct ChannelPlaylistView: View {
|
||||
|
||||
private var playButton: some View {
|
||||
Button {
|
||||
player.playbackMode = .queue
|
||||
player.play(videos)
|
||||
} label: {
|
||||
Label("Play All", systemImage: "play")
|
||||
}
|
||||
.contextMenu {
|
||||
Button {
|
||||
player.play(videos, shuffling: true)
|
||||
} label: {
|
||||
Label("Shuffle All", systemImage: "shuffle")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var videos: [Video] {
|
||||
|
@ -70,11 +70,17 @@ struct PlaylistVideosView: View {
|
||||
FavoriteButton(item: FavoriteItem(section: .channelPlaylist(playlist.id, playlist.title)))
|
||||
|
||||
Button {
|
||||
player.playbackMode = .queue
|
||||
player.play(videos)
|
||||
} label: {
|
||||
Label("Play All", systemImage: "play")
|
||||
}
|
||||
.contextMenu {
|
||||
Button {
|
||||
player.play(videos, shuffling: true)
|
||||
} label: {
|
||||
Label("Shuffle All", systemImage: "shuffle")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user