add option to exit fullscreen on end

This commit is contained in:
Toni Förster 2023-11-27 23:49:18 +01:00
parent af75afa912
commit 64a18678ce
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7
2 changed files with 26 additions and 6 deletions

View File

@ -111,15 +111,24 @@ extension PlayerBackend {
model.prepareCurrentItemForHistory(finished: true) model.prepareCurrentItemForHistory(finished: true)
if model.queue.isEmpty { if model.queue.isEmpty {
if Defaults[.closeVideoOnEOF] { #if os(tvOS)
#if os(tvOS) if Defaults[.closeVideoOnEOF] {
if model.activeBackend == .appleAVPlayer { if model.activeBackend == .appleAVPlayer {
model.avPlayerBackend.controller?.dismiss(animated: false) model.avPlayerBackend.controller?.dismiss(animated: false)
} }
#endif model.resetQueue()
model.resetQueue() model.hide()
model.hide() }
} #else
if Defaults[.closeVideoOnEOF] {
model.resetQueue()
model.hide()
}
if !Defaults[.closeVideoOnEOF], Defaults[.exitFullscreenOnEOF], model.playingFullScreen {
model.exitFullScreen()
}
#endif
} else { } else {
model.advanceToNextItem() model.advanceToNextItem()
} }

View File

@ -11,6 +11,7 @@ struct PlayerSettings: View {
#if !os(tvOS) #if !os(tvOS)
@Default(.showScrollToTopInComments) private var showScrollToTopInComments @Default(.showScrollToTopInComments) private var showScrollToTopInComments
@Default(.collapsedLinesDescription) private var collapsedLinesDescription @Default(.collapsedLinesDescription) private var collapsedLinesDescription
@Default(.exitFullscreenOnEOF) private var exitFullscreenOnEOF
#endif #endif
@Default(.expandVideoDescription) private var expandVideoDescription @Default(.expandVideoDescription) private var expandVideoDescription
@Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer @Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer
@ -85,6 +86,9 @@ struct PlayerSettings: View {
} }
pauseOnHidingPlayerToggle pauseOnHidingPlayerToggle
closeVideoOnEOFToggle closeVideoOnEOFToggle
#if !os(tvOS)
exitFullscreenOnEOFToggle
#endif
#if !os(macOS) #if !os(macOS)
pauseOnEnteringBackgroundToogle pauseOnEnteringBackgroundToogle
#endif #endif
@ -294,6 +298,13 @@ struct PlayerSettings: View {
Toggle("Close video and player on end", isOn: $closeVideoOnEOF) Toggle("Close video and player on end", isOn: $closeVideoOnEOF)
} }
#if !os(tvOS)
private var exitFullscreenOnEOFToggle: some View {
Toggle("Exit fullscreen on end", isOn: $exitFullscreenOnEOF)
.disabled(closeVideoOnEOF)
}
#endif
#if !os(macOS) #if !os(macOS)
private var pauseOnEnteringBackgroundToogle: some View { private var pauseOnEnteringBackgroundToogle: some View {
Toggle("Pause when entering background", isOn: $pauseOnEnteringBackground) Toggle("Pause when entering background", isOn: $pauseOnEnteringBackground)