PlayerWidget: Tweak rewind on pause behavior.
Only rewind on pause if the stream position is passed a certain point. Else it can feel a bit weird if you just started the stream and it immediatly rewinds.
This commit is contained in:
parent
bac7283a90
commit
35a475e45b
@ -375,7 +375,13 @@ impl PlayerExt for PlayerWidget {
|
|||||||
self.controls.play.show();
|
self.controls.play.show();
|
||||||
|
|
||||||
self.player.pause();
|
self.player.pause();
|
||||||
self.seek(ClockTime::from_seconds(5), SeekDirection::Backwards);
|
|
||||||
|
// Only rewind on pause if the stream position is passed a certain point.
|
||||||
|
if let Some(sec) = self.player.get_position().seconds() {
|
||||||
|
if sec >= 90 {
|
||||||
|
self.seek(ClockTime::from_seconds(5), SeekDirection::Backwards);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
@ -385,6 +391,7 @@ impl PlayerExt for PlayerWidget {
|
|||||||
|
|
||||||
self.player.stop();
|
self.player.stop();
|
||||||
|
|
||||||
|
// Reset the slider bar to the start
|
||||||
self.timer.on_position_updated(Position(ClockTime::from_seconds(0)));
|
self.timer.on_position_updated(Position(ClockTime::from_seconds(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user