hls.js 1.6.0-beta.1.0.canary.10786 → 1.6.0-beta.1.0.canary.10788

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.d.mts CHANGED
@@ -127,8 +127,9 @@ export declare type AudioSelectionOption = {
127
127
  };
128
128
 
129
129
  export declare class AudioStreamController extends BaseStreamController implements NetworkComponentAPI {
130
- private videoAnchor;
130
+ private mainAnchor;
131
131
  private mainFragLoading;
132
+ private audioOnly;
132
133
  private bufferedTrack;
133
134
  private switchingTrack;
134
135
  private trackId;
@@ -139,6 +140,7 @@ export declare class AudioStreamController extends BaseStreamController implemen
139
140
  private cachedTrackLoadedData;
140
141
  constructor(hls: Hls, fragmentTracker: FragmentTracker, keyLoader: KeyLoader);
141
142
  protected onHandlerDestroying(): void;
143
+ private resetItem;
142
144
  protected registerListeners(): void;
143
145
  protected unregisterListeners(): void;
144
146
  onInitPtsFound(event: Events.INIT_PTS_FOUND, { frag, id, initPTS, timescale }: InitPTSFoundData): void;
package/dist/hls.d.ts CHANGED
@@ -127,8 +127,9 @@ export declare type AudioSelectionOption = {
127
127
  };
128
128
 
129
129
  export declare class AudioStreamController extends BaseStreamController implements NetworkComponentAPI {
130
- private videoAnchor;
130
+ private mainAnchor;
131
131
  private mainFragLoading;
132
+ private audioOnly;
132
133
  private bufferedTrack;
133
134
  private switchingTrack;
134
135
  private trackId;
@@ -139,6 +140,7 @@ export declare class AudioStreamController extends BaseStreamController implemen
139
140
  private cachedTrackLoadedData;
140
141
  constructor(hls: Hls, fragmentTracker: FragmentTracker, keyLoader: KeyLoader);
141
142
  protected onHandlerDestroying(): void;
143
+ private resetItem;
142
144
  protected registerListeners(): void;
143
145
  protected unregisterListeners(): void;
144
146
  onInitPtsFound(event: Events.INIT_PTS_FOUND, { frag, id, initPTS, timescale }: InitPTSFoundData): void;
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.10786");
1060
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10788");
1061
1061
  } catch (e) {
1062
1062
  /* log fn threw an exception. All logger methods are no-ops. */
1063
1063
  return createLogger();
@@ -8497,12 +8497,14 @@
8497
8497
  var sliding = 0;
8498
8498
  if (advancedOrStable && delta < oldFragments.length) {
8499
8499
  sliding = oldFragments[delta].start;
8500
+ } else if (advancedOrStable && newDetails.startSN === oldDetails.endSN + 1) {
8501
+ sliding = oldDetails.fragmentEnd;
8500
8502
  } else if (advancedOrStable && matchingStableVariantOrRendition) {
8501
- // align new start with old end (updated playlist start sequence is past end sequence of last update)
8502
- sliding = oldDetails.edge;
8503
- } else if (!newDetails.skippedSegments && newDetails.fragments[0].start === 0) {
8503
+ // align with expected position (updated playlist start sequence is past end sequence of last update)
8504
+ sliding = oldDetails.fragmentStart + delta * newDetails.levelTargetDuration;
8505
+ } else if (!newDetails.skippedSegments && newDetails.fragmentStart === 0) {
8504
8506
  // align new start with old (playlist switch has a sequence with no overlap and should not be used for alignment)
8505
- sliding = oldDetails.fragments[0].start;
8507
+ sliding = oldDetails.fragmentStart;
8506
8508
  } else {
8507
8509
  // new details already has a sliding offset or has skipped segments
8508
8510
  return;
@@ -16258,7 +16260,7 @@
16258
16260
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16259
16261
  }
16260
16262
 
16261
- var version = "1.6.0-beta.1.0.canary.10786";
16263
+ var version = "1.6.0-beta.1.0.canary.10788";
16262
16264
 
16263
16265
  // ensure the worker ends up in the bundle
16264
16266
  // If the worker should not be included this gets aliased to empty.js
@@ -16660,8 +16662,9 @@
16660
16662
  function AudioStreamController(hls, fragmentTracker, keyLoader) {
16661
16663
  var _this;
16662
16664
  _this = _BaseStreamController.call(this, hls, fragmentTracker, keyLoader, 'audio-stream-controller', PlaylistLevelType.AUDIO) || this;
16663
- _this.videoAnchor = null;
16665
+ _this.mainAnchor = null;
16664
16666
  _this.mainFragLoading = null;
16667
+ _this.audioOnly = false;
16665
16668
  _this.bufferedTrack = null;
16666
16669
  _this.switchingTrack = null;
16667
16670
  _this.trackId = -1;
@@ -16678,9 +16681,10 @@
16678
16681
  _proto.onHandlerDestroying = function onHandlerDestroying() {
16679
16682
  this.unregisterListeners();
16680
16683
  _BaseStreamController.prototype.onHandlerDestroying.call(this);
16681
- this.mainDetails = null;
16682
- this.bufferedTrack = null;
16683
- this.switchingTrack = null;
16684
+ this.resetItem();
16685
+ };
16686
+ _proto.resetItem = function resetItem() {
16687
+ this.mainDetails = this.mainAnchor = this.mainFragLoading = this.bufferedTrack = this.switchingTrack = this.waitingData = this.cachedTrackLoadedData = null;
16684
16688
  };
16685
16689
  _proto.registerListeners = function registerListeners() {
16686
16690
  _BaseStreamController.prototype.registerListeners.call(this);
@@ -16733,7 +16737,7 @@
16733
16737
  timescale: timescale
16734
16738
  };
16735
16739
  this.log("InitPTS for cc: " + cc + " found from main: " + initPTS + "/" + timescale);
16736
- this.videoAnchor = frag;
16740
+ this.mainAnchor = frag;
16737
16741
  // If we are waiting, tick immediately to unblock audio fragment transmuxing
16738
16742
  if (this.state === State.WAITING_INIT_PTS) {
16739
16743
  var waitingData = this.waitingData;
@@ -16818,7 +16822,7 @@
16818
16822
  part = waitingData.part,
16819
16823
  cache = waitingData.cache,
16820
16824
  complete = waitingData.complete;
16821
- var videoAnchor = this.videoAnchor;
16825
+ var mainAnchor = this.mainAnchor;
16822
16826
  if (this.initPTS[frag.cc] !== undefined) {
16823
16827
  this.waitingData = null;
16824
16828
  this.state = State.FRAG_LOADING;
@@ -16833,10 +16837,10 @@
16833
16837
  if (complete) {
16834
16838
  _BaseStreamController.prototype._handleFragmentLoadComplete.call(this, data);
16835
16839
  }
16836
- } else if (videoAnchor && videoAnchor.cc !== waitingData.frag.cc) {
16840
+ } else if (mainAnchor && mainAnchor.cc !== waitingData.frag.cc) {
16837
16841
  // Drop waiting fragment if videoTrackCC has changed since waitingFragment was set and initPTS was not found
16838
- this.log("Waiting fragment cc (" + frag.cc + ") cancelled because video is at cc " + videoAnchor.cc);
16839
- this.nextLoadPosition = this.findSyncFrag(videoAnchor).start;
16842
+ this.log("Waiting fragment cc (" + frag.cc + ") cancelled because video is at cc " + mainAnchor.cc);
16843
+ this.nextLoadPosition = this.findSyncFrag(mainAnchor).start;
16840
16844
  this.clearWaitingFragment();
16841
16845
  }
16842
16846
  } else {
@@ -16952,7 +16956,7 @@
16952
16956
 
16953
16957
  // Request audio segments up to one fragment ahead of main stream-controller
16954
16958
  var mainFragLoading = (_this$mainFragLoading = this.mainFragLoading) == null ? void 0 : _this$mainFragLoading.frag;
16955
- if (this.startFragRequested && mainFragLoading && isMediaFragment(mainFragLoading) && isMediaFragment(frag) && !frag.endList && (!trackDetails.live || !this.loadingParts && targetBufferTime < this.hls.liveSyncPosition)) {
16959
+ if (!this.audioOnly && this.startFragRequested && mainFragLoading && isMediaFragment(mainFragLoading) && isMediaFragment(frag) && !frag.endList && (!trackDetails.live || !this.loadingParts && targetBufferTime < this.hls.liveSyncPosition)) {
16956
16960
  var mainFrag = mainFragLoading;
16957
16961
  if (frag.start > mainFrag.end) {
16958
16962
  // Get buffered frag at target position from tracker (loaded out of sequence)
@@ -17016,8 +17020,8 @@
17016
17020
  };
17017
17021
  _proto.onManifestLoading = function onManifestLoading() {
17018
17022
  _BaseStreamController.prototype.onManifestLoading.call(this);
17019
- this.bufferFlushed = this.flushing = false;
17020
- this.mainDetails = this.waitingData = this.videoAnchor = this.bufferedTrack = this.cachedTrackLoadedData = this.switchingTrack = null;
17023
+ this.bufferFlushed = this.flushing = this.audioOnly = false;
17024
+ this.resetItem();
17021
17025
  this.trackId = -1;
17022
17026
  };
17023
17027
  _proto.onLevelLoaded = function onLevelLoaded(event, data) {
@@ -17033,7 +17037,8 @@
17033
17037
  var levels = this.levels;
17034
17038
  var newDetails = data.details,
17035
17039
  trackId = data.id;
17036
- if (this.mainDetails == null || this.mainDetails.expired || newDetails.endCC > this.mainDetails.endCC) {
17040
+ var mainDetails = this.mainDetails;
17041
+ if (!mainDetails || mainDetails.expired || newDetails.endCC > mainDetails.endCC) {
17037
17042
  this.cachedTrackLoadedData = data;
17038
17043
  if (this.state !== State.STOPPED) {
17039
17044
  this.state = State.WAITING_TRACK;
@@ -17049,8 +17054,7 @@
17049
17054
  var sliding = 0;
17050
17055
  if (newDetails.live || (_track$details = track.details) != null && _track$details.live) {
17051
17056
  this.checkLiveUpdate(newDetails);
17052
- var mainDetails = this.mainDetails;
17053
- if (newDetails.deltaUpdateFailed || !mainDetails) {
17057
+ if (newDetails.deltaUpdateFailed) {
17054
17058
  return;
17055
17059
  }
17056
17060
  if (track.details) {
@@ -17071,8 +17075,8 @@
17071
17075
  this.levelLastLoaded = track;
17072
17076
 
17073
17077
  // compute start position if we are aligned with the main playlist
17074
- if (!this.startFragRequested && (this.mainDetails || !newDetails.live)) {
17075
- this.setStartPosition(this.mainDetails || newDetails, sliding);
17078
+ if (!this.startFragRequested) {
17079
+ this.setStartPosition(mainDetails, sliding);
17076
17080
  }
17077
17081
  this.hls.trigger(Events.AUDIO_TRACK_UPDATED, {
17078
17082
  details: newDetails,
@@ -17164,7 +17168,7 @@
17164
17168
  }
17165
17169
  };
17166
17170
  _proto.onFragLoading = function onFragLoading(event, data) {
17167
- if (data.frag.type === PlaylistLevelType.MAIN && isMediaFragment(data.frag)) {
17171
+ if (!this.audioOnly && data.frag.type === PlaylistLevelType.MAIN && isMediaFragment(data.frag)) {
17168
17172
  this.mainFragLoading = data;
17169
17173
  if (this.state === State.IDLE) {
17170
17174
  this.tick();
@@ -17175,6 +17179,10 @@
17175
17179
  var frag = data.frag,
17176
17180
  part = data.part;
17177
17181
  if (frag.type !== PlaylistLevelType.AUDIO) {
17182
+ if (!this.audioOnly && frag.type === PlaylistLevelType.MAIN && !frag.elementaryStreams.video && !frag.elementaryStreams.audiovideo) {
17183
+ this.audioOnly = true;
17184
+ this.mainFragLoading = null;
17185
+ }
17178
17186
  return;
17179
17187
  }
17180
17188
  if (this.fragContextChanged(frag)) {
package/dist/hls.js.d.ts CHANGED
@@ -127,8 +127,9 @@ export declare type AudioSelectionOption = {
127
127
  };
128
128
 
129
129
  export declare class AudioStreamController extends BaseStreamController implements NetworkComponentAPI {
130
- private videoAnchor;
130
+ private mainAnchor;
131
131
  private mainFragLoading;
132
+ private audioOnly;
132
133
  private bufferedTrack;
133
134
  private switchingTrack;
134
135
  private trackId;
@@ -139,6 +140,7 @@ export declare class AudioStreamController extends BaseStreamController implemen
139
140
  private cachedTrackLoadedData;
140
141
  constructor(hls: Hls, fragmentTracker: FragmentTracker, keyLoader: KeyLoader);
141
142
  protected onHandlerDestroying(): void;
143
+ private resetItem;
142
144
  protected registerListeners(): void;
143
145
  protected unregisterListeners(): void;
144
146
  onInitPtsFound(event: Events.INIT_PTS_FOUND, { frag, id, initPTS, timescale }: InitPTSFoundData): void;