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.
@@ -402,7 +402,7 @@ function enableLogs(debugConfig, context, id) {
402
402
  // Some browsers don't allow to use bind on console object anyway
403
403
  // fallback to default if needed
404
404
  try {
405
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.3"}`);
405
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.0-beta.3.0.canary.10945"}`);
406
406
  } catch (e) {
407
407
  /* log fn threw an exception. All logger methods are no-ops. */
408
408
  return createLogger();
@@ -18587,7 +18587,7 @@ class LatencyController {
18587
18587
  const {
18588
18588
  media
18589
18589
  } = this;
18590
- const levelDetails = this.hls.latestLevelDetails;
18590
+ const levelDetails = this.levelDetails;
18591
18591
  if (!media || !levelDetails) {
18592
18592
  return;
18593
18593
  }
@@ -18628,23 +18628,26 @@ class LatencyController {
18628
18628
  this.config = hls.config;
18629
18629
  this.registerListeners();
18630
18630
  }
18631
+ get levelDetails() {
18632
+ var _this$hls;
18633
+ return ((_this$hls = this.hls) == null ? undefined : _this$hls.latestLevelDetails) || null;
18634
+ }
18631
18635
  get latency() {
18632
18636
  return this._latency || 0;
18633
18637
  }
18634
18638
  get maxLatency() {
18635
- var _this$hls;
18636
18639
  const {
18637
18640
  config
18638
18641
  } = this;
18639
18642
  if (config.liveMaxLatencyDuration !== undefined) {
18640
18643
  return config.liveMaxLatencyDuration;
18641
18644
  }
18642
- const levelDetails = (_this$hls = this.hls) == null ? undefined : _this$hls.latestLevelDetails;
18645
+ const levelDetails = this.levelDetails;
18643
18646
  return levelDetails ? config.liveMaxLatencyDurationCount * levelDetails.targetduration : 0;
18644
18647
  }
18645
18648
  get targetLatency() {
18646
- const levelDetails = this.hls.latestLevelDetails;
18647
- if (levelDetails === null) {
18649
+ const levelDetails = this.levelDetails;
18650
+ if (levelDetails === null || this.hls === null) {
18648
18651
  return null;
18649
18652
  }
18650
18653
  const {
@@ -18676,7 +18679,7 @@ class LatencyController {
18676
18679
  if (liveEdge === null || targetLatency === null) {
18677
18680
  return null;
18678
18681
  }
18679
- const levelDetails = this.hls.latestLevelDetails;
18682
+ const levelDetails = this.levelDetails;
18680
18683
  if (levelDetails === null) {
18681
18684
  return null;
18682
18685
  }
@@ -18687,14 +18690,14 @@ class LatencyController {
18687
18690
  return Math.min(Math.max(min, syncPosition), max);
18688
18691
  }
18689
18692
  get drift() {
18690
- const levelDetails = this.hls.latestLevelDetails;
18693
+ const levelDetails = this.levelDetails;
18691
18694
  if (levelDetails === null) {
18692
18695
  return 1;
18693
18696
  }
18694
18697
  return levelDetails.drift;
18695
18698
  }
18696
18699
  get edgeStalled() {
18697
- const levelDetails = this.hls.latestLevelDetails;
18700
+ const levelDetails = this.levelDetails;
18698
18701
  if (levelDetails === null) {
18699
18702
  return 0;
18700
18703
  }
@@ -18705,7 +18708,7 @@ class LatencyController {
18705
18708
  const {
18706
18709
  media
18707
18710
  } = this;
18708
- const levelDetails = this.hls.latestLevelDetails;
18711
+ const levelDetails = this.levelDetails;
18709
18712
  if (!media || !levelDetails) {
18710
18713
  return 0;
18711
18714
  }
@@ -18715,22 +18718,33 @@ class LatencyController {
18715
18718
  destroy() {
18716
18719
  this.unregisterListeners();
18717
18720
  this.onMediaDetaching();
18718
- // @ts-ignore
18719
18721
  this.hls = null;
18720
18722
  }
18721
18723
  registerListeners() {
18722
- this.hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
18723
- this.hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
18724
- this.hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
18725
- this.hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
18726
- this.hls.on(Events.ERROR, this.onError, this);
18724
+ const {
18725
+ hls
18726
+ } = this;
18727
+ if (!hls) {
18728
+ return;
18729
+ }
18730
+ hls.on(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
18731
+ hls.on(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
18732
+ hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
18733
+ hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
18734
+ hls.on(Events.ERROR, this.onError, this);
18727
18735
  }
18728
18736
  unregisterListeners() {
18729
- this.hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
18730
- this.hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
18731
- this.hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
18732
- this.hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
18733
- this.hls.off(Events.ERROR, this.onError, this);
18737
+ const {
18738
+ hls
18739
+ } = this;
18740
+ if (!hls) {
18741
+ return;
18742
+ }
18743
+ hls.off(Events.MEDIA_ATTACHED, this.onMediaAttached, this);
18744
+ hls.off(Events.MEDIA_DETACHING, this.onMediaDetaching, this);
18745
+ hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
18746
+ hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
18747
+ hls.off(Events.ERROR, this.onError, this);
18734
18748
  }
18735
18749
  onMediaAttached(event, data) {
18736
18750
  this.media = data.media;
@@ -18757,17 +18771,17 @@ class LatencyController {
18757
18771
  }
18758
18772
  }
18759
18773
  onError(event, data) {
18760
- var _this$hls$latestLevel;
18774
+ var _this$levelDetails;
18761
18775
  if (data.details !== ErrorDetails.BUFFER_STALLED_ERROR) {
18762
18776
  return;
18763
18777
  }
18764
18778
  this.stallCount++;
18765
- if ((_this$hls$latestLevel = this.hls.latestLevelDetails) != null && _this$hls$latestLevel.live) {
18779
+ if (this.hls && (_this$levelDetails = this.levelDetails) != null && _this$levelDetails.live) {
18766
18780
  this.hls.logger.warn('[latency-controller]: Stall detected, adjusting target latency');
18767
18781
  }
18768
18782
  }
18769
18783
  estimateLiveEdge() {
18770
- const levelDetails = this.hls.latestLevelDetails;
18784
+ const levelDetails = this.levelDetails;
18771
18785
  if (levelDetails === null) {
18772
18786
  return null;
18773
18787
  }
@@ -19366,7 +19380,7 @@ function assignTrackIdsByGroup(tracks) {
19366
19380
  });
19367
19381
  }
19368
19382
 
19369
- const version = "1.6.0-beta.3";
19383
+ const version = "1.6.0-beta.3.0.canary.10945";
19370
19384
 
19371
19385
  // ensure the worker ends up in the bundle
19372
19386
  // If the worker should not be included this gets aliased to empty.js