Merge pull request #283 from xDAndrew/bug/forward-seek-button-fix

Fix seek direction handling and clamp forward seeking
This commit is contained in:
Jeremy Soller 2026-06-03 11:54:24 -06:00 committed by GitHub
commit 2c1ace7170
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 => {