mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Add advanced setting "Show video context menu options to force selected backend"
This commit is contained in:
@@ -21,6 +21,7 @@ struct VideoContextMenuView: View {
|
||||
@FetchRequest private var watchRequest: FetchedResults<Watch>
|
||||
|
||||
@Default(.saveHistory) private var saveHistory
|
||||
@Default(.showPlayNowInBackendContextMenu) private var showPlayNowInBackendContextMenu
|
||||
|
||||
private var backgroundContext = PersistenceController.shared.container.newBackgroundContext()
|
||||
|
||||
@@ -71,6 +72,14 @@ struct VideoContextMenuView: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
if showPlayNowInBackendContextMenu {
|
||||
Section {
|
||||
ForEach(PlayerBackendType.allCases, id: \.self) { backend in
|
||||
playNowInBackendButton(backend)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
playNextButton
|
||||
addToQueueButton
|
||||
@@ -187,6 +196,20 @@ struct VideoContextMenuView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func playNowInBackendButton(_ backend: PlayerBackendType) -> some View {
|
||||
Button {
|
||||
if player.musicMode {
|
||||
player.toggleMusicMode()
|
||||
}
|
||||
|
||||
player.forceBackendOnPlay = backend
|
||||
|
||||
player.play(video)
|
||||
} label: {
|
||||
Label("Play Now in \(backend.label)", systemImage: "play")
|
||||
}
|
||||
}
|
||||
|
||||
private var playNowInPictureInPictureButton: some View {
|
||||
Button {
|
||||
player.avPlayerBackend.startPictureInPictureOnPlay = true
|
||||
|
Reference in New Issue
Block a user