app: stop playback when the window closes or hides

Closing the window leaves the app in the tray, so a clip or a review
kept playing with no picture. The window's close and the app's quit now
pause the open clip and every review player, and Hide pauses them too
before the window goes. Reopening shows the same screen, paused where it
was.
This commit is contained in:
vhaudiquet committed 2026-11-23 19:47:08 +01:00
1 parent 531238039d
commit 7463cf3905
3 files changed
+34 -1

No files matched your search

+11
View File
@@ -232,6 +232,17 @@ impl Review {
}
}
/// Stop the video and its soundtrack players. The window is closing under them and the app
/// stays in the tray, so sound with no picture should not carry on.
pub fn pause(&mut self) {
if let Some(player) = &self.player {
player.pause();
}
for channel in &self.sounds {
channel.sound.pause();
}
}
pub(crate) fn playback(&mut self) {
let playing = self.player.as_ref().is_some_and(Player::is_playing);
if let Some(player) = &self.player {