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:
Jordan Petridis 2018-06-23 16:08:24 +03:00
parent eeef0d13ff
commit faeafc329c

View File

@ -375,7 +375,13 @@ impl PlayerExt for PlayerWidget {
self.controls.play.show();
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)]
@ -385,6 +391,7 @@ impl PlayerExt for PlayerWidget {
self.player.stop();
// Reset the slider bar to the start
self.timer.on_position_updated(Position(ClockTime::from_seconds(0)));
}