From 86f9ef56b3976e03a73dc4ac0544edaa68256341 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 23 May 2026 11:39:46 +0200 Subject: [PATCH] Dismiss expanded player window when closing video from the mini bar The capsule close button (and context-menu close) only stopped playback and cleared the queue, leaving the separate macOS player window open on a black frame. Route both through a shared closeVideo() that also sets isPlayerExpanded = false, mirroring PlaybackCommands.closeVideo, so the player window is dismissed. --- Yattee/Views/Player/MiniPlayerView.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Yattee/Views/Player/MiniPlayerView.swift b/Yattee/Views/Player/MiniPlayerView.swift index 4576b8fc..0c53cc2a 100644 --- a/Yattee/Views/Player/MiniPlayerView.swift +++ b/Yattee/Views/Player/MiniPlayerView.swift @@ -98,6 +98,16 @@ struct MiniPlayerView: View { } } + /// Closes the current video: stops playback, clears the queue, and dismisses + /// the expanded player (so the separate macOS player window is hidden too). + private func closeVideo() { + playerState?.isClosingVideo = true + queueManager?.clearQueue() + // Stop the player before dismissing the window so the backend is torn down first. + playerService?.stop() + navigationCoordinator?.isPlayerExpanded = false + } + /// Expand player, restoring from PiP first if needed /// If PiP is active, stops PiP and waits for it to close before expanding private func expandPlayerWithPiPRestore() { @@ -128,8 +138,7 @@ struct MiniPlayerView: View { .accessibilityIdentifier("player.miniPlayer") .accessibilityLabel("player.miniPlayer") .modifier(MiniPlayerContextMenuModifier(video: currentVideo) { - queueManager?.clearQueue() - playerService?.stop() + closeVideo() }) .task { await loadMiniPlayerSettings() @@ -487,8 +496,7 @@ struct MiniPlayerView: View { private var closeButton: some View { Button { - queueManager?.clearQueue() - playerService?.stop() + closeVideo() } label: { Image(systemName: "xmark") .font(.subheadline)