mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Merge pull request #570 from stonerl/close-fullscreen-on-end
add option to exit fullscreen on end
This commit is contained in:
commit
13d4a592bc
@ -7,6 +7,7 @@ final class PlayerSettingsGroupExporter: SettingsGroupExporter {
|
|||||||
"playerInstanceID": Defaults[.playerInstanceID] ?? "",
|
"playerInstanceID": Defaults[.playerInstanceID] ?? "",
|
||||||
"pauseOnHidingPlayer": Defaults[.pauseOnHidingPlayer],
|
"pauseOnHidingPlayer": Defaults[.pauseOnHidingPlayer],
|
||||||
"closeVideoOnEOF": Defaults[.closeVideoOnEOF],
|
"closeVideoOnEOF": Defaults[.closeVideoOnEOF],
|
||||||
|
"exitFullscreenOnEOF": Defaults[.exitFullscreenOnEOF],
|
||||||
"expandVideoDescription": Defaults[.expandVideoDescription],
|
"expandVideoDescription": Defaults[.expandVideoDescription],
|
||||||
"collapsedLinesDescription": Defaults[.collapsedLinesDescription],
|
"collapsedLinesDescription": Defaults[.collapsedLinesDescription],
|
||||||
"showChapters": Defaults[.showChapters],
|
"showChapters": Defaults[.showChapters],
|
||||||
|
@ -17,6 +17,10 @@ struct PlayerSettingsGroupImporter {
|
|||||||
Defaults[.closeVideoOnEOF] = closeVideoOnEOF
|
Defaults[.closeVideoOnEOF] = closeVideoOnEOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let exitFullscreenOnEOF = json["exitFullscreenOnEOF"].bool {
|
||||||
|
Defaults[.exitFullscreenOnEOF] = exitFullscreenOnEOF
|
||||||
|
}
|
||||||
|
|
||||||
if let expandVideoDescription = json["expandVideoDescription"].bool {
|
if let expandVideoDescription = json["expandVideoDescription"].bool {
|
||||||
Defaults[.expandVideoDescription] = expandVideoDescription
|
Defaults[.expandVideoDescription] = expandVideoDescription
|
||||||
}
|
}
|
||||||
|
@ -111,15 +111,22 @@ 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()
|
||||||
|
} else if Defaults[.exitFullscreenOnEOF], model.playingFullScreen {
|
||||||
|
model.exitFullScreen()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
model.advanceToNextItem()
|
model.advanceToNextItem()
|
||||||
}
|
}
|
||||||
|
@ -1001,6 +1001,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
|
|
||||||
logger.info("entering fullscreen")
|
logger.info("entering fullscreen")
|
||||||
toggleFullscreen(false, showControls: showControls)
|
toggleFullscreen(false, showControls: showControls)
|
||||||
|
self.playingFullScreen = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func exitFullScreen(showControls: Bool = true) {
|
func exitFullScreen(showControls: Bool = true) {
|
||||||
@ -1008,6 +1009,7 @@ final class PlayerModel: ObservableObject {
|
|||||||
|
|
||||||
logger.info("exiting fullscreen")
|
logger.info("exiting fullscreen")
|
||||||
toggleFullscreen(true, showControls: showControls)
|
toggleFullscreen(true, showControls: showControls)
|
||||||
|
self.playingFullScreen = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateNowPlayingInfo() {
|
func updateNowPlayingInfo() {
|
||||||
|
@ -75,6 +75,7 @@ extension Defaults.Keys {
|
|||||||
static let expandVideoDescription = Key<Bool>("expandVideoDescription", default: expandVideoDescriptionDefault)
|
static let expandVideoDescription = Key<Bool>("expandVideoDescription", default: expandVideoDescriptionDefault)
|
||||||
|
|
||||||
static let collapsedLinesDescription = Key<Int>("collapsedLinesDescription", default: 5)
|
static let collapsedLinesDescription = Key<Int>("collapsedLinesDescription", default: 5)
|
||||||
|
static let exitFullscreenOnEOF = Key<Bool>("exitFullscreenOnEOF", default: true)
|
||||||
|
|
||||||
static let showChapters = Key<Bool>("showChapters", default: true)
|
static let showChapters = Key<Bool>("showChapters", default: true)
|
||||||
static let showChapterThumbnails = Key<Bool>("showChapterThumbnails", default: true)
|
static let showChapterThumbnails = Key<Bool>("showChapterThumbnails", default: true)
|
||||||
|
@ -12,6 +12,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
|
||||||
@ -86,6 +87,9 @@ struct PlayerSettings: View {
|
|||||||
}
|
}
|
||||||
pauseOnHidingPlayerToggle
|
pauseOnHidingPlayerToggle
|
||||||
closeVideoOnEOFToggle
|
closeVideoOnEOFToggle
|
||||||
|
#if !os(tvOS)
|
||||||
|
exitFullscreenOnEOFToggle
|
||||||
|
#endif
|
||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
pauseOnEnteringBackgroundToogle
|
pauseOnEnteringBackgroundToogle
|
||||||
#endif
|
#endif
|
||||||
@ -300,6 +304,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)
|
||||||
|
Loading…
Reference in New Issue
Block a user