hls.js 1.6.0-beta.3 → 1.6.0-beta.3.0.canary.10945

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.light.js CHANGED
@@ -1030,7 +1030,7 @@
1030
1030
  // Some browsers don't allow to use bind on console object anyway
1031
1031
  // fallback to default if needed
1032
1032
  try {
1033
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.3");
1033
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.3.0.canary.10945");
1034
1034
  } catch (e) {
1035
1035
  /* log fn threw an exception. All logger methods are no-ops. */
1036
1036
  return createLogger();
@@ -18753,7 +18753,7 @@
18753
18753
  this._targetLatencyUpdated = false;
18754
18754
  this.onTimeupdate = function () {
18755
18755
  var media = _this.media;
18756
- var levelDetails = _this.hls.latestLevelDetails;
18756
+ var levelDetails = _this.levelDetails;
18757
18757
  if (!media || !levelDetails) {
18758
18758
  return;
18759
18759
  }
@@ -18797,22 +18797,29 @@
18797
18797
  _proto.destroy = function destroy() {
18798
18798
  this.unregisterListeners();
18799
18799
  this.onMediaDetaching();
18800
- // @ts-ignore
18801
18800
  this.hls = null;
18802
18801
  };
18803
18802
  _proto.registerListeners = function registerListeners() {
18804
- this.hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
18805
- this.hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
18806
- this.hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
18807
- this.hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
18808
- this.hls.on(Events.ERROR, this.onError, this);
18803
+ var hls = this.hls;
18804
+ if (!hls) {
18805
+ return;
18806
+ }
18807
+ hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
18808
+ hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
18809
+ hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
18810
+ hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
18811
+ hls.on(Events.ERROR, this.onError, this);
18809
18812
  };
18810
18813
  _proto.unregisterListeners = function unregisterListeners() {
18811
- this.hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
18812
- this.hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
18813
- this.hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
18814
- this.hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
18815
- this.hls.off(Events.ERROR, this.onError, this);
18814
+ var hls = this.hls;
18815
+ if (!hls) {
18816
+ return;
18817
+ }
18818
+ hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
18819
+ hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
18820
+ hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
18821
+ hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
18822
+ hls.off(Events.ERROR, this.onError, this);
18816
18823
  };
18817
18824
  _proto.onMediaAttached = function onMediaAttached(event, data) {
18818
18825
  this.media = data.media;
@@ -18838,17 +18845,17 @@
18838
18845
  }
18839
18846
  };
18840
18847
  _proto.onError = function onError(event, data) {
18841
- var _this$hls$latestLevel;
18848
+ var _this$levelDetails;
18842
18849
  if (data.details !== ErrorDetails.BUFFER_STALLED_ERROR) {
18843
18850
  return;
18844
18851
  }
18845
18852
  this.stallCount++;
18846
- if ((_this$hls$latestLevel = this.hls.latestLevelDetails) != null && _this$hls$latestLevel.live) {
18853
+ if (this.hls && (_this$levelDetails = this.levelDetails) != null && _this$levelDetails.live) {
18847
18854
  this.hls.logger.warn('[latency-controller]: Stall detected, adjusting target latency');
18848
18855
  }
18849
18856
  };
18850
18857
  _proto.estimateLiveEdge = function estimateLiveEdge() {
18851
- var levelDetails = this.hls.latestLevelDetails;
18858
+ var levelDetails = this.levelDetails;
18852
18859
  if (levelDetails === null) {
18853
18860
  return null;
18854
18861
  }
@@ -18862,6 +18869,12 @@
18862
18869
  return liveEdge - this.currentTime;
18863
18870
  };
18864
18871
  return _createClass(LatencyController, [{
18872
+ key: "levelDetails",
18873
+ get: function get() {
18874
+ var _this$hls;
18875
+ return ((_this$hls = this.hls) == null ? undefined : _this$hls.latestLevelDetails) || null;
18876
+ }
18877
+ }, {
18865
18878
  key: "latency",
18866
18879
  get: function get() {
18867
18880
  return this._latency || 0;
@@ -18869,19 +18882,18 @@
18869
18882
  }, {
18870
18883
  key: "maxLatency",
18871
18884
  get: function get() {
18872
- var _this$hls;
18873
18885
  var config = this.config;
18874
18886
  if (config.liveMaxLatencyDuration !== undefined) {
18875
18887
  return config.liveMaxLatencyDuration;
18876
18888
  }
18877
- var levelDetails = (_this$hls = this.hls) == null ? undefined : _this$hls.latestLevelDetails;
18889
+ var levelDetails = this.levelDetails;
18878
18890
  return levelDetails ? config.liveMaxLatencyDurationCount * levelDetails.targetduration : 0;
18879
18891
  }
18880
18892
  }, {
18881
18893
  key: "targetLatency",
18882
18894
  get: function get() {
18883
- var levelDetails = this.hls.latestLevelDetails;
18884
- if (levelDetails === null) {
18895
+ var levelDetails = this.levelDetails;
18896
+ if (levelDetails === null || this.hls === null) {
18885
18897
  return null;
18886
18898
  }
18887
18899
  var holdBack = levelDetails.holdBack,
@@ -18912,7 +18924,7 @@
18912
18924
  if (liveEdge === null || targetLatency === null) {
18913
18925
  return null;
18914
18926
  }
18915
- var levelDetails = this.hls.latestLevelDetails;
18927
+ var levelDetails = this.levelDetails;
18916
18928
  if (levelDetails === null) {
18917
18929
  return null;
18918
18930
  }
@@ -18925,7 +18937,7 @@
18925
18937
  }, {
18926
18938
  key: "drift",
18927
18939
  get: function get() {
18928
- var levelDetails = this.hls.latestLevelDetails;
18940
+ var levelDetails = this.levelDetails;
18929
18941
  if (levelDetails === null) {
18930
18942
  return 1;
18931
18943
  }
@@ -18934,7 +18946,7 @@
18934
18946
  }, {
18935
18947
  key: "edgeStalled",
18936
18948
  get: function get() {
18937
- var levelDetails = this.hls.latestLevelDetails;
18949
+ var levelDetails = this.levelDetails;
18938
18950
  if (levelDetails === null) {
18939
18951
  return 0;
18940
18952
  }
@@ -18945,7 +18957,7 @@
18945
18957
  key: "forwardBufferLength",
18946
18958
  get: function get() {
18947
18959
  var media = this.media;
18948
- var levelDetails = this.hls.latestLevelDetails;
18960
+ var levelDetails = this.levelDetails;
18949
18961
  if (!media || !levelDetails) {
18950
18962
  return 0;
18951
18963
  }
@@ -19989,7 +20001,7 @@
19989
20001
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
19990
20002
  }
19991
20003
 
19992
- var version = "1.6.0-beta.3";
20004
+ var version = "1.6.0-beta.3.0.canary.10945";
19993
20005
 
19994
20006
  // ensure the worker ends up in the bundle
19995
20007
  // If the worker should not be included this gets aliased to empty.js