@clappr/player 0.9.0 → 0.10.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.
package/dist/clappr.js CHANGED
@@ -11707,7 +11707,7 @@
11707
11707
  WaterMark: WaterMarkPlugin
11708
11708
  };
11709
11709
 
11710
- var version = "0.9.0";
11710
+ var version = "0.10.0";
11711
11711
  for (var _i = 0, _Object$values = Object.values(Plugins); _i < _Object$values.length; _i++) {
11712
11712
  var plugin = _Object$values[_i];
11713
11713
  Loader.registerPlugin(plugin);
@@ -40386,6 +40386,7 @@
40386
40386
  }
40387
40387
  _this = _super.call.apply(_super, [this].concat(args));
40388
40388
  _this.options.hlsPlayback = _objectSpread2$1(_objectSpread2$1({}, _this.defaultOptions), _this.options.hlsPlayback);
40389
+ _this._timeUpdateThrottleDelay = 200;
40389
40390
  _this._timeUpdateFiringRate = 0.2;
40390
40391
  _this._durationChangeMinOffset = 0.5;
40391
40392
  _this._setInitialState();
@@ -40547,6 +40548,7 @@
40547
40548
  total: 0,
40548
40549
  firstFragDateTime: 0
40549
40550
  };
40551
+ this._lastTimeUpdateFiredTime = 0;
40550
40552
  this._lastDuration = null;
40551
40553
  // for hls streams which have dvr with a sliding window,
40552
40554
  // the content at the start of the playlist is removed as new
@@ -40900,13 +40902,21 @@
40900
40902
  total: this.getDuration(),
40901
40903
  firstFragDateTime: this.getProgramDateTime()
40902
40904
  };
40905
+ var shouldThrottle = this._shouldThrottleTimeUpdate(update);
40906
+ if (shouldThrottle) return;
40907
+ this._lastTimeUpdate = update;
40908
+ this._lastTimeUpdateFiredTime = this._now;
40909
+ this.trigger(Events$1.PLAYBACK_TIMEUPDATE, update, this.name);
40910
+ }
40911
+ }, {
40912
+ key: "_shouldThrottleTimeUpdate",
40913
+ value: function _shouldThrottleTimeUpdate(update) {
40903
40914
  var isSameTime = Math.abs(update.current - this._lastTimeUpdate.current) < this._timeUpdateFiringRate;
40904
40915
  var isSameDuration = Math.abs(update.total - this._lastTimeUpdate.total) < this._durationChangeMinOffset;
40905
40916
  var isSameFirstFragDateTime = update.firstFragDateTime === this._lastTimeUpdate.firstFragDateTime;
40906
- var isSame = isSameTime && isSameDuration && isSameFirstFragDateTime;
40907
- if (isSame) return;
40908
- this._lastTimeUpdate = update;
40909
- this.trigger(Events$1.PLAYBACK_TIMEUPDATE, update, this.name);
40917
+ var isSameEventPayload = isSameTime && isSameDuration && isSameFirstFragDateTime;
40918
+ var isThrottled = this._now - this._lastTimeUpdateFiredTime < this._timeUpdateThrottleDelay;
40919
+ return isSameEventPayload && isThrottled;
40910
40920
  }
40911
40921
  }, {
40912
40922
  key: "_onDurationChange",