Make setPlaybackRate behavior consistent. Closes #138.

Change-Id: I6a4be5acd37b42fb92bddc896009ae48cb92b5ec
This commit is contained in:
Natalie Harris
2015-08-04 11:43:47 -07:00
parent 3936bfafb6
commit a41e6438d6
+9 -1
View File
@@ -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;