fix: allow compact mode while media is loading
This commit is contained in:
@@ -102,12 +102,13 @@ final class CompactWindowController: NSObject {
|
||||
restore()
|
||||
return
|
||||
}
|
||||
guard let window, aspect.isFinite, aspect > 0 else { return }
|
||||
guard let window else { return }
|
||||
if !sessionActive {
|
||||
sessionActive = true
|
||||
originatedFullScreen = window.styleMask.contains(.fullScreen) || fullScreenTransition != nil
|
||||
}
|
||||
videoAspect = aspect
|
||||
// Keep the last usable ratio until loading supplies the video's metadata.
|
||||
if aspect.isFinite && aspect > 0 { videoAspect = aspect }
|
||||
wantsCompact = true
|
||||
wantsFullScreen = false
|
||||
reconcile()
|
||||
|
||||
@@ -47,10 +47,7 @@ final class PlayerModel: ObservableObject {
|
||||
automaticYouTubeQuality ? .disableAutomaticQuality : .enableAutomaticQuality
|
||||
}
|
||||
var isCompact: Bool { compactWindow.isCompact }
|
||||
var canToggleCompact: Bool {
|
||||
isCompact || compactWindow.isTransitioning ||
|
||||
(canTogglePlayback && state.has_video && state.video_aspect_ratio.isFinite && state.video_aspect_ratio > 0)
|
||||
}
|
||||
var canToggleCompact: Bool { canPerform(compactAction) }
|
||||
var compactContentMinimumHeight: CGFloat {
|
||||
guard let window else { return 90 }
|
||||
// Hosting-view minimums include the native titlebar safe area, even with full-size content.
|
||||
@@ -509,9 +506,9 @@ final class PlayerModel: ObservableObject {
|
||||
return window != nil && fullScreenIntent == nil && !compactWindow.isTransitioning &&
|
||||
(action == .enterFullscreen ? !isFullScreen : isFullScreen)
|
||||
case .enterCompact:
|
||||
return window != nil && !(compactIntent ?? isCompact) &&
|
||||
canTogglePlayback && state.has_video &&
|
||||
state.video_aspect_ratio.isFinite && state.video_aspect_ratio > 0
|
||||
return window != nil && !(compactIntent ?? isCompact) && canOpen &&
|
||||
(isBusy || (canTogglePlayback && state.has_video &&
|
||||
state.video_aspect_ratio.isFinite && state.video_aspect_ratio > 0))
|
||||
case .exitCompact: return window != nil && (compactIntent ?? isCompact)
|
||||
case .enableAlwaysOnTop, .disableAlwaysOnTop:
|
||||
return window != nil && !isFullScreen && fullScreenIntent == nil &&
|
||||
@@ -705,8 +702,7 @@ final class PlayerModel: ObservableObject {
|
||||
defer { systemPlayback?.update() }
|
||||
state = next
|
||||
if let playing = observation.playback { setPlayback(playing: playing) }
|
||||
if next.status == PLAYER_EMPTY || next.status == PLAYER_ERROR ||
|
||||
(!isBusy && !next.has_video) {
|
||||
if !isBusy && (next.status == PLAYER_EMPTY || next.status == PLAYER_ERROR || !next.has_video) {
|
||||
compactWindow.restore(resumeFullScreen: false, animated: false)
|
||||
}
|
||||
if !isSeeking && !transition.seekPending {
|
||||
|
||||
Reference in New Issue
Block a user