@clappr/hlsjs-playback 1.8.3 → 1.9.0

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.
@@ -35491,7 +35491,7 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
35491
35491
  key: "supportedVersion",
35492
35492
  get: function get() {
35493
35493
  return {
35494
- min: "0.12.0"
35494
+ min: "0.13.0"
35495
35495
  };
35496
35496
  }
35497
35497
  }, {
@@ -35502,12 +35502,20 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
35502
35502
  }, {
35503
35503
  key: "currentLevel",
35504
35504
  get: function get() {
35505
- if (this._currentLevel === null || this._currentLevel === undefined) return AUTO;else return this._currentLevel; //0 is a valid level ID
35505
+ if (this._currentLevel === null || this._currentLevel === undefined) {
35506
+ return AUTO;
35507
+ } else {
35508
+ return this._currentLevel;
35509
+ } // 0 is a valid level ID
35506
35510
  },
35507
35511
  set: function set(id) {
35508
35512
  this._currentLevel = id;
35509
35513
  this.trigger(core.Events.PLAYBACK_LEVEL_SWITCH_START);
35510
- if (this.options.playback.hlsUseNextLevel) this._hls.nextLevel = this._currentLevel;else this._hls.currentLevel = this._currentLevel;
35514
+ if (this.options.playback.hlsUseNextLevel) {
35515
+ this._hls.nextLevel = this._currentLevel;
35516
+ } else {
35517
+ this._hls.currentLevel = this._currentLevel;
35518
+ }
35511
35519
  }
35512
35520
  }, {
35513
35521
  key: "isReady",
@@ -35532,7 +35540,9 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
35532
35540
  }, {
35533
35541
  key: "_startTime",
35534
35542
  get: function get() {
35535
- if (this._playbackType === core.Playback.LIVE && this._playlistType !== 'EVENT') return this._extrapolatedStartTime;
35543
+ if (this._playbackType === core.Playback.LIVE && this._playlistType !== 'EVENT') {
35544
+ return this._extrapolatedStartTime;
35545
+ }
35536
35546
  return this._playableRegionStartTime;
35537
35547
  }
35538
35548
  }, {
@@ -35546,7 +35556,9 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
35546
35556
  }, {
35547
35557
  key: "_extrapolatedStartTime",
35548
35558
  get: function get() {
35549
- if (!this._localStartTimeCorrelation) return this._playableRegionStartTime;
35559
+ if (!this._localStartTimeCorrelation) {
35560
+ return this._playableRegionStartTime;
35561
+ }
35550
35562
  var corr = this._localStartTimeCorrelation;
35551
35563
  var timePassed = this._now - corr.local;
35552
35564
  var extrapolatedWindowStartTime = (corr.remote + timePassed) / 1000;
@@ -35592,7 +35604,9 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
35592
35604
  }, {
35593
35605
  key: "_extrapolatedWindowDuration",
35594
35606
  get: function get() {
35595
- if (this._segmentTargetDuration === null) return 0;
35607
+ if (this._segmentTargetDuration === null) {
35608
+ return 0;
35609
+ }
35596
35610
  return this._extrapolatedWindowNumSegments * this._segmentTargetDuration;
35597
35611
  }
35598
35612
  }, {
@@ -35713,7 +35727,7 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
35713
35727
  _this2.options.hlsPlayback.preload && _this2._hls.loadSource(_this2.options.src);
35714
35728
  });
35715
35729
  this._hls.on(Hls.Events.MANIFEST_LOADING, function () {
35716
- return _this2._manifestLoading = true;
35730
+ _this2._manifestLoading = true;
35717
35731
  });
35718
35732
  this._hls.on(Hls.Events.LEVEL_LOADED, function (evt, data) {
35719
35733
  return _this2._updatePlaybackType(evt, data);
@@ -35848,6 +35862,18 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
35848
35862
  value: function getDuration() {
35849
35863
  return this._duration;
35850
35864
  }
35865
+
35866
+ // the frame rate should be retrieved from the HLS.js level information
35867
+ // as it is not necessarily exposed directly by the video element
35868
+ }, {
35869
+ key: "getFrameRate",
35870
+ value: function getFrameRate() {
35871
+ if (this._hls && this._hls.levels && this._hls.currentLevel >= 0) {
35872
+ var level = this._hls.levels[this._hls.currentLevel];
35873
+ return level && level.frameRate ? level.frameRate : null;
35874
+ }
35875
+ return null;
35876
+ }
35851
35877
  }, {
35852
35878
  key: "getCurrentTime",
35853
35879
  value: function getCurrentTime() {
@@ -35889,7 +35915,13 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
35889
35915
  }, {
35890
35916
  key: "_updateSettings",
35891
35917
  value: function _updateSettings() {
35892
- if (this._playbackType === core.Playback.VOD) this.settings.left = ['playpause', 'position', 'duration'];else if (this.dvrEnabled) this.settings.left = ['playpause'];else this.settings.left = ['playstop'];
35918
+ if (this._playbackType === core.Playback.VOD) {
35919
+ this.settings.left = ['playpause', 'position', 'duration'];
35920
+ } else if (this.dvrEnabled) {
35921
+ this.settings.left = ['playpause'];
35922
+ } else {
35923
+ this.settings.left = ['playstop'];
35924
+ }
35893
35925
  this.settings.seekEnabled = this.isSeekEnabled();
35894
35926
  this.trigger(core.Events.PLAYBACK_SETTINGSUPDATE);
35895
35927
  }
@@ -36036,7 +36068,9 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
36036
36068
  start: Math.max(0, this.el.buffered.start(i) - this._playableRegionStartTime),
36037
36069
  end: Math.max(0, this.el.buffered.end(i) - this._playableRegionStartTime)
36038
36070
  }]);
36039
- if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) bufferedPos = i;
36071
+ if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) {
36072
+ bufferedPos = i;
36073
+ }
36040
36074
  }
36041
36075
  var progress = {
36042
36076
  start: buffered[bufferedPos].start,
@@ -36086,7 +36120,9 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
36086
36120
  this._playbackType = data.details.live ? core.Playback.LIVE : core.Playback.VOD;
36087
36121
  this._onLevelUpdated(evt, data);
36088
36122
  // Live stream subtitle tracks detection hack (may not immediately available)
36089
- if (this._ccTracksUpdated && this._playbackType === core.Playback.LIVE && this.hasClosedCaptionsTracks) this._onSubtitleLoaded();
36123
+ if (this._ccTracksUpdated && this._playbackType === core.Playback.LIVE && this.hasClosedCaptionsTracks) {
36124
+ this._onSubtitleLoaded();
36125
+ }
36090
36126
  }
36091
36127
  }, {
36092
36128
  key: "_fillLevels",
@@ -36112,7 +36148,9 @@ Schedule: ${scheduleItems.map(seg => segmentToString(seg))}`);
36112
36148
  var previousPlayableRegionDuration = this._playableRegionDuration;
36113
36149
  if (fragments.length === 0) return;
36114
36150
  // #EXT-X-PROGRAM-DATE-TIME
36115
- if (fragments[0].rawProgramDateTime) this._programDateTime = fragments[0].rawProgramDateTime;
36151
+ if (fragments[0].rawProgramDateTime) {
36152
+ this._programDateTime = fragments[0].rawProgramDateTime;
36153
+ }
36116
36154
  if (this._playableRegionStartTime !== fragments[0].start) {
36117
36155
  startTimeChanged = true;
36118
36156
  this._playableRegionStartTime = fragments[0].start;