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

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
@@ -1059,7 +1059,7 @@
1059
1059
  // Some browsers don't allow to use bind on console object anyway
1060
1060
  // fallback to default if needed
1061
1061
  try {
1062
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.3");
1062
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.0-beta.3.0.canary.10943");
1063
1063
  } catch (e) {
1064
1064
  /* log fn threw an exception. All logger methods are no-ops. */
1065
1065
  return createLogger();
@@ -16358,7 +16358,7 @@
16358
16358
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16359
16359
  }
16360
16360
 
16361
- var version = "1.6.0-beta.3";
16361
+ var version = "1.6.0-beta.3.0.canary.10943";
16362
16362
 
16363
16363
  // ensure the worker ends up in the bundle
16364
16364
  // If the worker should not be included this gets aliased to empty.js
@@ -31572,7 +31572,7 @@
31572
31572
  this._targetLatencyUpdated = false;
31573
31573
  this.onTimeupdate = function () {
31574
31574
  var media = _this.media;
31575
- var levelDetails = _this.hls.latestLevelDetails;
31575
+ var levelDetails = _this.levelDetails;
31576
31576
  if (!media || !levelDetails) {
31577
31577
  return;
31578
31578
  }
@@ -31616,22 +31616,29 @@
31616
31616
  _proto.destroy = function destroy() {
31617
31617
  this.unregisterListeners();
31618
31618
  this.onMediaDetaching();
31619
- // @ts-ignore
31620
31619
  this.hls = null;
31621
31620
  };
31622
31621
  _proto.registerListeners = function registerListeners() {
31623
- this.hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
31624
- this.hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
31625
- this.hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
31626
- this.hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
31627
- this.hls.on(Events.ERROR, this.onError, this);
31622
+ var hls = this.hls;
31623
+ if (!hls) {
31624
+ return;
31625
+ }
31626
+ hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
31627
+ hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
31628
+ hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
31629
+ hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
31630
+ hls.on(Events.ERROR, this.onError, this);
31628
31631
  };
31629
31632
  _proto.unregisterListeners = function unregisterListeners() {
31630
- this.hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
31631
- this.hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
31632
- this.hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
31633
- this.hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
31634
- this.hls.off(Events.ERROR, this.onError, this);
31633
+ var hls = this.hls;
31634
+ if (!hls) {
31635
+ return;
31636
+ }
31637
+ hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
31638
+ hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
31639
+ hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
31640
+ hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
31641
+ hls.off(Events.ERROR, this.onError, this);
31635
31642
  };
31636
31643
  _proto.onMediaAttached = function onMediaAttached(event, data) {
31637
31644
  this.media = data.media;
@@ -31657,17 +31664,17 @@
31657
31664
  }
31658
31665
  };
31659
31666
  _proto.onError = function onError(event, data) {
31660
- var _this$hls$latestLevel;
31667
+ var _this$levelDetails;
31661
31668
  if (data.details !== ErrorDetails.BUFFER_STALLED_ERROR) {
31662
31669
  return;
31663
31670
  }
31664
31671
  this.stallCount++;
31665
- if ((_this$hls$latestLevel = this.hls.latestLevelDetails) != null && _this$hls$latestLevel.live) {
31672
+ if (this.hls && (_this$levelDetails = this.levelDetails) != null && _this$levelDetails.live) {
31666
31673
  this.hls.logger.warn('[latency-controller]: Stall detected, adjusting target latency');
31667
31674
  }
31668
31675
  };
31669
31676
  _proto.estimateLiveEdge = function estimateLiveEdge() {
31670
- var levelDetails = this.hls.latestLevelDetails;
31677
+ var levelDetails = this.levelDetails;
31671
31678
  if (levelDetails === null) {
31672
31679
  return null;
31673
31680
  }
@@ -31681,6 +31688,12 @@
31681
31688
  return liveEdge - this.currentTime;
31682
31689
  };
31683
31690
  return _createClass(LatencyController, [{
31691
+ key: "levelDetails",
31692
+ get: function get() {
31693
+ var _this$hls;
31694
+ return ((_this$hls = this.hls) == null ? undefined : _this$hls.latestLevelDetails) || null;
31695
+ }
31696
+ }, {
31684
31697
  key: "latency",
31685
31698
  get: function get() {
31686
31699
  return this._latency || 0;
@@ -31688,19 +31701,18 @@
31688
31701
  }, {
31689
31702
  key: "maxLatency",
31690
31703
  get: function get() {
31691
- var _this$hls;
31692
31704
  var config = this.config;
31693
31705
  if (config.liveMaxLatencyDuration !== undefined) {
31694
31706
  return config.liveMaxLatencyDuration;
31695
31707
  }
31696
- var levelDetails = (_this$hls = this.hls) == null ? undefined : _this$hls.latestLevelDetails;
31708
+ var levelDetails = this.levelDetails;
31697
31709
  return levelDetails ? config.liveMaxLatencyDurationCount * levelDetails.targetduration : 0;
31698
31710
  }
31699
31711
  }, {
31700
31712
  key: "targetLatency",
31701
31713
  get: function get() {
31702
- var levelDetails = this.hls.latestLevelDetails;
31703
- if (levelDetails === null) {
31714
+ var levelDetails = this.levelDetails;
31715
+ if (levelDetails === null || this.hls === null) {
31704
31716
  return null;
31705
31717
  }
31706
31718
  var holdBack = levelDetails.holdBack,
@@ -31731,7 +31743,7 @@
31731
31743
  if (liveEdge === null || targetLatency === null) {
31732
31744
  return null;
31733
31745
  }
31734
- var levelDetails = this.hls.latestLevelDetails;
31746
+ var levelDetails = this.levelDetails;
31735
31747
  if (levelDetails === null) {
31736
31748
  return null;
31737
31749
  }
@@ -31744,7 +31756,7 @@
31744
31756
  }, {
31745
31757
  key: "drift",
31746
31758
  get: function get() {
31747
- var levelDetails = this.hls.latestLevelDetails;
31759
+ var levelDetails = this.levelDetails;
31748
31760
  if (levelDetails === null) {
31749
31761
  return 1;
31750
31762
  }
@@ -31753,7 +31765,7 @@
31753
31765
  }, {
31754
31766
  key: "edgeStalled",
31755
31767
  get: function get() {
31756
- var levelDetails = this.hls.latestLevelDetails;
31768
+ var levelDetails = this.levelDetails;
31757
31769
  if (levelDetails === null) {
31758
31770
  return 0;
31759
31771
  }
@@ -31764,7 +31776,7 @@
31764
31776
  key: "forwardBufferLength",
31765
31777
  get: function get() {
31766
31778
  var media = this.media;
31767
- var levelDetails = this.hls.latestLevelDetails;
31779
+ var levelDetails = this.levelDetails;
31768
31780
  if (!media || !levelDetails) {
31769
31781
  return 0;
31770
31782
  }