@clappr/player 0.9.0 → 0.11.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
@@ -3793,6 +3793,14 @@
3793
3793
  Events$1.PLAYBACK_STATS_ADD = 'playback:stats:add';
3794
3794
  // TODO doc
3795
3795
  Events$1.PLAYBACK_FRAGMENT_LOADED = 'playback:fragment:loaded';
3796
+ /**
3797
+ * Fired when a fragment has been appended into buffer
3798
+ *
3799
+ * @event PLAYBACK_FRAGMENT_BUFFERED
3800
+ * @param {Object} data Data
3801
+ *
3802
+ */
3803
+ Events$1.PLAYBACK_FRAGMENT_BUFFERED = 'playback:fragment:buffered';
3796
3804
  // TODO doc
3797
3805
  Events$1.PLAYBACK_LEVEL_SWITCH = 'playback:level:switch';
3798
3806
  /**
@@ -6617,7 +6625,7 @@
6617
6625
  plugins: {},
6618
6626
  playbacks: []
6619
6627
  };
6620
- var currentVersion = "0.10.0";
6628
+ var currentVersion = "0.11.0";
6621
6629
  return /*#__PURE__*/function () {
6622
6630
  /**
6623
6631
  * builds the loader
@@ -7752,7 +7760,7 @@
7752
7760
  key: "supportedVersion",
7753
7761
  get: function get() {
7754
7762
  return {
7755
- min: "0.10.0"
7763
+ min: "0.11.0"
7756
7764
  };
7757
7765
  }
7758
7766
  }, {
@@ -8514,7 +8522,7 @@
8514
8522
  key: "supportedVersion",
8515
8523
  get: function get() {
8516
8524
  return {
8517
- min: "0.10.0"
8525
+ min: "0.11.0"
8518
8526
  };
8519
8527
  }
8520
8528
  }, {
@@ -8569,7 +8577,7 @@
8569
8577
  key: "supportedVersion",
8570
8578
  get: function get() {
8571
8579
  return {
8572
- min: "0.10.0"
8580
+ min: "0.11.0"
8573
8581
  };
8574
8582
  }
8575
8583
  }, {
@@ -8649,7 +8657,7 @@
8649
8657
  key: "supportedVersion",
8650
8658
  get: function get() {
8651
8659
  return {
8652
- min: "0.10.0"
8660
+ min: "0.11.0"
8653
8661
  };
8654
8662
  }
8655
8663
  }, {
@@ -8775,7 +8783,7 @@
8775
8783
  key: "supportedVersion",
8776
8784
  get: function get() {
8777
8785
  return {
8778
- min: "0.10.0"
8786
+ min: "0.11.0"
8779
8787
  };
8780
8788
  }
8781
8789
  }, {
@@ -8916,7 +8924,7 @@
8916
8924
  key: "supportedVersion",
8917
8925
  get: function get() {
8918
8926
  return {
8919
- min: "0.10.0"
8927
+ min: "0.11.0"
8920
8928
  };
8921
8929
  }
8922
8930
  }, {
@@ -8945,7 +8953,7 @@
8945
8953
  @type {string}
8946
8954
  @default
8947
8955
  */
8948
- var version$1 = "0.10.0";
8956
+ var version$1 = "0.11.0";
8949
8957
 
8950
8958
  // Built-in Plugins/Playbacks
8951
8959
 
@@ -9109,7 +9117,7 @@
9109
9117
  key: "supportedVersion",
9110
9118
  get: function get() {
9111
9119
  return {
9112
- min: "0.10.0"
9120
+ min: "0.11.0"
9113
9121
  };
9114
9122
  }
9115
9123
  }, {
@@ -9168,7 +9176,7 @@
9168
9176
  key: "supportedVersion",
9169
9177
  get: function get() {
9170
9178
  return {
9171
- min: "0.10.0"
9179
+ min: "0.11.0"
9172
9180
  };
9173
9181
  }
9174
9182
  }, {
@@ -9327,7 +9335,7 @@
9327
9335
  key: "supportedVersion",
9328
9336
  get: function get() {
9329
9337
  return {
9330
- min: "0.10.0"
9338
+ min: "0.11.0"
9331
9339
  };
9332
9340
  }
9333
9341
  }, {
@@ -9454,7 +9462,7 @@
9454
9462
  key: "supportedVersion",
9455
9463
  get: function get() {
9456
9464
  return {
9457
- min: "0.10.0"
9465
+ min: "0.11.0"
9458
9466
  };
9459
9467
  }
9460
9468
  }, {
@@ -9502,7 +9510,7 @@
9502
9510
  key: "supportedVersion",
9503
9511
  get: function get() {
9504
9512
  return {
9505
- min: "0.10.0"
9513
+ min: "0.11.0"
9506
9514
  };
9507
9515
  }
9508
9516
  }, {
@@ -9622,7 +9630,7 @@
9622
9630
  key: "supportedVersion",
9623
9631
  get: function get() {
9624
9632
  return {
9625
- min: "0.10.0"
9633
+ min: "0.11.0"
9626
9634
  };
9627
9635
  }
9628
9636
  }, {
@@ -9741,7 +9749,7 @@
9741
9749
  key: "supportedVersion",
9742
9750
  get: function get() {
9743
9751
  return {
9744
- min: "0.10.0"
9752
+ min: "0.11.0"
9745
9753
  };
9746
9754
  }
9747
9755
  }, {
@@ -10231,7 +10239,7 @@
10231
10239
  key: "supportedVersion",
10232
10240
  get: function get() {
10233
10241
  return {
10234
- min: "0.10.0"
10242
+ min: "0.11.0"
10235
10243
  };
10236
10244
  }
10237
10245
  }, {
@@ -11031,7 +11039,7 @@
11031
11039
  key: "supportedVersion",
11032
11040
  get: function get() {
11033
11041
  return {
11034
- min: "0.10.0"
11042
+ min: "0.11.0"
11035
11043
  };
11036
11044
  }
11037
11045
  }, {
@@ -11234,7 +11242,7 @@
11234
11242
  key: "supportedVersion",
11235
11243
  get: function get() {
11236
11244
  return {
11237
- min: "0.10.0"
11245
+ min: "0.11.0"
11238
11246
  };
11239
11247
  }
11240
11248
  }, {
@@ -11436,7 +11444,7 @@
11436
11444
  key: "supportedVersion",
11437
11445
  get: function get() {
11438
11446
  return {
11439
- min: "0.10.0"
11447
+ min: "0.11.0"
11440
11448
  };
11441
11449
  }
11442
11450
  }, {
@@ -11514,7 +11522,7 @@
11514
11522
  key: "supportedVersion",
11515
11523
  get: function get() {
11516
11524
  return {
11517
- min: "0.10.0"
11525
+ min: "0.11.0"
11518
11526
  };
11519
11527
  }
11520
11528
  }, {
@@ -11635,7 +11643,7 @@
11635
11643
  key: "supportedVersion",
11636
11644
  get: function get() {
11637
11645
  return {
11638
- min: "0.10.0"
11646
+ min: "0.11.0"
11639
11647
  };
11640
11648
  }
11641
11649
  }, {
@@ -11707,7 +11715,7 @@
11707
11715
  WaterMark: WaterMarkPlugin
11708
11716
  };
11709
11717
 
11710
- var version = "0.9.0";
11718
+ var version = "0.11.0";
11711
11719
  for (var _i = 0, _Object$values = Object.values(Plugins); _i < _Object$values.length; _i++) {
11712
11720
  var plugin = _Object$values[_i];
11713
11721
  Loader.registerPlugin(plugin);
@@ -40386,6 +40394,7 @@
40386
40394
  }
40387
40395
  _this = _super.call.apply(_super, [this].concat(args));
40388
40396
  _this.options.hlsPlayback = _objectSpread2$1(_objectSpread2$1({}, _this.defaultOptions), _this.options.hlsPlayback);
40397
+ _this._timeUpdateThrottleDelay = 200;
40389
40398
  _this._timeUpdateFiringRate = 0.2;
40390
40399
  _this._durationChangeMinOffset = 0.5;
40391
40400
  _this._setInitialState();
@@ -40400,7 +40409,7 @@
40400
40409
  key: "supportedVersion",
40401
40410
  get: function get() {
40402
40411
  return {
40403
- min: "0.10.0"
40412
+ min: "0.11.0"
40404
40413
  };
40405
40414
  }
40406
40415
  }, {
@@ -40547,6 +40556,7 @@
40547
40556
  total: 0,
40548
40557
  firstFragDateTime: 0
40549
40558
  };
40559
+ this._lastTimeUpdateFiredTime = 0;
40550
40560
  this._lastDuration = null;
40551
40561
  // for hls streams which have dvr with a sliding window,
40552
40562
  // the content at the start of the playlist is removed as new
@@ -40634,6 +40644,9 @@
40634
40644
  this._hls.on(Hls.Events.FRAG_LOADED, function (evt, data) {
40635
40645
  return _this2._onFragmentLoaded(evt, data);
40636
40646
  });
40647
+ this._hls.on(Hls.Events.FRAG_BUFFERED, function (evt, data) {
40648
+ return _this2._onFragmentBuffered(evt, data);
40649
+ });
40637
40650
  this._hls.on(Hls.Events.FRAG_PARSING_METADATA, function (evt, data) {
40638
40651
  return _this2._onFragmentParsingMetadata(evt, data);
40639
40652
  });
@@ -40900,13 +40913,21 @@
40900
40913
  total: this.getDuration(),
40901
40914
  firstFragDateTime: this.getProgramDateTime()
40902
40915
  };
40916
+ var shouldThrottle = this._shouldThrottleTimeUpdate(update);
40917
+ if (shouldThrottle) return;
40918
+ this._lastTimeUpdate = update;
40919
+ this._lastTimeUpdateFiredTime = this._now;
40920
+ this.trigger(Events$1.PLAYBACK_TIMEUPDATE, update, this.name);
40921
+ }
40922
+ }, {
40923
+ key: "_shouldThrottleTimeUpdate",
40924
+ value: function _shouldThrottleTimeUpdate(update) {
40903
40925
  var isSameTime = Math.abs(update.current - this._lastTimeUpdate.current) < this._timeUpdateFiringRate;
40904
40926
  var isSameDuration = Math.abs(update.total - this._lastTimeUpdate.total) < this._durationChangeMinOffset;
40905
40927
  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);
40928
+ var isSameEventPayload = isSameTime && isSameDuration && isSameFirstFragDateTime;
40929
+ var isThrottled = this._now - this._lastTimeUpdateFiredTime < this._timeUpdateThrottleDelay;
40930
+ return isSameEventPayload && isThrottled;
40910
40931
  }
40911
40932
  }, {
40912
40933
  key: "_onDurationChange",
@@ -41121,6 +41142,11 @@
41121
41142
  value: function _onFragmentLoaded(evt, data) {
41122
41143
  this.trigger(Events$1.PLAYBACK_FRAGMENT_LOADED, data);
41123
41144
  }
41145
+ }, {
41146
+ key: "_onFragmentBuffered",
41147
+ value: function _onFragmentBuffered(evt, data) {
41148
+ this.trigger(Events$1.PLAYBACK_FRAGMENT_BUFFERED, data);
41149
+ }
41124
41150
  }, {
41125
41151
  key: "_onSubtitleLoaded",
41126
41152
  value: function _onSubtitleLoaded() {