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.mjs CHANGED
@@ -400,7 +400,7 @@ function enableLogs(debugConfig, context, id) {
400
400
  // Some browsers don't allow to use bind on console object anyway
401
401
  // fallback to default if needed
402
402
  try {
403
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10809"}`);
403
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10810"}`);
404
404
  } catch (e) {
405
405
  /* log fn threw an exception. All logger methods are no-ops. */
406
406
  return createLogger();
@@ -1305,6 +1305,10 @@ function searchDownAndUpList(arr, searchIndex, predicate) {
1305
1305
  }
1306
1306
  return -1;
1307
1307
  }
1308
+ function useAlternateAudio(audioTrackUrl, hls) {
1309
+ var _hls$levels$hls$loadL;
1310
+ return !!audioTrackUrl && audioTrackUrl !== ((_hls$levels$hls$loadL = hls.levels[hls.loadLevel]) == null ? void 0 : _hls$levels$hls$loadL.uri);
1311
+ }
1308
1312
 
1309
1313
  class AbrController extends Logger {
1310
1314
  constructor(_hls) {
@@ -9831,7 +9835,7 @@ var eventemitter3 = {exports: {}};
9831
9835
  var eventemitter3Exports = eventemitter3.exports;
9832
9836
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9833
9837
 
9834
- const version = "1.6.0-beta.1.0.canary.10809";
9838
+ const version = "1.6.0-beta.1.0.canary.10810";
9835
9839
 
9836
9840
  // ensure the worker ends up in the bundle
9837
9841
  // If the worker should not be included this gets aliased to empty.js
@@ -17438,17 +17442,15 @@ class AudioTrackController extends BasePlaylistController {
17438
17442
  return -1;
17439
17443
  }
17440
17444
  loadPlaylist(hlsUrlParameters) {
17441
- var _this$hls$levels$this;
17442
17445
  super.loadPlaylist();
17443
17446
  const audioTrack = this.currentTrack;
17444
17447
  if (!this.shouldLoadPlaylist(audioTrack)) {
17445
17448
  return;
17446
17449
  }
17447
- if (audioTrack.url === ((_this$hls$levels$this = this.hls.levels[this.hls.loadLevel]) == null ? void 0 : _this$hls$levels$this.uri)) {
17448
- // Do not load audio rendition with URI matching main variant URI
17449
- return;
17450
+ // Do not load audio rendition with URI matching main variant URI
17451
+ if (useAlternateAudio(audioTrack.url, this.hls)) {
17452
+ this.scheduleLoading(audioTrack, hlsUrlParameters);
17450
17453
  }
17451
- this.scheduleLoading(audioTrack, hlsUrlParameters);
17452
17454
  }
17453
17455
  loadingPlaylist(audioTrack, hlsUrlParameters) {
17454
17456
  super.loadingPlaylist(audioTrack, hlsUrlParameters);
@@ -24581,6 +24583,10 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
24581
24583
  this.hls.on(Events.BUFFER_CODECS, this.onBufferCodecs, this);
24582
24584
  }
24583
24585
  onLevelUpdated(event, data) {
24586
+ if (data.level === -1) {
24587
+ // level was removed
24588
+ return;
24589
+ }
24584
24590
  const main = this.hls.levels[data.level];
24585
24591
  const currentSelection = _objectSpread2(_objectSpread2({}, this.mediaSelection || this.altSelection), {}, {
24586
24592
  main
@@ -31715,9 +31721,10 @@ class StreamController extends BaseStreamController {
31715
31721
  transmuxer.push(payload, initSegmentData, audioCodec, videoCodec, frag, part, details.totalduration, accurateTimeOffset, chunkMeta, initPTS);
31716
31722
  }
31717
31723
  onAudioTrackSwitching(event, data) {
31724
+ const hls = this.hls;
31718
31725
  // if any URL found on new audio track, it is an alternate audio track
31719
31726
  const fromAltAudio = this.altAudio === 2;
31720
- const altAudio = !!data.url;
31727
+ const altAudio = useAlternateAudio(data.url, hls);
31721
31728
  // if we switch on main audio, ensure that main fragment scheduling is synced with media.buffered
31722
31729
  // don't do anything if we switch to alt audio: audio stream controller is handling it.
31723
31730
  // we will just have to change buffer scheduling on audioTrackSwitched
@@ -31740,7 +31747,6 @@ class StreamController extends BaseStreamController {
31740
31747
  // Reset audio transmuxer so when switching back to main audio we're not still appending where we left off
31741
31748
  this.resetTransmuxer();
31742
31749
  }
31743
- const hls = this.hls;
31744
31750
  // If switching from alt to main audio, flush all audio and trigger track switched
31745
31751
  if (fromAltAudio) {
31746
31752
  hls.trigger(Events.BUFFER_FLUSHING, {
@@ -31756,8 +31762,7 @@ class StreamController extends BaseStreamController {
31756
31762
  }
31757
31763
  }
31758
31764
  onAudioTrackSwitched(event, data) {
31759
- const trackId = data.id;
31760
- const altAudio = !!this.hls.audioTracks[trackId].url;
31765
+ const altAudio = useAlternateAudio(data.url, this.hls);
31761
31766
  if (altAudio) {
31762
31767
  const videoBuffer = this.videoBuffer;
31763
31768
  // if we switched on alternate audio, ensure that main fragment scheduling is synced with video sourcebuffer buffered