mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
Fix black screen after restoring PiP when player window was closed on macOS
The expanded player window hidden for PiP is reused on restore, so its MPVContainerNSView kept a stale weak reference to the shared render view that the mini player preview had taken during PiP. On restore the mini preview released the view as an orphan and the reused container skipped re-attaching it because its guard only compared view identity. - Skip re-attach in setPlayerView only when the view is still actually our subview, matching the iOS container's stolen-view handling - Transfer the shared render view to another living container on unmount instead of orphaning it, since SwiftUI is not guaranteed to re-run updateNSView on a hidden window's content after restore - Force a repaint when restoring the window hidden for PiP; forced draws requested while ordered out are dropped and the layer is pull-based
This commit is contained in:
@@ -1290,6 +1290,12 @@ final class MPVBackend: PlayerBackend {
|
||||
self?.onPiPDidStart?()
|
||||
} else {
|
||||
self?._playerView?.captureFramesForPiP = false
|
||||
// The layer was cleared to black when PiP started and macOS
|
||||
// drawing is pull-based — force a repaint so the restored
|
||||
// window shows the current frame even while paused. If the
|
||||
// view isn't in a window yet, the forced draw stays armed and
|
||||
// the setFrameSize/viewDidMoveToWindow retries complete it.
|
||||
self?._playerView?.resumeRendering()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user