Skip to content

Commit

Permalink
Make setPlaybackRate behavior consistent. Closes #138.
Browse files Browse the repository at this point in the history
Change-Id: I6a4be5acd37b42fb92bddc896009ae48cb92b5ec
  • Loading branch information
natalieharris committed Aug 4, 2015
1 parent 3936bfa commit a41e643
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/player/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_();
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a41e643

Please sign in to comment.