hls.js 1.6.0-beta.1.0.canary.10763 → 1.6.0-beta.1.0.canary.10765

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.10763"}`);
403
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10765"}`);
404
404
  } catch (e) {
405
405
  /* log fn threw an exception. All logger methods are no-ops. */
406
406
  return createLogger();
@@ -1884,8 +1884,10 @@ class AbrController extends Logger {
1884
1884
  continue;
1885
1885
  }
1886
1886
  if (config.useMediaCapabilities && !levelInfo.supportedResult && !levelInfo.supportedPromise) {
1887
+ var _levelInfo$videoCodec;
1887
1888
  const mediaCapabilities = navigator.mediaCapabilities;
1888
- if (typeof (mediaCapabilities == null ? void 0 : mediaCapabilities.decodingInfo) === 'function' && requiresMediaCapabilitiesDecodingInfo(levelInfo, audioTracksByGroup, currentVideoRange, currentFrameRate, currentBw, audioPreference)) {
1889
+ if (typeof (mediaCapabilities == null ? void 0 : mediaCapabilities.decodingInfo) === 'function' && (requiresMediaCapabilitiesDecodingInfo(levelInfo, audioTracksByGroup, currentVideoRange, currentFrameRate, currentBw, audioPreference) || ((_levelInfo$videoCodec = levelInfo.videoCodec) == null ? void 0 : _levelInfo$videoCodec.substring(0, 4)) === 'hvc1') // Force media capabilities check for HEVC to avoid failure on Windows
1890
+ ) {
1889
1891
  levelInfo.supportedPromise = getMediaDecodingInfoPromise(levelInfo, audioTracksByGroup, mediaCapabilities);
1890
1892
  levelInfo.supportedPromise.then(decodingInfo => {
1891
1893
  if (!this.hls) {
@@ -1901,6 +1903,9 @@ class AbrController extends Logger {
1901
1903
  if (index > -1 && levels.length > 1) {
1902
1904
  this.log(`Removing unsupported level ${index}`);
1903
1905
  this.hls.removeLevel(index);
1906
+ if (this.hls.loadLevel === -1) {
1907
+ this.hls.nextLoadLevel = 0;
1908
+ }
1904
1909
  }
1905
1910
  }
1906
1911
  });
@@ -9769,7 +9774,7 @@ var eventemitter3 = {exports: {}};
9769
9774
  var eventemitter3Exports = eventemitter3.exports;
9770
9775
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9771
9776
 
9772
- const version = "1.6.0-beta.1.0.canary.10763";
9777
+ const version = "1.6.0-beta.1.0.canary.10765";
9773
9778
 
9774
9779
  // ensure the worker ends up in the bundle
9775
9780
  // If the worker should not be included this gets aliased to empty.js
@@ -17379,7 +17384,8 @@ class AudioTrackController extends BasePlaylistController {
17379
17384
  url,
17380
17385
  id,
17381
17386
  groupId,
17382
- deliveryDirectives: hlsUrlParameters || null
17387
+ deliveryDirectives: hlsUrlParameters || null,
17388
+ track: audioTrack
17383
17389
  });
17384
17390
  }
17385
17391
  }
@@ -22420,7 +22426,8 @@ class SubtitleTrackController extends BasePlaylistController {
22420
22426
  url,
22421
22427
  id,
22422
22428
  groupId,
22423
- deliveryDirectives: hlsUrlParameters || null
22429
+ deliveryDirectives: hlsUrlParameters || null,
22430
+ track: currentTrack
22424
22431
  });
22425
22432
  }
22426
22433
  }
@@ -24461,6 +24468,7 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`);
24461
24468
  this.schedule.reset();
24462
24469
  this.emptyPlayerQueue();
24463
24470
  this.clearScheduleState();
24471
+ this.shouldPlay = false;
24464
24472
  this.bufferedPos = this.timelinePos = -1;
24465
24473
  this.mediaSelection = this.altSelection = this.manager = this.requiredTracks = null;
24466
24474
  // BUFFER_CODECS listener added here for buffer-controller to handle it first where it adds tracks
@@ -30494,7 +30502,7 @@ class LevelController extends BasePlaylistController {
30494
30502
  level,
30495
30503
  details
30496
30504
  } = data;
30497
- const curLevel = this._levels[level];
30505
+ const curLevel = data.levelInfo;
30498
30506
  if (!curLevel) {
30499
30507
  var _data$deliveryDirecti;
30500
30508
  this.warn(`Invalid level index ${level}`);
@@ -30505,7 +30513,7 @@ class LevelController extends BasePlaylistController {
30505
30513
  }
30506
30514
 
30507
30515
  // only process level loaded events matching with expected level
30508
- if (level === this.currentLevelIndex) {
30516
+ if (curLevel === this.currentLevel) {
30509
30517
  // reset level load error counter on successful level loaded only if there is no issues with fragments
30510
30518
  if (curLevel.fragmentError === 0) {
30511
30519
  curLevel.loadError = 0;
@@ -30543,6 +30551,7 @@ class LevelController extends BasePlaylistController {
30543
30551
  this.hls.trigger(Events.LEVEL_LOADING, {
30544
30552
  url,
30545
30553
  level: currentLevelIndex,
30554
+ levelInfo: currentLevel,
30546
30555
  pathwayId: currentLevel.attrs['PATHWAY-ID'],
30547
30556
  id: 0,
30548
30557
  // Deprecated Level urlId
@@ -31476,7 +31485,7 @@ class StreamController extends BaseStreamController {
31476
31485
  if (!levels || this.state !== State.IDLE) {
31477
31486
  return;
31478
31487
  }
31479
- const level = levels[data.level];
31488
+ const level = data.levelInfo;
31480
31489
  if (!level.details || level.details.live && this.levelLastLoaded !== level || this.waitForCdnTuneIn(level.details)) {
31481
31490
  this.state = State.WAITING_LEVEL;
31482
31491
  }
@@ -31495,7 +31504,7 @@ class StreamController extends BaseStreamController {
31495
31504
  return;
31496
31505
  }
31497
31506
  this.log(`Level ${newLevelId} loaded [${newDetails.startSN},${newDetails.endSN}]${newDetails.lastPartSn ? `[part-${newDetails.lastPartSn}-${newDetails.lastPartIndex}]` : ''}, cc [${newDetails.startCC}, ${newDetails.endCC}] duration:${duration}`);
31498
- const curLevel = levels[newLevelId];
31507
+ const curLevel = data.levelInfo;
31499
31508
  const fragCurrent = this.fragCurrent;
31500
31509
  if (fragCurrent && (this.state === State.FRAG_LOADING || this.state === State.FRAG_LOADING_WAITING_RETRY)) {
31501
31510
  if (fragCurrent.level !== data.level && fragCurrent.loader) {
@@ -32568,6 +32577,7 @@ class PlaylistLoader {
32568
32577
  hls.on(Events.LEVEL_LOADING, this.onLevelLoading, this);
32569
32578
  hls.on(Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this);
32570
32579
  hls.on(Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this);
32580
+ hls.on(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);
32571
32581
  }
32572
32582
  unregisterListeners() {
32573
32583
  const {
@@ -32577,6 +32587,7 @@ class PlaylistLoader {
32577
32587
  hls.off(Events.LEVEL_LOADING, this.onLevelLoading, this);
32578
32588
  hls.off(Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this);
32579
32589
  hls.off(Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this);
32590
+ hls.off(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);
32580
32591
  }
32581
32592
 
32582
32593
  /**
@@ -32628,7 +32639,8 @@ class PlaylistLoader {
32628
32639
  responseType: 'text',
32629
32640
  type: PlaylistContextType.MANIFEST,
32630
32641
  url,
32631
- deliveryDirectives: null
32642
+ deliveryDirectives: null,
32643
+ levelOrTrack: null
32632
32644
  });
32633
32645
  }
32634
32646
  onLevelLoading(event, data) {
@@ -32637,7 +32649,8 @@ class PlaylistLoader {
32637
32649
  level,
32638
32650
  pathwayId,
32639
32651
  url,
32640
- deliveryDirectives
32652
+ deliveryDirectives,
32653
+ levelInfo
32641
32654
  } = data;
32642
32655
  this.load({
32643
32656
  id,
@@ -32646,7 +32659,8 @@ class PlaylistLoader {
32646
32659
  responseType: 'text',
32647
32660
  type: PlaylistContextType.LEVEL,
32648
32661
  url,
32649
- deliveryDirectives
32662
+ deliveryDirectives,
32663
+ levelOrTrack: levelInfo
32650
32664
  });
32651
32665
  }
32652
32666
  onAudioTrackLoading(event, data) {
@@ -32654,7 +32668,8 @@ class PlaylistLoader {
32654
32668
  id,
32655
32669
  groupId,
32656
32670
  url,
32657
- deliveryDirectives
32671
+ deliveryDirectives,
32672
+ track
32658
32673
  } = data;
32659
32674
  this.load({
32660
32675
  id,
@@ -32663,7 +32678,8 @@ class PlaylistLoader {
32663
32678
  responseType: 'text',
32664
32679
  type: PlaylistContextType.AUDIO_TRACK,
32665
32680
  url,
32666
- deliveryDirectives
32681
+ deliveryDirectives,
32682
+ levelOrTrack: track
32667
32683
  });
32668
32684
  }
32669
32685
  onSubtitleTrackLoading(event, data) {
@@ -32671,7 +32687,8 @@ class PlaylistLoader {
32671
32687
  id,
32672
32688
  groupId,
32673
32689
  url,
32674
- deliveryDirectives
32690
+ deliveryDirectives,
32691
+ track
32675
32692
  } = data;
32676
32693
  this.load({
32677
32694
  id,
@@ -32680,9 +32697,21 @@ class PlaylistLoader {
32680
32697
  responseType: 'text',
32681
32698
  type: PlaylistContextType.SUBTITLE_TRACK,
32682
32699
  url,
32683
- deliveryDirectives
32700
+ deliveryDirectives,
32701
+ levelOrTrack: track
32684
32702
  });
32685
32703
  }
32704
+ onLevelsUpdated(event, data) {
32705
+ // abort and delete loader of removed levels
32706
+ const loader = this.loaders[PlaylistContextType.LEVEL];
32707
+ if (loader) {
32708
+ const context = loader.context;
32709
+ if (context && !data.levels.some(lvl => lvl === context.levelOrTrack)) {
32710
+ loader.abort();
32711
+ delete this.loaders[PlaylistContextType.LEVEL];
32712
+ }
32713
+ }
32714
+ }
32686
32715
  load(context) {
32687
32716
  var _context$deliveryDire;
32688
32717
  const config = this.hls.config;
@@ -32693,7 +32722,7 @@ class PlaylistLoader {
32693
32722
  let loader = this.getInternalLoader(context);
32694
32723
  if (loader) {
32695
32724
  const loaderContext = loader.context;
32696
- if (loaderContext && loaderContext.url === context.url && loaderContext.level === context.level) {
32725
+ if (loaderContext && loaderContext.url === context.url && loaderContext.levelOrTrack === context.levelOrTrack) {
32697
32726
  // same URL can't overlap
32698
32727
  this.hls.logger.trace('[playlist-loader]: playlist request ongoing');
32699
32728
  return;
@@ -33015,6 +33044,7 @@ class PlaylistLoader {
33015
33044
  case PlaylistContextType.LEVEL:
33016
33045
  hls.trigger(Events.LEVEL_LOADED, {
33017
33046
  details: levelDetails,
33047
+ levelInfo: context.levelOrTrack || hls.levels[0],
33018
33048
  level: levelIndex || 0,
33019
33049
  id: id || 0,
33020
33050
  stats,
@@ -33025,6 +33055,7 @@ class PlaylistLoader {
33025
33055
  case PlaylistContextType.AUDIO_TRACK:
33026
33056
  hls.trigger(Events.AUDIO_TRACK_LOADED, {
33027
33057
  details: levelDetails,
33058
+ track: context.levelOrTrack,
33028
33059
  id: id || 0,
33029
33060
  groupId: groupId || '',
33030
33061
  stats,
@@ -33035,6 +33066,7 @@ class PlaylistLoader {
33035
33066
  case PlaylistContextType.SUBTITLE_TRACK:
33036
33067
  hls.trigger(Events.SUBTITLE_TRACK_LOADED, {
33037
33068
  details: levelDetails,
33069
+ track: context.levelOrTrack,
33038
33070
  id: id || 0,
33039
33071
  groupId: groupId || '',
33040
33072
  stats,