hls.js 1.6.0-beta.1.0.canary.10809 → 1.6.0-beta.1.0.canary.10810

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hls.js CHANGED
@@ -1057,7 +1057,7 @@
1057
1057
  // Some browsers don't allow to use bind on console object anyway
1058
1058
  // fallback to default if needed
1059
1059
  try {
1060
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10809");
1060
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10810");
1061
1061
  } catch (e) {
1062
1062
  /* log fn threw an exception. All logger methods are no-ops. */
1063
1063
  return createLogger();
@@ -2047,6 +2047,10 @@
2047
2047
  }
2048
2048
  return -1;
2049
2049
  }
2050
+ function useAlternateAudio(audioTrackUrl, hls) {
2051
+ var _hls$levels$hls$loadL;
2052
+ return !!audioTrackUrl && audioTrackUrl !== ((_hls$levels$hls$loadL = hls.levels[hls.loadLevel]) == null ? void 0 : _hls$levels$hls$loadL.uri);
2053
+ }
2050
2054
 
2051
2055
  var AbrController = /*#__PURE__*/function (_Logger) {
2052
2056
  function AbrController(_hls) {
@@ -16288,7 +16292,7 @@
16288
16292
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16289
16293
  }
16290
16294
 
16291
- var version = "1.6.0-beta.1.0.canary.10809";
16295
+ var version = "1.6.0-beta.1.0.canary.10810";
16292
16296
 
16293
16297
  // ensure the worker ends up in the bundle
16294
16298
  // If the worker should not be included this gets aliased to empty.js
@@ -17992,17 +17996,15 @@
17992
17996
  return -1;
17993
17997
  };
17994
17998
  _proto.loadPlaylist = function loadPlaylist(hlsUrlParameters) {
17995
- var _this$hls$levels$this;
17996
17999
  _BasePlaylistControll.prototype.loadPlaylist.call(this);
17997
18000
  var audioTrack = this.currentTrack;
17998
18001
  if (!this.shouldLoadPlaylist(audioTrack)) {
17999
18002
  return;
18000
18003
  }
18001
- if (audioTrack.url === ((_this$hls$levels$this = this.hls.levels[this.hls.loadLevel]) == null ? void 0 : _this$hls$levels$this.uri)) {
18002
- // Do not load audio rendition with URI matching main variant URI
18003
- return;
18004
+ // Do not load audio rendition with URI matching main variant URI
18005
+ if (useAlternateAudio(audioTrack.url, this.hls)) {
18006
+ this.scheduleLoading(audioTrack, hlsUrlParameters);
18004
18007
  }
18005
- this.scheduleLoading(audioTrack, hlsUrlParameters);
18006
18008
  };
18007
18009
  _proto.loadingPlaylist = function loadingPlaylist(audioTrack, hlsUrlParameters) {
18008
18010
  _BasePlaylistControll.prototype.loadingPlaylist.call(this, audioTrack, hlsUrlParameters);
@@ -24517,6 +24519,10 @@
24517
24519
  this.hls.on(Events.BUFFER_CODECS, this.onBufferCodecs, this);
24518
24520
  };
24519
24521
  _proto.onLevelUpdated = function onLevelUpdated(event, data) {
24522
+ if (data.level === -1) {
24523
+ // level was removed
24524
+ return;
24525
+ }
24520
24526
  var main = this.hls.levels[data.level];
24521
24527
  var currentSelection = _objectSpread2(_objectSpread2({}, this.mediaSelection || this.altSelection), {}, {
24522
24528
  main: main
@@ -32613,9 +32619,10 @@
32613
32619
  transmuxer.push(payload, initSegmentData, audioCodec, videoCodec, frag, part, details.totalduration, accurateTimeOffset, chunkMeta, initPTS);
32614
32620
  };
32615
32621
  _proto.onAudioTrackSwitching = function onAudioTrackSwitching(event, data) {
32622
+ var hls = this.hls;
32616
32623
  // if any URL found on new audio track, it is an alternate audio track
32617
32624
  var fromAltAudio = this.altAudio === 2;
32618
- var altAudio = !!data.url;
32625
+ var altAudio = useAlternateAudio(data.url, hls);
32619
32626
  // if we switch on main audio, ensure that main fragment scheduling is synced with media.buffered
32620
32627
  // don't do anything if we switch to alt audio: audio stream controller is handling it.
32621
32628
  // we will just have to change buffer scheduling on audioTrackSwitched
@@ -32638,7 +32645,6 @@
32638
32645
  // Reset audio transmuxer so when switching back to main audio we're not still appending where we left off
32639
32646
  this.resetTransmuxer();
32640
32647
  }
32641
- var hls = this.hls;
32642
32648
  // If switching from alt to main audio, flush all audio and trigger track switched
32643
32649
  if (fromAltAudio) {
32644
32650
  hls.trigger(Events.BUFFER_FLUSHING, {
@@ -32654,8 +32660,7 @@
32654
32660
  }
32655
32661
  };
32656
32662
  _proto.onAudioTrackSwitched = function onAudioTrackSwitched(event, data) {
32657
- var trackId = data.id;
32658
- var altAudio = !!this.hls.audioTracks[trackId].url;
32663
+ var altAudio = useAlternateAudio(data.url, this.hls);
32659
32664
  if (altAudio) {
32660
32665
  var videoBuffer = this.videoBuffer;
32661
32666
  // if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered