From b21a4920be3aca2d80ac9298518da1485a76f665 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Tue, 16 Jun 2026 20:42:39 +0200 Subject: [PATCH] Fix macOS opening player window instead of switching video in PiP The PiP-active guard that skips expanding the player when opening a new video was compiled iOS-only, so on macOS a browser deep link always re-showed the hidden player window instead of playing the new video in the existing PiP window. Extend the guard in both openVideo overloads and the Handoff path to macOS. --- Yattee/Services/Player/PlayerService.swift | 4 ++-- Yattee/YatteeApp.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Yattee/Services/Player/PlayerService.swift b/Yattee/Services/Player/PlayerService.swift index fadeef90..03458105 100644 --- a/Yattee/Services/Player/PlayerService.swift +++ b/Yattee/Services/Player/PlayerService.swift @@ -940,7 +940,7 @@ final class PlayerService { func openVideo(_ video: Video, startTime: TimeInterval? = nil) { // Check if MPV PiP is active - if so, don't expand the player - #if os(iOS) + #if os(iOS) || os(macOS) let mpvPiPActive = (currentBackend as? MPVBackend)?.isPiPActive ?? false #else let mpvPiPActive = false @@ -993,7 +993,7 @@ final class PlayerService { /// - captions: Optional array of external captions (e.g., from WebDAV subtitle files) func openVideo(_ video: Video, stream: Stream, audioStream: Stream? = nil, download: Download? = nil, captions: [Caption] = []) { // Check if MPV PiP is active - if so, don't expand the player - #if os(iOS) + #if os(iOS) || os(macOS) let mpvPiPActive = (currentBackend as? MPVBackend)?.isPiPActive ?? false #else let mpvPiPActive = false diff --git a/Yattee/YatteeApp.swift b/Yattee/YatteeApp.swift index c98cdfe1..ff0fcdf9 100644 --- a/Yattee/YatteeApp.swift +++ b/Yattee/YatteeApp.swift @@ -761,7 +761,7 @@ struct YatteeApp: App { // Always expand player after handoff (unless PiP is active) // We add a small delay to ensure ContentView has set up its .onChange observers // (during app launch via Handoff, the trigger can fire before the view is ready) - #if os(iOS) + #if os(iOS) || os(macOS) let isPiPActive = appEnvironment.playerService.state.pipState == .active #else let isPiPActive = false