Skip to content

Commit

Permalink
fix: Dont use trick play track for liveSync feature (#7219)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Aug 29, 2024
1 parent af80b87 commit 70258db
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4454,9 +4454,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
* beginning or end of the seekable range for the content.
*
* @param {number} rate
* @param {boolean=} useTrickPlayTrack
* @export
*/
trickPlay(rate) {
trickPlay(rate, useTrickPlayTrack = true) {
// A playbackRate of 0 is used internally when we are in a buffering state,
// and doesn't make sense for trick play. If you set a rate of 0 for trick
// play, we will reject it and issue a warning. If it happens during a
Expand All @@ -4478,7 +4479,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {

if (this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE) {
this.abrManager_.playbackRateChanged(rate);
this.streamingEngine_.setTrickPlay(Math.abs(rate) > 1);
this.streamingEngine_.setTrickPlay(
useTrickPlayTrack && Math.abs(rate) > 1);
}
if (this.isLive()) {
this.trickPlayEventManager_.listen(this.video_, 'timeupdate', () => {
Expand Down Expand Up @@ -6502,7 +6504,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
shaka.log.debug('Buffer fullness ratio (' + bufferFullness + ') ' +
'is less than the vodDynamicPlaybackRateBufferRatio (' +
bufferThreshold + '). Updating playbackRate to ' + minPlaybackRate);
this.trickPlay(minPlaybackRate);
this.trickPlay(minPlaybackRate, /* useTrickPlayTrack= */ false);
}
} else if (bufferFullness == 1) {
if (playbackRate !== this.playRateController_.getDefaultRate()) {
Expand Down Expand Up @@ -6629,15 +6631,15 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
timeSinceLastRebuffer + 's) ' +
'is less than the live sync panicThreshold (' + panicThreshold +
's). Updating playbackRate to ' + minPlaybackRate);
this.trickPlay(minPlaybackRate);
this.trickPlay(minPlaybackRate, /* useTrickPlayTrack= */ false);
}
} else if (maxLatency && maxPlaybackRate &&
(latency - offset) > maxLatency) {
if (playbackRate != maxPlaybackRate) {
shaka.log.debug('Latency (' + latency + 's) is greater than ' +
'live sync maxLatency (' + maxLatency + 's). ' +
'Updating playbackRate to ' + maxPlaybackRate);
this.trickPlay(maxPlaybackRate);
this.trickPlay(maxPlaybackRate, /* useTrickPlayTrack= */ false);
}
this.targetLatencyReached_ = null;
} else if (minLatency && minPlaybackRate &&
Expand All @@ -6646,7 +6648,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
shaka.log.debug('Latency (' + latency + 's) is smaller than ' +
'live sync minLatency (' + minLatency + 's). ' +
'Updating playbackRate to ' + minPlaybackRate);
this.trickPlay(minPlaybackRate);
this.trickPlay(minPlaybackRate, /* useTrickPlayTrack= */ false);
}
this.targetLatencyReached_ = null;
} else if (playbackRate !== this.playRateController_.getDefaultRate()) {
Expand Down

0 comments on commit 70258db

Please sign in to comment.