mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +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
|
/// Expand player, restoring from PiP first if needed
|
||||||
/// If PiP is active, stops PiP and waits for it to close before expanding
|
/// If PiP is active, stops PiP and waits for it to close before expanding
|
||||||
private func expandPlayerWithPiPRestore() {
|
private func expandPlayerWithPiPRestore() {
|
||||||
@@ -128,8 +138,7 @@ struct MiniPlayerView: View {
|
|||||||
.accessibilityIdentifier("player.miniPlayer")
|
.accessibilityIdentifier("player.miniPlayer")
|
||||||
.accessibilityLabel("player.miniPlayer")
|
.accessibilityLabel("player.miniPlayer")
|
||||||
.modifier(MiniPlayerContextMenuModifier(video: currentVideo) {
|
.modifier(MiniPlayerContextMenuModifier(video: currentVideo) {
|
||||||
queueManager?.clearQueue()
|
closeVideo()
|
||||||
playerService?.stop()
|
|
||||||
})
|
})
|
||||||
.task {
|
.task {
|
||||||
await loadMiniPlayerSettings()
|
await loadMiniPlayerSettings()
|
||||||
@@ -487,8 +496,7 @@ struct MiniPlayerView: View {
|
|||||||
|
|
||||||
private var closeButton: some View {
|
private var closeButton: some View {
|
||||||
Button {
|
Button {
|
||||||
queueManager?.clearQueue()
|
closeVideo()
|
||||||
playerService?.stop()
|
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "xmark")
|
Image(systemName: "xmark")
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
|
|||||||
Reference in New Issue
Block a user