fix: allow compact mode while media is loading
This commit is contained in:
@@ -48,6 +48,24 @@ struct SystemPlaybackChecks {
|
||||
let directory = URL(fileURLWithPath: CommandLine.arguments[1], isDirectory: true)
|
||||
let center = MPNowPlayingInfoCenter.default()
|
||||
let commands = MPRemoteCommandCenter.shared()
|
||||
let window = NSWindow(contentRect: NSRect(x: -10_000, y: -10_000, width: 640, height: 360),
|
||||
styleMask: [.titled, .closable, .miniaturizable, .resizable],
|
||||
backing: .buffered, defer: false)
|
||||
window.isReleasedWhenClosed = false
|
||||
defer { window.close() }
|
||||
model.attachWindow(window)
|
||||
model.open(directory.appendingPathComponent("anamorphic.mp4"))
|
||||
require(model.isBusy && model.perform(.enterCompact) && model.isCompact,
|
||||
"compact entry is available before native media opening acknowledges")
|
||||
until("decoded anamorphic metadata replaces provisional compact geometry") {
|
||||
model.state.status == PLAYER_PLAYING && model.isCompact && !model.compactWindow.isTransitioning &&
|
||||
abs(window.frame.width / window.frame.height - 8.0 / 3.0) < 0.01
|
||||
}
|
||||
model.closeFile()
|
||||
require(!model.isCompact && !model.compactWindow.isTransitioning,
|
||||
"closing loading/loaded media restores immediately")
|
||||
until("anamorphic source closes before the ordinary playback checks") { model.state.status == PLAYER_EMPTY }
|
||||
require(!model.canPerform(.enterCompact), "empty playback does not enable compact entry")
|
||||
|
||||
model.open(directory.appendingPathComponent("av.mp4"))
|
||||
until("open starts authoritative playback") { model.canTogglePlayback && model.state.status == PLAYER_PLAYING }
|
||||
|
||||
Reference in New Issue
Block a user