[fix] video slider not working on preview screen
Some checks failed
/ clippy (push) Failing after 6m32s
/ test (push) Failing after 6m32s

This commit is contained in:
Chris Cochrun 2026-05-14 14:13:29 -05:00
parent 4ef31a7b47
commit 47d15f4ba8
2 changed files with 14 additions and 1 deletions

View file

@ -1722,6 +1722,11 @@ impl cosmic::Application for App {
.on_press(Message::Present(presenter::Message::PlayPauseVideo))
},
);
let video_position = if let Some(video) = &self.presenter.preview_video {
video.position().as_secs_f64()
} else {
0.0
};
let slide_preview = column![
Space::new().height(Length::Fill),
@ -1732,7 +1737,7 @@ impl cosmic::Application for App {
row![
video_button_icon,
Container::new(
slider(0.0..=video_range, self.presenter.video_position, |pos| {
slider(0.0..=video_range, video_position, |pos| {
Message::Present(presenter::Message::VideoPos(pos))
})
.step(0.1)

View file

@ -409,6 +409,14 @@ impl Presenter {
Err(e) => error!("Problem changing video position: {e}"),
}
}
if let Some(video) = &mut self.presentation_video {
let position =
Position::Time(std::time::Duration::from_secs_f64(position));
match video.seek(position, false) {
Ok(()) => debug!("Video position changed: {:?}", position),
Err(e) => error!("Problem changing video position: {e}"),
}
}
}
Message::VideoFrame => {
if let Some(video) = &self.preview_video