Respond to duration changes, fixes #107

This commit is contained in:
Jeremy Soller 2025-08-15 10:15:28 -06:00
parent 0e0718e45d
commit 58c778832b
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA
2 changed files with 7 additions and 1 deletions

2
Cargo.lock generated
View file

@ -2734,7 +2734,7 @@ dependencies = [
[[package]]
name = "iced_video_player"
version = "0.6.0"
source = "git+https://github.com/jackpot51/iced_video_player.git?branch=prev-cosmic#3f9a1b690a41171d212e79fd6c8488dc9b1b8f4c"
source = "git+https://github.com/jackpot51/iced_video_player.git?branch=prev-cosmic#0c669eca4b377544a4df2a47d737c024d36d901c"
dependencies = [
"glib",
"gstreamer",

View file

@ -240,6 +240,7 @@ pub enum Message {
Config(Config),
ConfigState(ConfigState),
DropdownToggle(DropdownKind),
DurationChanged(Duration),
FileClose,
FileLoad(url::Url),
FileOpen,
@ -993,6 +994,10 @@ impl Application for App {
self.dropdown_opt = Some(menu_kind);
}
}
Message::DurationChanged(duration) => {
self.duration = duration.as_secs_f64();
self.update_mpris_meta();
}
Message::FileClose => {
self.close();
}
@ -1414,6 +1419,7 @@ impl Application for App {
let mut video_player: Element<_> = VideoPlayer::new(video)
.mouse_hidden(!self.controls)
.on_duration_changed(Message::DurationChanged)
.on_end_of_stream(Message::EndOfStream)
.on_missing_plugin(Message::MissingPlugin)
.on_new_frame(Message::NewFrame)