From 945804c10983fa2cdce9e172c416a3a56f1920e1 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 22 Jun 2026 20:19:25 +0200 Subject: [PATCH] Hand off render view to mini capsule immediately on player collapse The capsule's claim on the shared render view is declined during the player window's fade-out (the window is still visible, so the steal guard refuses), and nothing retried after orderOut - the capsule stayed black until the render watchdog recovered the view ~10 seconds later. Call recoverSharedPlayerViewIfNeeded() in hide()'s cleanup right after ordering the window out, so the view moves to the capsule as soon as the collapse finishes. The PiP path is untouched - there the view must stay in the hidden window. --- Yattee/Views/Player/ExpandedPlayerWindowManager.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Yattee/Views/Player/ExpandedPlayerWindowManager.swift b/Yattee/Views/Player/ExpandedPlayerWindowManager.swift index d06d85ad..1f9bcb7b 100644 --- a/Yattee/Views/Player/ExpandedPlayerWindowManager.swift +++ b/Yattee/Views/Player/ExpandedPlayerWindowManager.swift @@ -201,7 +201,8 @@ final class ExpandedPlayerWindowManager: NSObject { // Check if PiP is active - if so, just hide the window without destroying content // The AVSampleBufferDisplayLayer needs to stay alive while PiP is active - let isPiPActive = (appEnvironment?.playerService.currentBackend as? MPVBackend)?.isPiPActive ?? false + let mpvBackend = appEnvironment?.playerService.currentBackend as? MPVBackend + let isPiPActive = mpvBackend?.isPiPActive ?? false LoggingService.shared.debug("ExpandedPlayerWindowManager: hide() called, isPiPActive=\(isPiPActive)", category: .player) @@ -240,6 +241,14 @@ final class ExpandedPlayerWindowManager: NSObject { // Don't set contentViewController to nil or call close() - just order out // This lets SwiftUI views deallocate naturally rather than being forcibly torn down window.orderOut(nil) + // The mini capsule's claim on the shared render view was + // declined while this window was still visible during the + // fade-out, and nothing retries after orderOut - hand the + // view over now instead of leaving the capsule black until + // the render watchdog recovers it. + if MPVContainerNSView.recoverSharedPlayerViewIfNeeded() { + mpvBackend?.resumeRendering() + } completion?() } }