hls.js 1.6.0-beta.1.0.canary.10787 → 1.6.0-beta.1.0.canary.10789

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.10787"}`);
403
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10789"}`);
404
404
  } catch (e) {
405
405
  /* log fn threw an exception. All logger methods are no-ops. */
406
406
  return createLogger();
@@ -6283,6 +6283,7 @@ class LevelDetails {
6283
6283
  this.dateRanges = void 0;
6284
6284
  this.dateRangeTagCount = 0;
6285
6285
  this.live = true;
6286
+ this.requestScheduled = -1;
6286
6287
  this.ageHeader = 0;
6287
6288
  this.advancedDateTime = void 0;
6288
6289
  this.updated = true;
@@ -7678,6 +7679,9 @@ function mergeDetails(oldDetails, newDetails) {
7678
7679
  newDetails.driftEnd = oldDetails.driftEnd;
7679
7680
  newDetails.advancedDateTime = oldDetails.advancedDateTime;
7680
7681
  }
7682
+ if (newDetails.requestScheduled === -1) {
7683
+ newDetails.requestScheduled = oldDetails.requestScheduled;
7684
+ }
7681
7685
  }
7682
7686
  function mergeDateRanges(oldDateRanges, newDetails) {
7683
7687
  const {
@@ -7748,12 +7752,14 @@ function adjustSliding(oldDetails, newDetails, matchingStableVariantOrRendition
7748
7752
  let sliding = 0;
7749
7753
  if (advancedOrStable && delta < oldFragments.length) {
7750
7754
  sliding = oldFragments[delta].start;
7755
+ } else if (advancedOrStable && newDetails.startSN === oldDetails.endSN + 1) {
7756
+ sliding = oldDetails.fragmentEnd;
7751
7757
  } else if (advancedOrStable && matchingStableVariantOrRendition) {
7752
- // align new start with old end (updated playlist start sequence is past end sequence of last update)
7753
- sliding = oldDetails.edge;
7754
- } else if (!newDetails.skippedSegments && newDetails.fragments[0].start === 0) {
7758
+ // align with expected position (updated playlist start sequence is past end sequence of last update)
7759
+ sliding = oldDetails.fragmentStart + delta * newDetails.levelTargetDuration;
7760
+ } else if (!newDetails.skippedSegments && newDetails.fragmentStart === 0) {
7755
7761
  // align new start with old (playlist switch has a sequence with no overlap and should not be used for alignment)
7756
- sliding = oldDetails.fragments[0].start;
7762
+ sliding = oldDetails.fragmentStart;
7757
7763
  } else {
7758
7764
  // new details already has a sliding offset or has skipped segments
7759
7765
  return;
@@ -9147,12 +9153,13 @@ class BaseStreamController extends TaskLoop {
9147
9153
  this.nextLoadPosition = startPosition;
9148
9154
  }
9149
9155
  getLoadPosition() {
9156
+ var _this$hls;
9150
9157
  const {
9151
9158
  media
9152
9159
  } = this;
9153
9160
  // if we have not yet loaded any fragment, start loading from start position
9154
9161
  let pos = 0;
9155
- if (this.hls.hasEnoughToStart && media) {
9162
+ if ((_this$hls = this.hls) != null && _this$hls.hasEnoughToStart && media) {
9156
9163
  pos = media.currentTime;
9157
9164
  } else if (this.nextLoadPosition >= 0) {
9158
9165
  pos = this.nextLoadPosition;
@@ -9806,7 +9813,7 @@ var eventemitter3 = {exports: {}};
9806
9813
  var eventemitter3Exports = eventemitter3.exports;
9807
9814
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9808
9815
 
9809
- const version = "1.6.0-beta.1.0.canary.10787";
9816
+ const version = "1.6.0-beta.1.0.canary.10789";
9810
9817
 
9811
9818
  // ensure the worker ends up in the bundle
9812
9819
  // If the worker should not be included this gets aliased to empty.js
@@ -16876,7 +16883,6 @@ class BasePlaylistController extends Logger {
16876
16883
  super(logPrefix, hls.logger);
16877
16884
  this.hls = void 0;
16878
16885
  this.timer = -1;
16879
- this.requestScheduled = -1;
16880
16886
  this.canLoad = false;
16881
16887
  this.hls = hls;
16882
16888
  }
@@ -16893,7 +16899,6 @@ class BasePlaylistController extends Logger {
16893
16899
  }
16894
16900
  startLoad() {
16895
16901
  this.canLoad = true;
16896
- this.requestScheduled = -1;
16897
16902
  this.loadPlaylist();
16898
16903
  }
16899
16904
  stopLoad() {
@@ -16938,16 +16943,25 @@ class BasePlaylistController extends Logger {
16938
16943
  }
16939
16944
  }
16940
16945
  loadPlaylist(hlsUrlParameters) {
16941
- if (this.requestScheduled === -1) {
16942
- this.requestScheduled = self.performance.now();
16943
- }
16944
16946
  // Loading is handled by the subclasses
16947
+ this.clearTimer();
16948
+ }
16949
+ loadingPlaylist(playlist, hlsUrlParameters) {
16950
+ // Loading is handled by the subclasses
16951
+ this.clearTimer();
16945
16952
  }
16946
16953
  shouldLoadPlaylist(playlist) {
16947
16954
  return this.canLoad && !!playlist && !!playlist.url && (!playlist.details || playlist.details.live);
16948
16955
  }
16949
- shouldReloadPlaylist(playlist) {
16950
- return this.timer === -1 && this.requestScheduled === -1 && this.shouldLoadPlaylist(playlist);
16956
+ getUrlWithDirectives(uri, hlsUrlParameters) {
16957
+ if (hlsUrlParameters) {
16958
+ try {
16959
+ return hlsUrlParameters.addDirectives(uri);
16960
+ } catch (error) {
16961
+ this.warn(`Could not construct new URL with HLS Delivery Directives: ${error}`);
16962
+ }
16963
+ }
16964
+ return uri;
16951
16965
  }
16952
16966
  playlistLoaded(index, data, previousDetails) {
16953
16967
  const {
@@ -16972,10 +16986,9 @@ class BasePlaylistController extends Logger {
16972
16986
 
16973
16987
  // if current playlist is a live playlist, arm a timer to reload it
16974
16988
  if (details.live || previousDetails != null && previousDetails.live) {
16989
+ const levelOrTrack = 'levelInfo' in data ? data.levelInfo : data.track;
16975
16990
  details.reloaded(previousDetails);
16976
- if (previousDetails) {
16977
- this.log(`live playlist ${index} ${details.advanced ? 'REFRESHED ' + details.lastPartSn + '-' + details.lastPartIndex : details.updated ? 'UPDATED' : 'MISSED'}`);
16978
- }
16991
+ this.log(`live playlist ${index} ${details.advanced ? 'REFRESHED ' + details.lastPartSn + '-' + details.lastPartIndex : details.updated ? 'UPDATED' : 'MISSED'}`);
16979
16992
  // Merge live playlists to adjust fragment starts and fill in delta playlist skipped segments
16980
16993
  if (previousDetails && details.fragments.length > 0) {
16981
16994
  mergeDetails(previousDetails, details);
@@ -17031,50 +17044,64 @@ class BasePlaylistController extends Logger {
17031
17044
  }
17032
17045
  deliveryDirectives = this.getDeliveryDirectives(details, data.deliveryDirectives, msn, part);
17033
17046
  if (lowLatencyMode || !lastPart) {
17034
- this.loadPlaylist(deliveryDirectives);
17047
+ this.loadingPlaylist(levelOrTrack, deliveryDirectives);
17035
17048
  return;
17036
17049
  }
17037
17050
  } else if (details.canBlockReload || details.canSkipUntil) {
17038
17051
  deliveryDirectives = this.getDeliveryDirectives(details, data.deliveryDirectives, msn, part);
17039
17052
  }
17053
+ if (details.requestScheduled === -1) {
17054
+ details.requestScheduled = stats.loading.start;
17055
+ }
17056
+ if (deliveryDirectives && msn !== undefined && details.canBlockReload) {
17057
+ details.requestScheduled -= details.partTarget * 1000 || 1000;
17058
+ }
17040
17059
  const bufferInfo = this.hls.mainForwardBufferInfo;
17041
17060
  const position = bufferInfo ? bufferInfo.end - bufferInfo.len : 0;
17042
17061
  const distanceToLiveEdgeMs = (details.edge - position) * 1000;
17043
17062
  const reloadInterval = computeReloadInterval(details, distanceToLiveEdgeMs);
17044
- if (details.updated && now > this.requestScheduled + reloadInterval) {
17045
- this.requestScheduled = stats.loading.start;
17046
- }
17047
- if (msn !== undefined && details.canBlockReload) {
17048
- this.requestScheduled = stats.loading.first + reloadInterval - (details.partTarget * 1000 || 1000);
17049
- } else if (this.requestScheduled === -1 || this.requestScheduled + reloadInterval < now) {
17050
- this.requestScheduled = now;
17051
- } else if (this.requestScheduled - now <= 0) {
17052
- this.requestScheduled += reloadInterval;
17053
- }
17054
- let estimatedTimeUntilUpdate = this.requestScheduled - now;
17055
- estimatedTimeUntilUpdate = Math.max(0, estimatedTimeUntilUpdate);
17056
- this.log(`reload live playlist ${index} in ${Math.round(estimatedTimeUntilUpdate)} ms`);
17057
- // this.log(
17058
- // `live reload ${details.updated ? 'REFRESHED' : 'MISSED'}
17059
- // reload in ${estimatedTimeUntilUpdate / 1000}
17060
- // round trip ${(stats.loading.end - stats.loading.start) / 1000}
17061
- // diff ${
17062
- // (reloadInterval -
17063
- // (estimatedTimeUntilUpdate +
17064
- // stats.loading.end -
17065
- // stats.loading.start)) /
17066
- // 1000
17067
- // }
17068
- // reload interval ${reloadInterval / 1000}
17069
- // target duration ${details.targetduration}
17070
- // distance to edge ${distanceToLiveEdgeMs / 1000}`
17071
- // );
17072
-
17073
- this.timer = self.setTimeout(() => this.loadPlaylist(deliveryDirectives), estimatedTimeUntilUpdate);
17063
+ if (details.requestScheduled + reloadInterval < now) {
17064
+ details.requestScheduled = now;
17065
+ } else {
17066
+ details.requestScheduled += reloadInterval;
17067
+ }
17068
+ this.scheduleLoading(levelOrTrack, deliveryDirectives);
17074
17069
  } else {
17075
17070
  this.clearTimer();
17076
17071
  }
17077
17072
  }
17073
+ scheduleLoading(levelOrTrack, deliveryDirectives) {
17074
+ const details = levelOrTrack.details;
17075
+ if (!details) {
17076
+ this.loadingPlaylist(levelOrTrack, deliveryDirectives);
17077
+ return;
17078
+ }
17079
+ const now = self.performance.now();
17080
+ const requestScheduled = details.requestScheduled;
17081
+ if (now >= requestScheduled) {
17082
+ this.loadingPlaylist(levelOrTrack, deliveryDirectives);
17083
+ return;
17084
+ }
17085
+ const estimatedTimeUntilUpdate = requestScheduled - now;
17086
+ this.log(`reload live playlist ${levelOrTrack.name || levelOrTrack.bitrate + 'bps'} in ${Math.round(estimatedTimeUntilUpdate)} ms`);
17087
+ // this.log(
17088
+ // `live reload ${details.updated ? 'REFRESHED' : 'MISSED'}
17089
+ // reload in ${estimatedTimeUntilUpdate / 1000}
17090
+ // round trip ${(stats.loading.end - stats.loading.start) / 1000}
17091
+ // diff ${
17092
+ // (reloadInterval -
17093
+ // (estimatedTimeUntilUpdate +
17094
+ // stats.loading.end -
17095
+ // stats.loading.start)) /
17096
+ // 1000
17097
+ // }
17098
+ // reload interval ${reloadInterval / 1000}
17099
+ // target duration ${details.targetduration}
17100
+ // distance to edge ${distanceToLiveEdgeMs / 1000}`
17101
+ // );
17102
+
17103
+ this.timer = self.setTimeout(() => this.loadingPlaylist(levelOrTrack, deliveryDirectives), estimatedTimeUntilUpdate);
17104
+ }
17078
17105
  getDeliveryDirectives(details, previousDeliveryDirectives, msn, part) {
17079
17106
  let skip = getSkipValue(details);
17080
17107
  if (previousDeliveryDirectives != null && previousDeliveryDirectives.skip && details.deltaUpdateFailed) {
@@ -17096,7 +17123,6 @@ class BasePlaylistController extends Logger {
17096
17123
  const retry = !!errorAction && !!retryConfig && (action === NetworkErrorAction.RetryRequest || !errorAction.resolved && action === NetworkErrorAction.SendAlternateToPenaltyBox);
17097
17124
  if (retry) {
17098
17125
  var _errorEvent$context;
17099
- this.requestScheduled = -1;
17100
17126
  if (retryCount >= retryConfig.maxNumRetry) {
17101
17127
  return false;
17102
17128
  }
@@ -17259,9 +17285,6 @@ class AudioTrackController extends BasePlaylistController {
17259
17285
  error
17260
17286
  });
17261
17287
  }
17262
- } else if (this.shouldReloadPlaylist(currentTrack)) {
17263
- // Retry playlist loading if no playlist is or has been loaded yet
17264
- this.setAudioTrack(this.trackId);
17265
17288
  }
17266
17289
  }
17267
17290
  onError(event, data) {
@@ -17269,7 +17292,6 @@ class AudioTrackController extends BasePlaylistController {
17269
17292
  return;
17270
17293
  }
17271
17294
  if (data.context.type === PlaylistContextType.AUDIO_TRACK && data.context.id === this.trackId && (!this.groupIds || this.groupIds.indexOf(data.context.groupId) !== -1)) {
17272
- this.requestScheduled = -1;
17273
17295
  this.checkRetry(data);
17274
17296
  }
17275
17297
  }
@@ -17339,9 +17361,6 @@ class AudioTrackController extends BasePlaylistController {
17339
17361
  this.warn(`Invalid audio track id: ${newId}`);
17340
17362
  return;
17341
17363
  }
17342
-
17343
- // stopping live reloading timer if any
17344
- this.clearTimer();
17345
17364
  this.selectDefaultTrack = false;
17346
17365
  const lastTrack = this.currentTrack;
17347
17366
  const track = tracks[newId];
@@ -17410,35 +17429,32 @@ class AudioTrackController extends BasePlaylistController {
17410
17429
  }
17411
17430
  loadPlaylist(hlsUrlParameters) {
17412
17431
  var _this$hls$levels$this;
17432
+ super.loadPlaylist();
17413
17433
  const audioTrack = this.currentTrack;
17414
- if (!audioTrack) {
17434
+ if (!this.shouldLoadPlaylist(audioTrack)) {
17415
17435
  return;
17416
17436
  }
17417
- let url = audioTrack.url;
17418
- if (this.shouldLoadPlaylist(audioTrack) && url !== ((_this$hls$levels$this = this.hls.levels[this.hls.loadLevel]) == null ? void 0 : _this$hls$levels$this.uri)) {
17419
- super.loadPlaylist();
17420
- const id = audioTrack.id;
17421
- const groupId = audioTrack.groupId;
17422
- if (hlsUrlParameters) {
17423
- try {
17424
- url = hlsUrlParameters.addDirectives(url);
17425
- } catch (error) {
17426
- this.warn(`Could not construct new URL with HLS Delivery Directives: ${error}`);
17427
- }
17428
- }
17429
- // track not retrieved yet, or live playlist we need to (re)load it
17430
- const details = audioTrack.details;
17431
- const age = details == null ? void 0 : details.age;
17432
- this.log(`Loading audio-track ${id} "${audioTrack.name}" lang:${audioTrack.lang} group:${groupId}${(hlsUrlParameters == null ? void 0 : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : ''}${age && details.live ? ' age ' + age.toFixed(1) + (details.type ? ' ' + details.type || '' : '') : ''} ${url}`);
17433
- this.clearTimer();
17434
- this.hls.trigger(Events.AUDIO_TRACK_LOADING, {
17435
- url,
17436
- id,
17437
- groupId,
17438
- deliveryDirectives: hlsUrlParameters || null,
17439
- track: audioTrack
17440
- });
17437
+ if (audioTrack.url === ((_this$hls$levels$this = this.hls.levels[this.hls.loadLevel]) == null ? void 0 : _this$hls$levels$this.uri)) {
17438
+ // Do not load audio rendition with URI matching main variant URI
17439
+ return;
17441
17440
  }
17441
+ this.scheduleLoading(audioTrack, hlsUrlParameters);
17442
+ }
17443
+ loadingPlaylist(audioTrack, hlsUrlParameters) {
17444
+ super.loadingPlaylist(audioTrack, hlsUrlParameters);
17445
+ const id = audioTrack.id;
17446
+ const groupId = audioTrack.groupId;
17447
+ const url = this.getUrlWithDirectives(audioTrack.url, hlsUrlParameters);
17448
+ const details = audioTrack.details;
17449
+ const age = details == null ? void 0 : details.age;
17450
+ this.log(`Loading audio-track ${id} "${audioTrack.name}" lang:${audioTrack.lang} group:${groupId}${(hlsUrlParameters == null ? void 0 : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : ''}${age && details.live ? ' age ' + age.toFixed(1) + (details.type ? ' ' + details.type || '' : '') : ''} ${url}`);
17451
+ this.hls.trigger(Events.AUDIO_TRACK_LOADING, {
17452
+ url,
17453
+ id,
17454
+ groupId,
17455
+ deliveryDirectives: hlsUrlParameters || null,
17456
+ track: audioTrack
17457
+ });
17442
17458
  }
17443
17459
  }
17444
17460
 
@@ -22378,9 +22394,6 @@ class SubtitleTrackController extends BasePlaylistController {
22378
22394
  if (trackId !== -1 && this.trackId === -1) {
22379
22395
  this.setSubtitleTrack(trackId);
22380
22396
  }
22381
- } else if (this.shouldReloadPlaylist(currentTrack)) {
22382
- // Retry playlist loading if no playlist is or has been loaded yet
22383
- this.setSubtitleTrack(this.trackId);
22384
22397
  }
22385
22398
  }
22386
22399
  findTrackId(currentTrack) {
@@ -22486,29 +22499,25 @@ class SubtitleTrackController extends BasePlaylistController {
22486
22499
  }
22487
22500
  loadPlaylist(hlsUrlParameters) {
22488
22501
  super.loadPlaylist();
22489
- const currentTrack = this.currentTrack;
22490
- if (this.shouldLoadPlaylist(currentTrack) && currentTrack) {
22491
- const id = currentTrack.id;
22492
- const groupId = currentTrack.groupId;
22493
- let url = currentTrack.url;
22494
- if (hlsUrlParameters) {
22495
- try {
22496
- url = hlsUrlParameters.addDirectives(url);
22497
- } catch (error) {
22498
- this.warn(`Could not construct new URL with HLS Delivery Directives: ${error}`);
22499
- }
22500
- }
22501
- const details = currentTrack.details;
22502
- const age = details == null ? void 0 : details.age;
22503
- this.log(`Loading subtitle ${id} "${currentTrack.name}" lang:${currentTrack.lang} group:${groupId}${(hlsUrlParameters == null ? void 0 : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : ''}${age && details.live ? ' age ' + age.toFixed(1) + (details.type ? ' ' + details.type || '' : '') : ''} ${url}`);
22504
- this.hls.trigger(Events.SUBTITLE_TRACK_LOADING, {
22505
- url,
22506
- id,
22507
- groupId,
22508
- deliveryDirectives: hlsUrlParameters || null,
22509
- track: currentTrack
22510
- });
22511
- }
22502
+ if (this.shouldLoadPlaylist(this.currentTrack)) {
22503
+ this.scheduleLoading(this.currentTrack, hlsUrlParameters);
22504
+ }
22505
+ }
22506
+ loadingPlaylist(currentTrack, hlsUrlParameters) {
22507
+ super.loadingPlaylist(currentTrack, hlsUrlParameters);
22508
+ const id = currentTrack.id;
22509
+ const groupId = currentTrack.groupId;
22510
+ const url = this.getUrlWithDirectives(currentTrack.url, hlsUrlParameters);
22511
+ const details = currentTrack.details;
22512
+ const age = details == null ? void 0 : details.age;
22513
+ this.log(`Loading subtitle ${id} "${currentTrack.name}" lang:${currentTrack.lang} group:${groupId}${(hlsUrlParameters == null ? void 0 : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : ''}${age && details.live ? ' age ' + age.toFixed(1) + (details.type ? ' ' + details.type || '' : '') : ''} ${url}`);
22514
+ this.hls.trigger(Events.SUBTITLE_TRACK_LOADING, {
22515
+ url,
22516
+ id,
22517
+ groupId,
22518
+ deliveryDirectives: hlsUrlParameters || null,
22519
+ track: currentTrack
22520
+ });
22512
22521
  }
22513
22522
 
22514
22523
  /**
@@ -22566,9 +22575,6 @@ class SubtitleTrackController extends BasePlaylistController {
22566
22575
  this.warn(`Invalid subtitle track id: ${newId}`);
22567
22576
  return;
22568
22577
  }
22569
-
22570
- // stopping live reloading timer if any
22571
- this.clearTimer();
22572
22578
  this.selectDefaultTrack = false;
22573
22579
  const lastTrack = this.currentTrack;
22574
22580
  const track = tracks[newId] || null;
@@ -30461,9 +30467,7 @@ class LevelController extends BasePlaylistController {
30461
30467
  this.currentLevelIndex = newLevel;
30462
30468
  this.currentLevel = level;
30463
30469
  if (lastLevelIndex === newLevel && lastLevel && lastPathwayId === pathwayId) {
30464
- if (level.details || this.requestScheduled !== -1) {
30465
- return;
30466
- }
30470
+ return;
30467
30471
  }
30468
30472
  this.log(`Switching to level ${newLevel} (${level.height ? level.height + 'p ' : ''}${level.videoRange ? level.videoRange + ' ' : ''}${level.codecSet ? level.codecSet + ' ' : ''}@${level.bitrate})${pathwayId ? ' with Pathway ' + pathwayId : ''} from level ${lastLevelIndex}${lastPathwayId ? ' with Pathway ' + lastPathwayId : ''}`);
30469
30473
  const levelSwitchingData = {
@@ -30557,10 +30561,7 @@ class LevelController extends BasePlaylistController {
30557
30561
  return;
30558
30562
  }
30559
30563
  if (data.context.type === PlaylistContextType.LEVEL && data.context.level === this.level) {
30560
- const retry = this.checkRetry(data);
30561
- if (!retry) {
30562
- this.requestScheduled = -1;
30563
- }
30564
+ this.checkRetry(data);
30564
30565
  }
30565
30566
  }
30566
30567
 
@@ -30615,36 +30616,28 @@ class LevelController extends BasePlaylistController {
30615
30616
  }
30616
30617
  loadPlaylist(hlsUrlParameters) {
30617
30618
  super.loadPlaylist();
30618
- const currentLevelIndex = this.currentLevelIndex;
30619
- const currentLevel = this.currentLevel;
30620
- if (currentLevel && this.shouldLoadPlaylist(currentLevel)) {
30621
- let url = currentLevel.uri;
30622
- if (hlsUrlParameters) {
30623
- try {
30624
- url = hlsUrlParameters.addDirectives(url);
30625
- } catch (error) {
30626
- this.warn(`Could not construct new URL with HLS Delivery Directives: ${error}`);
30627
- }
30628
- }
30629
- const pathwayId = currentLevel.attrs['PATHWAY-ID'];
30630
- const details = currentLevel.details;
30631
- const age = details == null ? void 0 : details.age;
30632
- this.log(`Loading level index ${currentLevelIndex}${(hlsUrlParameters == null ? void 0 : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : ''}${pathwayId ? ' Pathway ' + pathwayId : ''}${age && details.live ? ' age ' + age.toFixed(1) + (details.type ? ' ' + details.type || '' : '') : ''} ${url}`);
30633
-
30634
- // console.log('Current audio track group ID:', this.hls.audioTracks[this.hls.audioTrack].groupId);
30635
- // console.log('New video quality level audio group id:', levelObject.attrs.AUDIO, level);
30636
- this.clearTimer();
30637
- this.hls.trigger(Events.LEVEL_LOADING, {
30638
- url,
30639
- level: currentLevelIndex,
30640
- levelInfo: currentLevel,
30641
- pathwayId: currentLevel.attrs['PATHWAY-ID'],
30642
- id: 0,
30643
- // Deprecated Level urlId
30644
- deliveryDirectives: hlsUrlParameters || null
30645
- });
30619
+ if (this.shouldLoadPlaylist(this.currentLevel)) {
30620
+ this.scheduleLoading(this.currentLevel, hlsUrlParameters);
30646
30621
  }
30647
30622
  }
30623
+ loadingPlaylist(currentLevel, hlsUrlParameters) {
30624
+ super.loadingPlaylist(currentLevel, hlsUrlParameters);
30625
+ const url = this.getUrlWithDirectives(currentLevel.uri, hlsUrlParameters);
30626
+ const currentLevelIndex = this.currentLevelIndex;
30627
+ const pathwayId = currentLevel.attrs['PATHWAY-ID'];
30628
+ const details = currentLevel.details;
30629
+ const age = details == null ? void 0 : details.age;
30630
+ this.log(`Loading level index ${currentLevelIndex}${(hlsUrlParameters == null ? void 0 : hlsUrlParameters.msn) !== undefined ? ' at sn ' + hlsUrlParameters.msn + ' part ' + hlsUrlParameters.part : ''}${pathwayId ? ' Pathway ' + pathwayId : ''}${age && details.live ? ' age ' + age.toFixed(1) + (details.type ? ' ' + details.type || '' : '') : ''} ${url}`);
30631
+ this.hls.trigger(Events.LEVEL_LOADING, {
30632
+ url,
30633
+ level: currentLevelIndex,
30634
+ levelInfo: currentLevel,
30635
+ pathwayId: currentLevel.attrs['PATHWAY-ID'],
30636
+ id: 0,
30637
+ // Deprecated Level urlId
30638
+ deliveryDirectives: hlsUrlParameters || null
30639
+ });
30640
+ }
30648
30641
  get nextLoadLevel() {
30649
30642
  if (this.manualLevelIndex !== -1) {
30650
30643
  return this.manualLevelIndex;