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.
@@ -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.10764"}`);
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();
@@ -18608,7 +18608,7 @@ class LevelController extends BasePlaylistController {
18608
18608
  level,
18609
18609
  details
18610
18610
  } = data;
18611
- const curLevel = this._levels[level];
18611
+ const curLevel = data.levelInfo;
18612
18612
  if (!curLevel) {
18613
18613
  var _data$deliveryDirecti;
18614
18614
  this.warn(`Invalid level index ${level}`);
@@ -18619,7 +18619,7 @@ class LevelController extends BasePlaylistController {
18619
18619
  }
18620
18620
 
18621
18621
  // only process level loaded events matching with expected level
18622
- if (level === this.currentLevelIndex) {
18622
+ if (curLevel === this.currentLevel) {
18623
18623
  // reset level load error counter on successful level loaded only if there is no issues with fragments
18624
18624
  if (curLevel.fragmentError === 0) {
18625
18625
  curLevel.loadError = 0;
@@ -18657,6 +18657,7 @@ class LevelController extends BasePlaylistController {
18657
18657
  this.hls.trigger(Events.LEVEL_LOADING, {
18658
18658
  url,
18659
18659
  level: currentLevelIndex,
18660
+ levelInfo: currentLevel,
18660
18661
  pathwayId: currentLevel.attrs['PATHWAY-ID'],
18661
18662
  id: 0,
18662
18663
  // Deprecated Level urlId
@@ -19081,7 +19082,7 @@ class GapController extends Logger {
19081
19082
  }
19082
19083
  }
19083
19084
 
19084
- const version = "1.6.0-beta.1.0.canary.10764";
19085
+ const version = "1.6.0-beta.1.0.canary.10765";
19085
19086
 
19086
19087
  // ensure the worker ends up in the bundle
19087
19088
  // If the worker should not be included this gets aliased to empty.js
@@ -19972,7 +19973,7 @@ class StreamController extends BaseStreamController {
19972
19973
  if (!levels || this.state !== State.IDLE) {
19973
19974
  return;
19974
19975
  }
19975
- const level = levels[data.level];
19976
+ const level = data.levelInfo;
19976
19977
  if (!level.details || level.details.live && this.levelLastLoaded !== level || this.waitForCdnTuneIn(level.details)) {
19977
19978
  this.state = State.WAITING_LEVEL;
19978
19979
  }
@@ -19991,7 +19992,7 @@ class StreamController extends BaseStreamController {
19991
19992
  return;
19992
19993
  }
19993
19994
  this.log(`Level ${newLevelId} loaded [${newDetails.startSN},${newDetails.endSN}]${newDetails.lastPartSn ? `[part-${newDetails.lastPartSn}-${newDetails.lastPartIndex}]` : ''}, cc [${newDetails.startCC}, ${newDetails.endCC}] duration:${duration}`);
19994
- const curLevel = levels[newLevelId];
19995
+ const curLevel = data.levelInfo;
19995
19996
  const fragCurrent = this.fragCurrent;
19996
19997
  if (fragCurrent && (this.state === State.FRAG_LOADING || this.state === State.FRAG_LOADING_WAITING_RETRY)) {
19997
19998
  if (fragCurrent.level !== data.level && fragCurrent.loader) {
@@ -21064,6 +21065,7 @@ class PlaylistLoader {
21064
21065
  hls.on(Events.LEVEL_LOADING, this.onLevelLoading, this);
21065
21066
  hls.on(Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this);
21066
21067
  hls.on(Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this);
21068
+ hls.on(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);
21067
21069
  }
21068
21070
  unregisterListeners() {
21069
21071
  const {
@@ -21073,6 +21075,7 @@ class PlaylistLoader {
21073
21075
  hls.off(Events.LEVEL_LOADING, this.onLevelLoading, this);
21074
21076
  hls.off(Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this);
21075
21077
  hls.off(Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this);
21078
+ hls.off(Events.LEVELS_UPDATED, this.onLevelsUpdated, this);
21076
21079
  }
21077
21080
 
21078
21081
  /**
@@ -21124,7 +21127,8 @@ class PlaylistLoader {
21124
21127
  responseType: 'text',
21125
21128
  type: PlaylistContextType.MANIFEST,
21126
21129
  url,
21127
- deliveryDirectives: null
21130
+ deliveryDirectives: null,
21131
+ levelOrTrack: null
21128
21132
  });
21129
21133
  }
21130
21134
  onLevelLoading(event, data) {
@@ -21133,7 +21137,8 @@ class PlaylistLoader {
21133
21137
  level,
21134
21138
  pathwayId,
21135
21139
  url,
21136
- deliveryDirectives
21140
+ deliveryDirectives,
21141
+ levelInfo
21137
21142
  } = data;
21138
21143
  this.load({
21139
21144
  id,
@@ -21142,7 +21147,8 @@ class PlaylistLoader {
21142
21147
  responseType: 'text',
21143
21148
  type: PlaylistContextType.LEVEL,
21144
21149
  url,
21145
- deliveryDirectives
21150
+ deliveryDirectives,
21151
+ levelOrTrack: levelInfo
21146
21152
  });
21147
21153
  }
21148
21154
  onAudioTrackLoading(event, data) {
@@ -21150,7 +21156,8 @@ class PlaylistLoader {
21150
21156
  id,
21151
21157
  groupId,
21152
21158
  url,
21153
- deliveryDirectives
21159
+ deliveryDirectives,
21160
+ track
21154
21161
  } = data;
21155
21162
  this.load({
21156
21163
  id,
@@ -21159,7 +21166,8 @@ class PlaylistLoader {
21159
21166
  responseType: 'text',
21160
21167
  type: PlaylistContextType.AUDIO_TRACK,
21161
21168
  url,
21162
- deliveryDirectives
21169
+ deliveryDirectives,
21170
+ levelOrTrack: track
21163
21171
  });
21164
21172
  }
21165
21173
  onSubtitleTrackLoading(event, data) {
@@ -21167,7 +21175,8 @@ class PlaylistLoader {
21167
21175
  id,
21168
21176
  groupId,
21169
21177
  url,
21170
- deliveryDirectives
21178
+ deliveryDirectives,
21179
+ track
21171
21180
  } = data;
21172
21181
  this.load({
21173
21182
  id,
@@ -21176,9 +21185,21 @@ class PlaylistLoader {
21176
21185
  responseType: 'text',
21177
21186
  type: PlaylistContextType.SUBTITLE_TRACK,
21178
21187
  url,
21179
- deliveryDirectives
21188
+ deliveryDirectives,
21189
+ levelOrTrack: track
21180
21190
  });
21181
21191
  }
21192
+ onLevelsUpdated(event, data) {
21193
+ // abort and delete loader of removed levels
21194
+ const loader = this.loaders[PlaylistContextType.LEVEL];
21195
+ if (loader) {
21196
+ const context = loader.context;
21197
+ if (context && !data.levels.some(lvl => lvl === context.levelOrTrack)) {
21198
+ loader.abort();
21199
+ delete this.loaders[PlaylistContextType.LEVEL];
21200
+ }
21201
+ }
21202
+ }
21182
21203
  load(context) {
21183
21204
  var _context$deliveryDire;
21184
21205
  const config = this.hls.config;
@@ -21189,7 +21210,7 @@ class PlaylistLoader {
21189
21210
  let loader = this.getInternalLoader(context);
21190
21211
  if (loader) {
21191
21212
  const loaderContext = loader.context;
21192
- if (loaderContext && loaderContext.url === context.url && loaderContext.level === context.level) {
21213
+ if (loaderContext && loaderContext.url === context.url && loaderContext.levelOrTrack === context.levelOrTrack) {
21193
21214
  // same URL can't overlap
21194
21215
  this.hls.logger.trace('[playlist-loader]: playlist request ongoing');
21195
21216
  return;
@@ -21511,6 +21532,7 @@ class PlaylistLoader {
21511
21532
  case PlaylistContextType.LEVEL:
21512
21533
  hls.trigger(Events.LEVEL_LOADED, {
21513
21534
  details: levelDetails,
21535
+ levelInfo: context.levelOrTrack || hls.levels[0],
21514
21536
  level: levelIndex || 0,
21515
21537
  id: id || 0,
21516
21538
  stats,
@@ -21521,6 +21543,7 @@ class PlaylistLoader {
21521
21543
  case PlaylistContextType.AUDIO_TRACK:
21522
21544
  hls.trigger(Events.AUDIO_TRACK_LOADED, {
21523
21545
  details: levelDetails,
21546
+ track: context.levelOrTrack,
21524
21547
  id: id || 0,
21525
21548
  groupId: groupId || '',
21526
21549
  stats,
@@ -21531,6 +21554,7 @@ class PlaylistLoader {
21531
21554
  case PlaylistContextType.SUBTITLE_TRACK:
21532
21555
  hls.trigger(Events.SUBTITLE_TRACK_LOADED, {
21533
21556
  details: levelDetails,
21557
+ track: context.levelOrTrack,
21534
21558
  id: id || 0,
21535
21559
  groupId: groupId || '',
21536
21560
  stats,