Retain paused/playing state on scrub
Closes: #110 Prior to this patch, seeking incorrectly resumed playing even if the player was paused when it should stay paused.
This commit is contained in:
parent
fadecd0068
commit
7c16f3e0b4
1 changed files with 4 additions and 1 deletions
|
|
@ -274,6 +274,7 @@ pub struct App {
|
||||||
position: f64,
|
position: f64,
|
||||||
duration: f64,
|
duration: f64,
|
||||||
dragging: bool,
|
dragging: bool,
|
||||||
|
paused_on_scrub: bool,
|
||||||
audio_codes: Vec<String>,
|
audio_codes: Vec<String>,
|
||||||
audio_tags: Vec<gst::TagList>,
|
audio_tags: Vec<gst::TagList>,
|
||||||
current_audio: i32,
|
current_audio: i32,
|
||||||
|
|
@ -816,6 +817,7 @@ impl Application for App {
|
||||||
position: 0.0,
|
position: 0.0,
|
||||||
duration: 0.0,
|
duration: 0.0,
|
||||||
dragging: false,
|
dragging: false,
|
||||||
|
paused_on_scrub: false,
|
||||||
audio_codes: Vec::new(),
|
audio_codes: Vec::new(),
|
||||||
audio_tags: Vec::new(),
|
audio_tags: Vec::new(),
|
||||||
current_audio: -1,
|
current_audio: -1,
|
||||||
|
|
@ -1183,6 +1185,7 @@ impl Application for App {
|
||||||
if let Some(video) = &mut self.video_opt {
|
if let Some(video) = &mut self.video_opt {
|
||||||
self.dragging = true;
|
self.dragging = true;
|
||||||
self.position = secs;
|
self.position = secs;
|
||||||
|
self.paused_on_scrub = video.paused();
|
||||||
video.set_paused(true);
|
video.set_paused(true);
|
||||||
let duration = Duration::try_from_secs_f64(self.position).unwrap_or_default();
|
let duration = Duration::try_from_secs_f64(self.position).unwrap_or_default();
|
||||||
video.seek(duration, true).expect("seek");
|
video.seek(duration, true).expect("seek");
|
||||||
|
|
@ -1205,7 +1208,7 @@ impl Application for App {
|
||||||
self.dragging = false;
|
self.dragging = false;
|
||||||
let duration = Duration::try_from_secs_f64(self.position).unwrap_or_default();
|
let duration = Duration::try_from_secs_f64(self.position).unwrap_or_default();
|
||||||
video.seek(duration, true).expect("seek");
|
video.seek(duration, true).expect("seek");
|
||||||
video.set_paused(false);
|
video.set_paused(self.paused_on_scrub);
|
||||||
self.update_controls(true);
|
self.update_controls(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue