mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
Fix macOS black video after re-parenting the shared player view
The player video surface is a single shared MPVOGLView that is re-parented between the mini-bar container (main window) and the expanded-player sheet (a separate sheet window). When presenting the sheet, the new container attaches the shared view before the old mini-bar container tears down, so the old container's viewWillMove(toSuperview: nil) was ripping the shared view out of its new home via removeFromSuperview() — leaving it with no window and a black surface. Symmetric, so it also blanked the mini-bar preview after collapsing. Only detach the shared view if it still belongs to the container (superview === self). Also force a repaint on window reattach so a paused frame redraws, and extend the onAppear resumeRendering to macOS.
This commit is contained in:
@@ -170,6 +170,12 @@ final class MPVOGLView: NSView {
|
||||
|
||||
// Update contents scale for new window
|
||||
videoLayer?.contentsScale = window.backingScaleFactor
|
||||
|
||||
// Reattaching (e.g. macOS player sheet dismissed via ESC then re-expanded)
|
||||
// detaches this shared view without stopping playback. macOS drawing is
|
||||
// pull-based, so force a redraw to repaint the current frame — otherwise
|
||||
// the layer stays black until MPV emits a new frame (never, if paused).
|
||||
resumeRendering()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user