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

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.10785"}`);
403
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.1.0.canary.10787"}`);
404
404
  } catch (e) {
405
405
  /* log fn threw an exception. All logger methods are no-ops. */
406
406
  return createLogger();
@@ -9806,7 +9806,7 @@ var eventemitter3 = {exports: {}};
9806
9806
  var eventemitter3Exports = eventemitter3.exports;
9807
9807
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
9808
9808
 
9809
- const version = "1.6.0-beta.1.0.canary.10785";
9809
+ const version = "1.6.0-beta.1.0.canary.10787";
9810
9810
 
9811
9811
  // ensure the worker ends up in the bundle
9812
9812
  // If the worker should not be included this gets aliased to empty.js
@@ -16065,8 +16065,9 @@ const TICK_INTERVAL$2 = 100; // how often to tick in ms
16065
16065
  class AudioStreamController extends BaseStreamController {
16066
16066
  constructor(hls, fragmentTracker, keyLoader) {
16067
16067
  super(hls, fragmentTracker, keyLoader, 'audio-stream-controller', PlaylistLevelType.AUDIO);
16068
- this.videoAnchor = null;
16068
+ this.mainAnchor = null;
16069
16069
  this.mainFragLoading = null;
16070
+ this.audioOnly = false;
16070
16071
  this.bufferedTrack = null;
16071
16072
  this.switchingTrack = null;
16072
16073
  this.trackId = -1;
@@ -16080,9 +16081,10 @@ class AudioStreamController extends BaseStreamController {
16080
16081
  onHandlerDestroying() {
16081
16082
  this.unregisterListeners();
16082
16083
  super.onHandlerDestroying();
16083
- this.mainDetails = null;
16084
- this.bufferedTrack = null;
16085
- this.switchingTrack = null;
16084
+ this.resetItem();
16085
+ }
16086
+ resetItem() {
16087
+ this.mainDetails = this.mainAnchor = this.mainFragLoading = this.bufferedTrack = this.switchingTrack = this.waitingData = this.cachedTrackLoadedData = null;
16086
16088
  }
16087
16089
  registerListeners() {
16088
16090
  super.registerListeners();
@@ -16139,7 +16141,7 @@ class AudioStreamController extends BaseStreamController {
16139
16141
  timescale
16140
16142
  };
16141
16143
  this.log(`InitPTS for cc: ${cc} found from main: ${initPTS}/${timescale}`);
16142
- this.videoAnchor = frag;
16144
+ this.mainAnchor = frag;
16143
16145
  // If we are waiting, tick immediately to unblock audio fragment transmuxing
16144
16146
  if (this.state === State.WAITING_INIT_PTS) {
16145
16147
  const waitingData = this.waitingData;
@@ -16230,7 +16232,7 @@ class AudioStreamController extends BaseStreamController {
16230
16232
  cache,
16231
16233
  complete
16232
16234
  } = waitingData;
16233
- const videoAnchor = this.videoAnchor;
16235
+ const mainAnchor = this.mainAnchor;
16234
16236
  if (this.initPTS[frag.cc] !== undefined) {
16235
16237
  this.waitingData = null;
16236
16238
  this.state = State.FRAG_LOADING;
@@ -16245,10 +16247,10 @@ class AudioStreamController extends BaseStreamController {
16245
16247
  if (complete) {
16246
16248
  super._handleFragmentLoadComplete(data);
16247
16249
  }
16248
- } else if (videoAnchor && videoAnchor.cc !== waitingData.frag.cc) {
16250
+ } else if (mainAnchor && mainAnchor.cc !== waitingData.frag.cc) {
16249
16251
  // Drop waiting fragment if videoTrackCC has changed since waitingFragment was set and initPTS was not found
16250
- this.log(`Waiting fragment cc (${frag.cc}) cancelled because video is at cc ${videoAnchor.cc}`);
16251
- this.nextLoadPosition = this.findSyncFrag(videoAnchor).start;
16252
+ this.log(`Waiting fragment cc (${frag.cc}) cancelled because video is at cc ${mainAnchor.cc}`);
16253
+ this.nextLoadPosition = this.findSyncFrag(mainAnchor).start;
16252
16254
  this.clearWaitingFragment();
16253
16255
  }
16254
16256
  } else {
@@ -16370,7 +16372,7 @@ class AudioStreamController extends BaseStreamController {
16370
16372
 
16371
16373
  // Request audio segments up to one fragment ahead of main stream-controller
16372
16374
  const mainFragLoading = (_this$mainFragLoading = this.mainFragLoading) == null ? void 0 : _this$mainFragLoading.frag;
16373
- if (this.startFragRequested && mainFragLoading && isMediaFragment(mainFragLoading) && isMediaFragment(frag) && !frag.endList && (!trackDetails.live || !this.loadingParts && targetBufferTime < this.hls.liveSyncPosition)) {
16375
+ if (!this.audioOnly && this.startFragRequested && mainFragLoading && isMediaFragment(mainFragLoading) && isMediaFragment(frag) && !frag.endList && (!trackDetails.live || !this.loadingParts && targetBufferTime < this.hls.liveSyncPosition)) {
16374
16376
  let mainFrag = mainFragLoading;
16375
16377
  if (frag.start > mainFrag.end) {
16376
16378
  // Get buffered frag at target position from tracker (loaded out of sequence)
@@ -16435,8 +16437,8 @@ class AudioStreamController extends BaseStreamController {
16435
16437
  }
16436
16438
  onManifestLoading() {
16437
16439
  super.onManifestLoading();
16438
- this.bufferFlushed = this.flushing = false;
16439
- this.mainDetails = this.waitingData = this.videoAnchor = this.bufferedTrack = this.cachedTrackLoadedData = this.switchingTrack = null;
16440
+ this.bufferFlushed = this.flushing = this.audioOnly = false;
16441
+ this.resetItem();
16440
16442
  this.trackId = -1;
16441
16443
  }
16442
16444
  onLevelLoaded(event, data) {
@@ -16456,7 +16458,8 @@ class AudioStreamController extends BaseStreamController {
16456
16458
  details: newDetails,
16457
16459
  id: trackId
16458
16460
  } = data;
16459
- if (this.mainDetails == null || this.mainDetails.expired || newDetails.endCC > this.mainDetails.endCC) {
16461
+ const mainDetails = this.mainDetails;
16462
+ if (!mainDetails || mainDetails.expired || newDetails.endCC > mainDetails.endCC) {
16460
16463
  this.cachedTrackLoadedData = data;
16461
16464
  if (this.state !== State.STOPPED) {
16462
16465
  this.state = State.WAITING_TRACK;
@@ -16472,8 +16475,7 @@ class AudioStreamController extends BaseStreamController {
16472
16475
  let sliding = 0;
16473
16476
  if (newDetails.live || (_track$details = track.details) != null && _track$details.live) {
16474
16477
  this.checkLiveUpdate(newDetails);
16475
- const mainDetails = this.mainDetails;
16476
- if (newDetails.deltaUpdateFailed || !mainDetails) {
16478
+ if (newDetails.deltaUpdateFailed) {
16477
16479
  return;
16478
16480
  }
16479
16481
  if (track.details) {
@@ -16494,8 +16496,8 @@ class AudioStreamController extends BaseStreamController {
16494
16496
  this.levelLastLoaded = track;
16495
16497
 
16496
16498
  // compute start position if we are aligned with the main playlist
16497
- if (!this.startFragRequested && (this.mainDetails || !newDetails.live)) {
16498
- this.setStartPosition(this.mainDetails || newDetails, sliding);
16499
+ if (!this.startFragRequested) {
16500
+ this.setStartPosition(mainDetails, sliding);
16499
16501
  }
16500
16502
  this.hls.trigger(Events.AUDIO_TRACK_UPDATED, {
16501
16503
  details: newDetails,
@@ -16592,7 +16594,7 @@ class AudioStreamController extends BaseStreamController {
16592
16594
  }
16593
16595
  }
16594
16596
  onFragLoading(event, data) {
16595
- if (data.frag.type === PlaylistLevelType.MAIN && isMediaFragment(data.frag)) {
16597
+ if (!this.audioOnly && data.frag.type === PlaylistLevelType.MAIN && isMediaFragment(data.frag)) {
16596
16598
  this.mainFragLoading = data;
16597
16599
  if (this.state === State.IDLE) {
16598
16600
  this.tick();
@@ -16605,6 +16607,10 @@ class AudioStreamController extends BaseStreamController {
16605
16607
  part
16606
16608
  } = data;
16607
16609
  if (frag.type !== PlaylistLevelType.AUDIO) {
16610
+ if (!this.audioOnly && frag.type === PlaylistLevelType.MAIN && !frag.elementaryStreams.video && !frag.elementaryStreams.audiovideo) {
16611
+ this.audioOnly = true;
16612
+ this.mainFragLoading = null;
16613
+ }
16608
16614
  return;
16609
16615
  }
16610
16616
  if (this.fragContextChanged(frag)) {