Skip to content

Commit

Permalink
fix: Don't throw an error when trying to disable a trick mode stream (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Aug 29, 2024
1 parent 32cf960 commit 855d714
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -7260,19 +7260,32 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
if (hasAltStream) {
let didDisableStream = false;

let isTrickModeVideo = false;

for (const variant of this.manifest_.variants) {
const candidate = variant[stream.type];

if (candidate && candidate.id === stream.id) {
if (!candidate) {
continue;
}

if (candidate.id === stream.id) {
variant.disabledUntilTime = (Date.now() / 1000) + disableTime;
didDisableStream = true;

shaka.log.v2(
'Disabled stream ' + stream.type + ':' + stream.id +
' for ' + disableTime + ' seconds...');
} else if (candidate.trickModeVideo &&
candidate.trickModeVideo.id == stream.id) {
isTrickModeVideo = true;
}
}

if (!didDisableStream && isTrickModeVideo) {
return false;
}

goog.asserts.assert(didDisableStream, 'Must have disabled stream');

this.checkVariantsTimer_.tickEvery(1);
Expand Down

0 comments on commit 855d714

Please sign in to comment.