Skip to content

Commit 684dc25

Browse files
committed
Fall back to fast forward by seeking on large rate values.
If a value given to player.trickPlay() is outside of what the browsers accepts for video.playbackRate, fall back to fast forward by seeking, same as we do for rewind. Closes #1957. Change-Id: I12275377b70dc1d0e2ece7f5647e6590f0304cf5
1 parent e74f0b7 commit 684dc25

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/media/play_rate_controller.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,22 @@ shaka.media.PlayRateController = class {
113113
const rate = this.calculateCurrentRate_();
114114

115115
if (rate >= 0) {
116-
this.applyRate_(rate);
117-
return;
116+
try {
117+
this.applyRate_(rate);
118+
return;
119+
} catch (e) {
120+
// Fall through to the next clause.
121+
//
122+
// Fast forward is accomplished through setting video.playbackRate.
123+
// If the play rate value is not supported by the browser (too big),
124+
// the browsers will throw.
125+
// Use this as a cue to fall back to fast forward through repeated
126+
// seeking, which is what we do for rewind as well.
127+
}
118128
}
119129

120-
// When moving backwards, set the playback rate to 0 so that we can manually
130+
// When moving backwards or forwards in large steps,
131+
// set the playback rate to 0 so that we can manually
121132
// seek backwards with out fighting the playhead.
122133
this.timer_.tickEvery(this.pollRate_);
123134
this.applyRate_(0);

0 commit comments

Comments
 (0)