mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Fix macOS permanent black video after player collapse/expand cycles
In separate-window mode, hide() keeps the ordered-out window's SwiftUI hierarchy alive (nilling contentViewController crashes AVKit), and its updateNSView unconditionally re-attached the shared MPVOGLView - stealing it into a window CoreAnimation never composites. The layer's silent skip-render fallback then consumed every frame flag, so video stayed black (climbing vo drops) until app restart. - Decline stealing the shared view from a visible container into a non-visible one; owner-initiated transfers bypass the guard - Only transfer to containers in visible windows or the window still tracked by ExpandedPlayerWindowManager; park the view otherwise and reclaim it when a container gains a window - Log skip-render frame consumption (rate-limited) and track render health counters (draws/skips/dropped draws) - Add a watchdog to the playback stats task that detects a stalled video output and re-attaches the view to a visible container - Don't mount player layouts during zero-size layout passes
This commit is contained in:
@@ -303,7 +303,14 @@ struct ExpandedPlayerSheet: View {
|
||||
Color.black.ignoresSafeArea(edges: .bottom)
|
||||
|
||||
#if os(iOS) || os(macOS)
|
||||
if wideScreen {
|
||||
if geometry.size.width <= 0 || geometry.size.height <= 0 {
|
||||
// Transient zero-size layout pass (e.g. the deferred macOS
|
||||
// player window before its first real layout). Don't mount
|
||||
// either layout branch — a branch mounted here would grab
|
||||
// the shared render view for one frame and immediately hand
|
||||
// it off when the real size picks the other branch.
|
||||
Color.black.ignoresSafeArea(.all)
|
||||
} else if wideScreen {
|
||||
if let video = playerState?.currentVideo {
|
||||
// Widescreen layout with floating panel
|
||||
// Must ignore safe area to get full screen geometry
|
||||
|
||||
Reference in New Issue
Block a user