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/README.md CHANGED
@@ -442,6 +442,7 @@ The following players integrate HLS.js for HLS playback:
442
442
  - [OpenPlayerJS](https://www.openplayerjs.com), as part of the [OpenPlayer project](https://github.com/openplayerjs)
443
443
  - [CDNBye](https://github.com/cdnbye/hlsjs-p2p-engine), a p2p engine for hls.js powered by WebRTC Datachannel.
444
444
  - [M3U IPTV](http://m3u-ip.tv/browser/)
445
+ - [ArtPlayer](https://artplayer.org/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.5.17/hls.min.js&example=hls)
445
446
 
446
447
  ### They use HLS.js in production!
447
448
 
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.10785");
1060
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.1.0.canary.10787");
1061
1061
  } catch (e) {
1062
1062
  /* log fn threw an exception. All logger methods are no-ops. */
1063
1063
  return createLogger();
@@ -16258,7 +16258,7 @@
16258
16258
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16259
16259
  }
16260
16260
 
16261
- var version = "1.6.0-beta.1.0.canary.10785";
16261
+ var version = "1.6.0-beta.1.0.canary.10787";
16262
16262
 
16263
16263
  // ensure the worker ends up in the bundle
16264
16264
  // If the worker should not be included this gets aliased to empty.js
@@ -16660,8 +16660,9 @@
16660
16660
  function AudioStreamController(hls, fragmentTracker, keyLoader) {
16661
16661
  var _this;
16662
16662
  _this = _BaseStreamController.call(this, hls, fragmentTracker, keyLoader, 'audio-stream-controller', PlaylistLevelType.AUDIO) || this;
16663
- _this.videoAnchor = null;
16663
+ _this.mainAnchor = null;
16664
16664
  _this.mainFragLoading = null;
16665
+ _this.audioOnly = false;
16665
16666
  _this.bufferedTrack = null;
16666
16667
  _this.switchingTrack = null;
16667
16668
  _this.trackId = -1;
@@ -16678,9 +16679,10 @@
16678
16679
  _proto.onHandlerDestroying = function onHandlerDestroying() {
16679
16680
  this.unregisterListeners();
16680
16681
  _BaseStreamController.prototype.onHandlerDestroying.call(this);
16681
- this.mainDetails = null;
16682
- this.bufferedTrack = null;
16683
- this.switchingTrack = null;
16682
+ this.resetItem();
16683
+ };
16684
+ _proto.resetItem = function resetItem() {
16685
+ this.mainDetails = this.mainAnchor = this.mainFragLoading = this.bufferedTrack = this.switchingTrack = this.waitingData = this.cachedTrackLoadedData = null;
16684
16686
  };
16685
16687
  _proto.registerListeners = function registerListeners() {
16686
16688
  _BaseStreamController.prototype.registerListeners.call(this);
@@ -16733,7 +16735,7 @@
16733
16735
  timescale: timescale
16734
16736
  };
16735
16737
  this.log("InitPTS for cc: " + cc + " found from main: " + initPTS + "/" + timescale);
16736
- this.videoAnchor = frag;
16738
+ this.mainAnchor = frag;
16737
16739
  // If we are waiting, tick immediately to unblock audio fragment transmuxing
16738
16740
  if (this.state === State.WAITING_INIT_PTS) {
16739
16741
  var waitingData = this.waitingData;
@@ -16818,7 +16820,7 @@
16818
16820
  part = waitingData.part,
16819
16821
  cache = waitingData.cache,
16820
16822
  complete = waitingData.complete;
16821
- var videoAnchor = this.videoAnchor;
16823
+ var mainAnchor = this.mainAnchor;
16822
16824
  if (this.initPTS[frag.cc] !== undefined) {
16823
16825
  this.waitingData = null;
16824
16826
  this.state = State.FRAG_LOADING;
@@ -16833,10 +16835,10 @@
16833
16835
  if (complete) {
16834
16836
  _BaseStreamController.prototype._handleFragmentLoadComplete.call(this, data);
16835
16837
  }
16836
- } else if (videoAnchor && videoAnchor.cc !== waitingData.frag.cc) {
16838
+ } else if (mainAnchor && mainAnchor.cc !== waitingData.frag.cc) {
16837
16839
  // 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;
16840
+ this.log("Waiting fragment cc (" + frag.cc + ") cancelled because video is at cc " + mainAnchor.cc);
16841
+ this.nextLoadPosition = this.findSyncFrag(mainAnchor).start;
16840
16842
  this.clearWaitingFragment();
16841
16843
  }
16842
16844
  } else {
@@ -16952,7 +16954,7 @@
16952
16954
 
16953
16955
  // Request audio segments up to one fragment ahead of main stream-controller
16954
16956
  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)) {
16957
+ if (!this.audioOnly && this.startFragRequested && mainFragLoading && isMediaFragment(mainFragLoading) && isMediaFragment(frag) && !frag.endList && (!trackDetails.live || !this.loadingParts && targetBufferTime < this.hls.liveSyncPosition)) {
16956
16958
  var mainFrag = mainFragLoading;
16957
16959
  if (frag.start > mainFrag.end) {
16958
16960
  // Get buffered frag at target position from tracker (loaded out of sequence)
@@ -17016,8 +17018,8 @@
17016
17018
  };
17017
17019
  _proto.onManifestLoading = function onManifestLoading() {
17018
17020
  _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;
17021
+ this.bufferFlushed = this.flushing = this.audioOnly = false;
17022
+ this.resetItem();
17021
17023
  this.trackId = -1;
17022
17024
  };
17023
17025
  _proto.onLevelLoaded = function onLevelLoaded(event, data) {
@@ -17033,7 +17035,8 @@
17033
17035
  var levels = this.levels;
17034
17036
  var newDetails = data.details,
17035
17037
  trackId = data.id;
17036
- if (this.mainDetails == null || this.mainDetails.expired || newDetails.endCC > this.mainDetails.endCC) {
17038
+ var mainDetails = this.mainDetails;
17039
+ if (!mainDetails || mainDetails.expired || newDetails.endCC > mainDetails.endCC) {
17037
17040
  this.cachedTrackLoadedData = data;
17038
17041
  if (this.state !== State.STOPPED) {
17039
17042
  this.state = State.WAITING_TRACK;
@@ -17049,8 +17052,7 @@
17049
17052
  var sliding = 0;
17050
17053
  if (newDetails.live || (_track$details = track.details) != null && _track$details.live) {
17051
17054
  this.checkLiveUpdate(newDetails);
17052
- var mainDetails = this.mainDetails;
17053
- if (newDetails.deltaUpdateFailed || !mainDetails) {
17055
+ if (newDetails.deltaUpdateFailed) {
17054
17056
  return;
17055
17057
  }
17056
17058
  if (track.details) {
@@ -17071,8 +17073,8 @@
17071
17073
  this.levelLastLoaded = track;
17072
17074
 
17073
17075
  // 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);
17076
+ if (!this.startFragRequested) {
17077
+ this.setStartPosition(mainDetails, sliding);
17076
17078
  }
17077
17079
  this.hls.trigger(Events.AUDIO_TRACK_UPDATED, {
17078
17080
  details: newDetails,
@@ -17164,7 +17166,7 @@
17164
17166
  }
17165
17167
  };
17166
17168
  _proto.onFragLoading = function onFragLoading(event, data) {
17167
- if (data.frag.type === PlaylistLevelType.MAIN && isMediaFragment(data.frag)) {
17169
+ if (!this.audioOnly && data.frag.type === PlaylistLevelType.MAIN && isMediaFragment(data.frag)) {
17168
17170
  this.mainFragLoading = data;
17169
17171
  if (this.state === State.IDLE) {
17170
17172
  this.tick();
@@ -17175,6 +17177,10 @@
17175
17177
  var frag = data.frag,
17176
17178
  part = data.part;
17177
17179
  if (frag.type !== PlaylistLevelType.AUDIO) {
17180
+ if (!this.audioOnly && frag.type === PlaylistLevelType.MAIN && !frag.elementaryStreams.video && !frag.elementaryStreams.audiovideo) {
17181
+ this.audioOnly = true;
17182
+ this.mainFragLoading = null;
17183
+ }
17178
17184
  return;
17179
17185
  }
17180
17186
  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;