hls.js 1.6.0-beta.1.0.canary.10770 → 1.6.0-beta.1.0.canary.10773

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.js CHANGED
@@ -1057,7 +1057,7 @@
1057
1057
  // Some browsers don't allow to use bind on console object anyway
1058
1058
  // fallback to default if needed
1059
1059
  try {
1060
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10770");
1060
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10773");
1061
1061
  } catch (e) {
1062
1062
  /* log fn threw an exception. All logger methods are no-ops. */
1063
1063
  return createLogger();
@@ -7883,7 +7883,7 @@
7883
7883
  break;
7884
7884
  }
7885
7885
  case 'DISCONTINUITY-SEQUENCE':
7886
- discontinuityCounter = parseInt(value1);
7886
+ level.startCC = discontinuityCounter = parseInt(value1);
7887
7887
  break;
7888
7888
  case 'KEY':
7889
7889
  {
@@ -8013,7 +8013,7 @@
8013
8013
  if (!level.live) {
8014
8014
  lastFragment.endList = true;
8015
8015
  }
8016
- if (firstFragment) {
8016
+ if (firstFragment && !level.startCC) {
8017
8017
  level.startCC = firstFragment.cc;
8018
8018
  }
8019
8019
  /**
@@ -8356,7 +8356,9 @@
8356
8356
  newDetails.fragments.shift();
8357
8357
  }
8358
8358
  newDetails.startSN = newDetails.fragments[0].sn;
8359
- newDetails.startCC = newDetails.fragments[0].cc;
8359
+ if (!newDetails.startCC) {
8360
+ newDetails.startCC = newDetails.fragments[0].cc;
8361
+ }
8360
8362
  } else {
8361
8363
  if (newDetails.canSkipDateRanges) {
8362
8364
  newDetails.dateRanges = mergeDateRanges(oldDetails.dateRanges, newDetails);
@@ -8625,11 +8627,10 @@
8625
8627
  * The PTS of a fragment lets Hls.js know where it fits into a stream - by knowing every PTS, we know which fragment to
8626
8628
  * download at any given time. PTS is normally computed when the fragment is demuxed, so taking this step saves us time
8627
8629
  * and an extra download.
8628
- * @param lastFrag
8629
8630
  * @param lastLevel
8630
8631
  * @param details
8631
8632
  */
8632
- function alignStream(lastFrag, switchDetails, details) {
8633
+ function alignStream(switchDetails, details) {
8633
8634
  if (!switchDetails) {
8634
8635
  return;
8635
8636
  }
@@ -9824,10 +9825,9 @@
9824
9825
  var firstLevelLoad = !previousDetails;
9825
9826
  var aligned = details.alignedSliding && isFiniteNumber(slidingStart);
9826
9827
  if (firstLevelLoad || !aligned && !slidingStart) {
9827
- var fragPrevious = this.fragPrevious;
9828
- alignStream(fragPrevious, switchDetails, details);
9828
+ alignStream(switchDetails, details);
9829
9829
  var alignedSlidingStart = details.fragmentStart;
9830
- this.log("Live playlist sliding: " + alignedSlidingStart.toFixed(2) + " start-sn: " + (previousDetails ? previousDetails.startSN : 'na') + "->" + details.startSN + " prev-sn: " + (fragPrevious ? fragPrevious.sn : 'na') + " fragments: " + length);
9830
+ this.log("Live playlist sliding: " + alignedSlidingStart.toFixed(2) + " start-sn: " + (previousDetails ? previousDetails.startSN : 'na') + "->" + details.startSN + " fragments: " + length);
9831
9831
  return alignedSlidingStart;
9832
9832
  }
9833
9833
  return slidingStart;
@@ -16253,7 +16253,7 @@
16253
16253
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16254
16254
  }
16255
16255
 
16256
- var version = "1.6.0-beta.1.0.canary.10770";
16256
+ var version = "1.6.0-beta.1.0.canary.10773";
16257
16257
 
16258
16258
  // ensure the worker ends up in the bundle
16259
16259
  // If the worker should not be included this gets aliased to empty.js
@@ -16834,7 +16834,7 @@
16834
16834
  this.nextLoadPosition = this.findSyncFrag(videoAnchor).start;
16835
16835
  this.clearWaitingFragment();
16836
16836
  }
16837
- } else if (this.state !== State.STOPPED) {
16837
+ } else {
16838
16838
  this.state = State.IDLE;
16839
16839
  }
16840
16840
  }
@@ -17017,20 +17017,24 @@
17017
17017
  };
17018
17018
  _proto.onLevelLoaded = function onLevelLoaded(event, data) {
17019
17019
  this.mainDetails = data.details;
17020
- if (this.cachedTrackLoadedData !== null) {
17021
- this.hls.trigger(Events.AUDIO_TRACK_LOADED, this.cachedTrackLoadedData);
17020
+ var cachedTrackLoadedData = this.cachedTrackLoadedData;
17021
+ if (cachedTrackLoadedData) {
17022
17022
  this.cachedTrackLoadedData = null;
17023
+ this.hls.trigger(Events.AUDIO_TRACK_LOADED, cachedTrackLoadedData);
17023
17024
  }
17024
17025
  };
17025
17026
  _proto.onAudioTrackLoaded = function onAudioTrackLoaded(event, data) {
17026
17027
  var _track$details;
17027
- if (this.mainDetails == null) {
17028
- this.cachedTrackLoadedData = data;
17029
- return;
17030
- }
17031
17028
  var levels = this.levels;
17032
17029
  var newDetails = data.details,
17033
17030
  trackId = data.id;
17031
+ if (this.mainDetails == null || this.mainDetails.expired || newDetails.endCC > this.mainDetails.endCC) {
17032
+ this.cachedTrackLoadedData = data;
17033
+ if (this.state !== State.STOPPED) {
17034
+ this.state = State.WAITING_TRACK;
17035
+ }
17036
+ return;
17037
+ }
17034
17038
  if (!levels) {
17035
17039
  this.warn("Audio tracks were reset while loading level " + trackId);
17036
17040
  return;
@@ -17044,15 +17048,19 @@
17044
17048
  if (newDetails.deltaUpdateFailed || !mainDetails) {
17045
17049
  return;
17046
17050
  }
17047
- if (!track.details && newDetails.hasProgramDateTime && mainDetails.hasProgramDateTime) {
17048
- // Make sure our audio rendition is aligned with the "main" rendition, using
17049
- // pdt as our reference times.
17050
- alignMediaPlaylistByPDT(newDetails, mainDetails);
17051
- sliding = newDetails.fragmentStart;
17052
- } else {
17051
+ if (track.details) {
17053
17052
  var _this$levelLastLoaded;
17054
17053
  sliding = this.alignPlaylists(newDetails, track.details, (_this$levelLastLoaded = this.levelLastLoaded) == null ? void 0 : _this$levelLastLoaded.details);
17055
17054
  }
17055
+ if (!newDetails.alignedSliding) {
17056
+ // Align audio rendition with the "main" playlist on discontinuity change
17057
+ // or program-date-time (PDT)
17058
+ alignDiscontinuities(newDetails, mainDetails);
17059
+ if (!newDetails.alignedSliding) {
17060
+ alignMediaPlaylistByPDT(newDetails, mainDetails);
17061
+ }
17062
+ sliding = newDetails.fragmentStart;
17063
+ }
17056
17064
  }
17057
17065
  track.details = newDetails;
17058
17066
  this.levelLastLoaded = track;
@@ -17126,7 +17134,9 @@
17126
17134
  },
17127
17135
  cache = _this$waitingData.cache;
17128
17136
  cache.push(new Uint8Array(payload));
17129
- this.state = State.WAITING_INIT_PTS;
17137
+ if (this.state !== State.STOPPED) {
17138
+ this.state = State.WAITING_INIT_PTS;
17139
+ }
17130
17140
  }
17131
17141
  };
17132
17142
  _proto._handleFragmentLoadComplete = function _handleFragmentLoadComplete(fragLoadedData) {