Skip to content

Commit

Permalink
fix: Fix bad warning when use selectAudioLanguage (#6999)
Browse files Browse the repository at this point in the history
Fixes #6665
  • Loading branch information
avelad committed Jul 10, 2024
1 parent 3f7b20e commit f86e93b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4604,13 +4604,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
*/
selectVariantTrack(track, clearBuffer = false, safeMargin = 0) {
if (this.manifest_ && this.streamingEngine_) {
if (this.config_.abr.enabled) {
shaka.log.alwaysWarn('Changing tracks while abr manager is enabled ' +
'will likely result in the selected track ' +
'being overriden. Consider disabling abr before ' +
'calling selectVariantTrack().');
}

const variant = this.manifest_.variants.find(
(variant) => variant.id == track.id);
if (!variant) {
Expand All @@ -4627,6 +4620,17 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
return;
}

const active = this.streamingEngine_.getCurrentVariant();
if (this.config_.abr.enabled && (active.video != variant.video ||
(active.audio && variant.audio &&
active.audio.language == variant.audio.language &&
active.audio.channelsCount == variant.audio.channelsCount))) {
shaka.log.alwaysWarn('Changing tracks while abr manager is enabled ' +
'will likely result in the selected track ' +
'being overriden. Consider disabling abr before ' +
'calling selectVariantTrack().');
}

this.switchVariant_(
variant, /* fromAdaptation= */ false, clearBuffer, safeMargin);

Expand Down

0 comments on commit f86e93b

Please sign in to comment.