mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user