Merge pull request #283 from xDAndrew/bug/forward-seek-button-fix
Fix seek direction handling and clamp forward seeking
This commit is contained in:
commit
2c1ace7170
1 changed files with 3 additions and 4 deletions
|
|
@ -1350,10 +1350,9 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
Message::SeekRelative(secs) => {
|
Message::SeekRelative(secs) => {
|
||||||
if let Some(video) = &mut self.video_opt {
|
if let Some(video) = &mut self.video_opt {
|
||||||
self.position = video.position().as_secs_f64();
|
self.position = (video.position().as_secs_f64() + secs).clamp(0.0, self.duration);
|
||||||
let duration =
|
let target = Duration::try_from_secs_f64(self.position).unwrap_or_default();
|
||||||
Duration::try_from_secs_f64(self.position + secs).unwrap_or_default();
|
video.seek(target, true).expect("seek");
|
||||||
video.seek(duration, true).expect("seek");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::SeekRelease => {
|
Message::SeekRelease => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue