[fix] video slider not working on preview screen
This commit is contained in:
parent
4ef31a7b47
commit
47d15f4ba8
2 changed files with 14 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue