From 8e48097a5a096ca67794f8533538de0a27acfae8 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Tue, 9 Jun 2026 07:28:09 +0200 Subject: [PATCH] Prevent starting PiP from mini player bar while player window is open Tapping the mini bar video thumbnail (with tap action set to PiP) or its PiP button while the expanded player window was open started PiP playing alongside the window. Bring the player window to the front instead when it is open or opening. --- Yattee/Views/Player/MiniPlayerView.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Yattee/Views/Player/MiniPlayerView.swift b/Yattee/Views/Player/MiniPlayerView.swift index 0c53cc2a..0ea29268 100644 --- a/Yattee/Views/Player/MiniPlayerView.swift +++ b/Yattee/Views/Player/MiniPlayerView.swift @@ -80,6 +80,13 @@ struct MiniPlayerView: View { /// Handle tap on video preview - action based on settings (PiP or expand) /// When video is disabled, always expand player since PiP needs the video view mounted private func handleVideoPreviewTap() { + // Don't start PiP while the expanded player is open (or opening) — PiP + // would play alongside the player window. Bring the window forward instead. + if let nav = navigationCoordinator, nav.isPlayerExpanded || nav.isPlayerExpanding { + nav.expandPlayer() + return + } + // If video is disabled in mini player, always expand (can't start PiP without video view) guard miniPlayerSettings.showVideo else { navigationCoordinator?.expandPlayer() @@ -560,6 +567,12 @@ struct MiniPlayerView: View { private func pipButton(config: ControlButtonConfiguration) -> some View { Button { incrementTapCount(for: config) + // Don't start PiP while the expanded player is open (or opening) — PiP + // would play alongside the player window. Bring the window forward instead. + if let nav = navigationCoordinator, nav.isPlayerExpanded || nav.isPlayerExpanding { + nav.expandPlayer() + return + } if let backend = playerService?.currentBackend as? MPVBackend { backend.startPiP() }