mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-24 17:35:10 +03:00
Make setPlaybackRate behavior consistent. Closes #138.
Change-Id: I6a4be5acd37b42fb92bddc896009ae48cb92b5ec
This commit is contained in:
@@ -427,6 +427,13 @@ shaka.player.Player.prototype.onPlaying_ = function(event) {
|
||||
shaka.log.debug('onPlaying_', event);
|
||||
shaka.timer.begin('playing');
|
||||
|
||||
// Start rewind timer if playback rate should be negative and a rewind timer
|
||||
// is not already set.
|
||||
if (!this.rewindTimer_ && this.playbackRate_ < 0) {
|
||||
this.video_.playbackRate = 0;
|
||||
this.onRewindTimer_(
|
||||
this.video_.currentTime, Date.now(), this.playbackRate_);
|
||||
}
|
||||
if (this.buffering_) {
|
||||
this.endBufferingState_();
|
||||
}
|
||||
@@ -673,7 +680,8 @@ shaka.player.Player.prototype.setPlaybackRate = function(rate) {
|
||||
if (rate >= 0) {
|
||||
// Slow-mo or fast-forward are handled natively by the UA.
|
||||
this.video_.playbackRate = rate;
|
||||
} else {
|
||||
// Only rewind when not paused.
|
||||
} else if (!this.video_.paused) {
|
||||
// Rewind is not supported by any UA to date (2015), so we fake it.
|
||||
// http://crbug.com/33099
|
||||
this.video_.playbackRate = 0;
|
||||
|
||||
Reference in New Issue
Block a user