hls.js 1.6.0-beta.1.0.canary.10764 → 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.light.js CHANGED
@@ -1028,7 +1028,7 @@
1028
1028
  // Some browsers don't allow to use bind on console object anyway
1029
1029
  // fallback to default if needed
1030
1030
  try {
1031
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10764");
1031
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10765");
1032
1032
  } catch (e) {
1033
1033
  /* log fn threw an exception. All logger methods are no-ops. */
1034
1034
  return createLogger();
@@ -16882,7 +16882,7 @@
16882
16882
  var _data$deliveryDirecti2;
16883
16883
  var level = data.level,
16884
16884
  details = data.details;
16885
- var curLevel = this._levels[level];
16885
+ var curLevel = data.levelInfo;
16886
16886
  if (!curLevel) {
16887
16887
  var _data$deliveryDirecti;
16888
16888
  this.warn("Invalid level index " + level);
@@ -16893,7 +16893,7 @@
16893
16893
  }
16894
16894
 
16895
16895
  // only process level loaded events matching with expected level
16896
- if (level === this.currentLevelIndex) {
16896
+ if (curLevel === this.currentLevel) {
16897
16897
  // reset level load error counter on successful level loaded only if there is no issues with fragments
16898
16898
  if (curLevel.fragmentError === 0) {
16899
16899
  curLevel.loadError = 0;
@@ -16931,6 +16931,7 @@
16931
16931
  this.hls.trigger(Events.LEVEL_LOADING, {
16932
16932
  url: url,
16933
16933
  level: currentLevelIndex,
16934
+ levelInfo: currentLevel,
16934
16935
  pathwayId: currentLevel.attrs['PATHWAY-ID'],
16935
16936
  id: 0,
16936
16937
  // Deprecated Level urlId
@@ -19691,7 +19692,7 @@
19691
19692
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
19692
19693
  }
19693
19694
 
19694
- var version = "1.6.0-beta.1.0.canary.10764";
19695
+ var version = "1.6.0-beta.1.0.canary.10765";
19695
19696
 
19696
19697
  // ensure the worker ends up in the bundle
19697
19698
  // If the worker should not be included this gets aliased to empty.js
@@ -20560,7 +20561,7 @@
20560
20561
  if (!levels || this.state !== State.IDLE) {
20561
20562
  return;
20562
20563
  }
20563
- var level = levels[data.level];
20564
+ var level = data.levelInfo;
20564
20565
  if (!level.details || level.details.live && this.levelLastLoaded !== level || this.waitForCdnTuneIn(level.details)) {
20565
20566
  this.state = State.WAITING_LEVEL;
20566
20567
  }
@@ -20577,7 +20578,7 @@
20577
20578
  return;
20578
20579
  }
20579
20580
  this.log("Level " + newLevelId + " loaded [" + newDetails.startSN + "," + newDetails.endSN + "]" + (newDetails.lastPartSn ? "[part-" + newDetails.lastPartSn + "-" + newDetails.lastPartIndex + "]" : '') + ", cc [" + newDetails.startCC + ", " + newDetails.endCC + "] duration:" + duration);
20580
- var curLevel = levels[newLevelId];
20581
+ var curLevel = data.levelInfo;
20581
20582
  var fragCurrent = this.fragCurrent;
20582
20583
  if (fragCurrent && (this.state === State.FRAG_LOADING || this.state === State.FRAG_LOADING_WAITING_RETRY)) {
20583
20584
  if (fragCurrent.level !== data.level && fragCurrent.loader) {
@@ -21639,6 +21640,7 @@
21639
21640
  hls.on(Events.LEVEL_LOADING, this.onLevelLoading, this);
21640
21641
  hls.on(Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this);
21641
21642
  hls.on(Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this);
21643
+ hls.on(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);
21642
21644
  };
21643
21645
  _proto.unregisterListeners = function unregisterListeners() {
21644
21646
  var hls = this.hls;
@@ -21646,6 +21648,7 @@
21646
21648
  hls.off(Events.LEVEL_LOADING, this.onLevelLoading, this);
21647
21649
  hls.off(Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this);
21648
21650
  hls.off(Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this);
21651
+ hls.off(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);
21649
21652
  }
21650
21653
 
21651
21654
  /**
@@ -21695,7 +21698,8 @@
21695
21698
  responseType: 'text',
21696
21699
  type: PlaylistContextType.MANIFEST,
21697
21700
  url: url,
21698
- deliveryDirectives: null
21701
+ deliveryDirectives: null,
21702
+ levelOrTrack: null
21699
21703
  });
21700
21704
  };
21701
21705
  _proto.onLevelLoading = function onLevelLoading(event, data) {
@@ -21703,7 +21707,8 @@
21703
21707
  level = data.level,
21704
21708
  pathwayId = data.pathwayId,
21705
21709
  url = data.url,
21706
- deliveryDirectives = data.deliveryDirectives;
21710
+ deliveryDirectives = data.deliveryDirectives,
21711
+ levelInfo = data.levelInfo;
21707
21712
  this.load({
21708
21713
  id: id,
21709
21714
  level: level,
@@ -21711,14 +21716,16 @@
21711
21716
  responseType: 'text',
21712
21717
  type: PlaylistContextType.LEVEL,
21713
21718
  url: url,
21714
- deliveryDirectives: deliveryDirectives
21719
+ deliveryDirectives: deliveryDirectives,
21720
+ levelOrTrack: levelInfo
21715
21721
  });
21716
21722
  };
21717
21723
  _proto.onAudioTrackLoading = function onAudioTrackLoading(event, data) {
21718
21724
  var id = data.id,
21719
21725
  groupId = data.groupId,
21720
21726
  url = data.url,
21721
- deliveryDirectives = data.deliveryDirectives;
21727
+ deliveryDirectives = data.deliveryDirectives,
21728
+ track = data.track;
21722
21729
  this.load({
21723
21730
  id: id,
21724
21731
  groupId: groupId,
@@ -21726,14 +21733,16 @@
21726
21733
  responseType: 'text',
21727
21734
  type: PlaylistContextType.AUDIO_TRACK,
21728
21735
  url: url,
21729
- deliveryDirectives: deliveryDirectives
21736
+ deliveryDirectives: deliveryDirectives,
21737
+ levelOrTrack: track
21730
21738
  });
21731
21739
  };
21732
21740
  _proto.onSubtitleTrackLoading = function onSubtitleTrackLoading(event, data) {
21733
21741
  var id = data.id,
21734
21742
  groupId = data.groupId,
21735
21743
  url = data.url,
21736
- deliveryDirectives = data.deliveryDirectives;
21744
+ deliveryDirectives = data.deliveryDirectives,
21745
+ track = data.track;
21737
21746
  this.load({
21738
21747
  id: id,
21739
21748
  groupId: groupId,
@@ -21741,9 +21750,23 @@
21741
21750
  responseType: 'text',
21742
21751
  type: PlaylistContextType.SUBTITLE_TRACK,
21743
21752
  url: url,
21744
- deliveryDirectives: deliveryDirectives
21753
+ deliveryDirectives: deliveryDirectives,
21754
+ levelOrTrack: track
21745
21755
  });
21746
21756
  };
21757
+ _proto.onLevelsUpdated = function onLevelsUpdated(event, data) {
21758
+ // abort and delete loader of removed levels
21759
+ var loader = this.loaders[PlaylistContextType.LEVEL];
21760
+ if (loader) {
21761
+ var context = loader.context;
21762
+ if (context && !data.levels.some(function (lvl) {
21763
+ return lvl === context.levelOrTrack;
21764
+ })) {
21765
+ loader.abort();
21766
+ delete this.loaders[PlaylistContextType.LEVEL];
21767
+ }
21768
+ }
21769
+ };
21747
21770
  _proto.load = function load(context) {
21748
21771
  var _context$deliveryDire,
21749
21772
  _this = this;
@@ -21755,7 +21778,7 @@
21755
21778
  var loader = this.getInternalLoader(context);
21756
21779
  if (loader) {
21757
21780
  var loaderContext = loader.context;
21758
- if (loaderContext && loaderContext.url === context.url && loaderContext.level === context.level) {
21781
+ if (loaderContext && loaderContext.url === context.url && loaderContext.levelOrTrack === context.levelOrTrack) {
21759
21782
  // same URL can't overlap
21760
21783
  this.hls.logger.trace('[playlist-loader]: playlist request ongoing');
21761
21784
  return;
@@ -22076,6 +22099,7 @@
22076
22099
  case PlaylistContextType.LEVEL:
22077
22100
  hls.trigger(Events.LEVEL_LOADED, {
22078
22101
  details: levelDetails,
22102
+ levelInfo: context.levelOrTrack || hls.levels[0],
22079
22103
  level: levelIndex || 0,
22080
22104
  id: id || 0,
22081
22105
  stats: stats,
@@ -22086,6 +22110,7 @@
22086
22110
  case PlaylistContextType.AUDIO_TRACK:
22087
22111
  hls.trigger(Events.AUDIO_TRACK_LOADED, {
22088
22112
  details: levelDetails,
22113
+ track: context.levelOrTrack,
22089
22114
  id: id || 0,
22090
22115
  groupId: groupId || '',
22091
22116
  stats: stats,
@@ -22096,6 +22121,7 @@
22096
22121
  case PlaylistContextType.SUBTITLE_TRACK:
22097
22122
  hls.trigger(Events.SUBTITLE_TRACK_LOADED, {
22098
22123
  details: levelDetails,
22124
+ track: context.levelOrTrack,
22099
22125
  id: id || 0,
22100
22126
  groupId: groupId || '',
22101
22127
  stats: stats,