@clappr/player 0.7.0 → 0.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.
@@ -3143,7 +3143,7 @@
3143
3143
  var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LEVEL_INFO;
3144
3144
  var offLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : LEVEL_DISABLED;
3145
3145
  _classCallCheck$1(this, Log);
3146
- this.EXCLUDE_LIST = ['timeupdate', 'playback:timeupdate', 'playback:progress', 'container:hover', 'container:timeupdate', 'container:progress'];
3146
+ this.EXCLUDE_LIST = ['timeupdate', 'playback:timeupdate', 'playback:progress', 'container:hover', 'container:timeupdate', 'container:progress', 'core:mousemove'];
3147
3147
  this.level = level;
3148
3148
  this.previousLevel = this.level;
3149
3149
  this.offLevel = offLevel;
@@ -3191,8 +3191,8 @@
3191
3191
  }, {
3192
3192
  key: "log",
3193
3193
  value: function log(klass, level, message) {
3194
- if (this.EXCLUDE_LIST.indexOf(message[0]) >= 0) return;
3195
3194
  if (level < this.level) return;
3195
+ if (this.EXCLUDE_LIST.indexOf(message[0]) >= 0) return;
3196
3196
  if (!message) {
3197
3197
  message = klass;
3198
3198
  klass = null;
@@ -3826,6 +3826,13 @@
3826
3826
  */
3827
3827
  Events.PLAYBACK_AUDIO_CHANGED = 'playback:audio:changed';
3828
3828
 
3829
+ /**
3830
+ * Fired when the playback was resized.
3831
+ *
3832
+ * @event PLAYBACK_RESIZE
3833
+ */
3834
+ Events.PLAYBACK_RESIZE = 'playback:resize';
3835
+
3829
3836
  // Core Events
3830
3837
  /**
3831
3838
  * Fired when the containers are created
@@ -4530,6 +4537,34 @@
4530
4537
  this.setElement(this.el, false);
4531
4538
  }
4532
4539
  }
4540
+
4541
+ /**
4542
+ * method called before resize the element
4543
+ * @method onResize
4544
+ * @return {UIObject} itself
4545
+ */
4546
+ }, {
4547
+ key: "onResize",
4548
+ value: function onResize() {
4549
+ return this;
4550
+ }
4551
+
4552
+ /**
4553
+ * resize current element
4554
+ * @method resize
4555
+ * @param {Object} options the options object
4556
+ * @return {UIObject} itself
4557
+ */
4558
+ }, {
4559
+ key: "resize",
4560
+ value: function resize(options) {
4561
+ var newWidth = isNumber(options.width) ? "".concat(options.width, "px") : "".concat(options.width);
4562
+ var newHeight = isNumber(options.height) ? "".concat(options.height, "px") : "".concat(options.height);
4563
+ this.el.style.width = newWidth;
4564
+ this.el.style.height = newHeight;
4565
+ this.onResize(options);
4566
+ return this;
4567
+ }
4533
4568
  }]);
4534
4569
  }(BaseObject);
4535
4570
 
@@ -5007,11 +5042,6 @@
5007
5042
  value: function setStyle(style) {
5008
5043
  this.$el.css(style);
5009
5044
  }
5010
- }, {
5011
- key: "animate",
5012
- value: function animate(style, duration) {
5013
- return this.$el.animate(style, duration).promise();
5014
- }
5015
5045
  }, {
5016
5046
  key: "ready",
5017
5047
  value: function ready() {
@@ -5358,10 +5388,22 @@
5358
5388
  width = _ref.width,
5359
5389
  height = _ref.height;
5360
5390
  var isResize = height !== newSize.height || width !== newSize.width;
5361
- if (isResize) {
5362
- this.currentSize = newSize;
5363
- this.trigger(Events.CONTAINER_RESIZE, newSize);
5364
- }
5391
+ if (!isResize) return;
5392
+ this.currentSize = newSize;
5393
+ this.trigger(Events.CONTAINER_RESIZE, newSize);
5394
+ }
5395
+
5396
+ /**
5397
+ * method called before resize the element
5398
+ * @method onResize
5399
+ * @param {Object} options the options object
5400
+ * @return {UIObject} itself
5401
+ */
5402
+ }, {
5403
+ key: "onResize",
5404
+ value: function onResize(options) {
5405
+ this.playback.resize(options);
5406
+ return this;
5365
5407
  }
5366
5408
 
5367
5409
  /**
@@ -5787,6 +5829,19 @@
5787
5829
  value: function canAutoPlay(cb) {
5788
5830
  cb(true, null); // Assume playback can autoplay by default
5789
5831
  }
5832
+
5833
+ /**
5834
+ * method called before resize the element
5835
+ * @method onResize
5836
+ * @param {Object} options the options object
5837
+ * @return {UIObject} itself
5838
+ */
5839
+ }, {
5840
+ key: "onResize",
5841
+ value: function onResize(options) {
5842
+ this.trigger(Events.PLAYBACK_RESIZE, options);
5843
+ return this;
5844
+ }
5790
5845
  }]);
5791
5846
  }(UIObject);
5792
5847
  Object.assign(Playback.prototype, ErrorMixin);
@@ -6125,16 +6180,16 @@
6125
6180
  };
6126
6181
  this.resize(this.currentSize);
6127
6182
  }
6183
+
6184
+ /**
6185
+ * method called before resize the element
6186
+ * @method onResize
6187
+ * @param {Object} options the options object
6188
+ * @return {UIObject} itself
6189
+ */
6128
6190
  }, {
6129
- key: "resize",
6130
- value: function resize(options) {
6131
- if (!isNumber(options.height) && !isNumber(options.width)) {
6132
- this.el.style.height = "".concat(options.height);
6133
- this.el.style.width = "".concat(options.width);
6134
- } else {
6135
- this.el.style.height = "".concat(options.height, "px");
6136
- this.el.style.width = "".concat(options.width, "px");
6137
- }
6191
+ key: "onResize",
6192
+ value: function onResize(options) {
6138
6193
  this.previousSize = {
6139
6194
  width: this.options.width,
6140
6195
  height: this.options.height
@@ -6143,6 +6198,7 @@
6143
6198
  this.options.height = options.height;
6144
6199
  this.currentSize = options;
6145
6200
  this.triggerResize(this.currentSize);
6201
+ return this;
6146
6202
  }
6147
6203
  }, {
6148
6204
  key: "enableResizeObserver",
@@ -6161,13 +6217,12 @@
6161
6217
  key: "triggerResize",
6162
6218
  value: function triggerResize(newSize) {
6163
6219
  var thereWasChange = this.firstResize || this.oldHeight !== newSize.height || this.oldWidth !== newSize.width;
6164
- if (thereWasChange) {
6165
- this.oldHeight = newSize.height;
6166
- this.oldWidth = newSize.width;
6167
- this.computedSize = newSize;
6168
- this.firstResize = false;
6169
- this.trigger(Events.CORE_RESIZE, newSize);
6170
- }
6220
+ if (!thereWasChange) return;
6221
+ this.oldHeight = newSize.height;
6222
+ this.oldWidth = newSize.width;
6223
+ this.computedSize = newSize;
6224
+ this.firstResize = false;
6225
+ this.trigger(Events.CORE_RESIZE, newSize);
6171
6226
  }
6172
6227
  }, {
6173
6228
  key: "disableResizeObserver",
@@ -6562,7 +6617,7 @@
6562
6617
  plugins: {},
6563
6618
  playbacks: []
6564
6619
  };
6565
- var currentVersion = "0.8.0";
6620
+ var currentVersion = "0.10.0";
6566
6621
  return /*#__PURE__*/function () {
6567
6622
  /**
6568
6623
  * builds the loader
@@ -7697,7 +7752,7 @@
7697
7752
  key: "supportedVersion",
7698
7753
  get: function get() {
7699
7754
  return {
7700
- min: "0.8.0"
7755
+ min: "0.10.0"
7701
7756
  };
7702
7757
  }
7703
7758
  }, {
@@ -7968,7 +8023,6 @@
7968
8023
  key: "pause",
7969
8024
  value: function pause() {
7970
8025
  this.el.pause();
7971
- this.dvrEnabled && this._updateDvr(true);
7972
8026
  }
7973
8027
  }, {
7974
8028
  key: "stop",
@@ -8105,6 +8159,7 @@
8105
8159
  }, {
8106
8160
  key: "_onPause",
8107
8161
  value: function _onPause() {
8162
+ this.dvrEnabled && this._updateDvr(true);
8108
8163
  this._stopPlayheadMovingChecks();
8109
8164
  this._handleBufferingEvents();
8110
8165
  this.trigger(Events.PLAYBACK_PAUSE);
@@ -8112,7 +8167,10 @@
8112
8167
  }, {
8113
8168
  key: "_onSeeking",
8114
8169
  value: function _onSeeking() {
8115
- this.trigger(Events.PLAYBACK_SEEK, this.getCurrentTime());
8170
+ var currentTime = this.getCurrentTime();
8171
+ // assume live if time within 3 seconds of end of stream
8172
+ this.dvrEnabled && this._updateDvr(currentTime < this.getDuration() - 3);
8173
+ this.trigger(Events.PLAYBACK_SEEK, currentTime);
8116
8174
  this._handleBufferingEvents();
8117
8175
  }
8118
8176
  }, {
@@ -8219,8 +8277,6 @@
8219
8277
  Log.warn('Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point.');
8220
8278
  time = this.getDuration();
8221
8279
  }
8222
- // assume live if time within 3 seconds of end of stream
8223
- this.dvrEnabled && this._updateDvr(time < this.getDuration() - 3);
8224
8280
  time += this.el.seekable.start(0);
8225
8281
  this.el.currentTime = time;
8226
8282
  }
@@ -8458,7 +8514,7 @@
8458
8514
  key: "supportedVersion",
8459
8515
  get: function get() {
8460
8516
  return {
8461
- min: "0.8.0"
8517
+ min: "0.10.0"
8462
8518
  };
8463
8519
  }
8464
8520
  }, {
@@ -8513,7 +8569,7 @@
8513
8569
  key: "supportedVersion",
8514
8570
  get: function get() {
8515
8571
  return {
8516
- min: "0.8.0"
8572
+ min: "0.10.0"
8517
8573
  };
8518
8574
  }
8519
8575
  }, {
@@ -8593,7 +8649,7 @@
8593
8649
  key: "supportedVersion",
8594
8650
  get: function get() {
8595
8651
  return {
8596
- min: "0.8.0"
8652
+ min: "0.10.0"
8597
8653
  };
8598
8654
  }
8599
8655
  }, {
@@ -8719,7 +8775,7 @@
8719
8775
  key: "supportedVersion",
8720
8776
  get: function get() {
8721
8777
  return {
8722
- min: "0.8.0"
8778
+ min: "0.10.0"
8723
8779
  };
8724
8780
  }
8725
8781
  }, {
@@ -8860,7 +8916,7 @@
8860
8916
  key: "supportedVersion",
8861
8917
  get: function get() {
8862
8918
  return {
8863
- min: "0.8.0"
8919
+ min: "0.10.0"
8864
8920
  };
8865
8921
  }
8866
8922
  }, {
@@ -8889,7 +8945,7 @@
8889
8945
  @type {string}
8890
8946
  @default
8891
8947
  */
8892
- var version$1 = "0.8.0";
8948
+ var version$1 = "0.10.0";
8893
8949
 
8894
8950
  // Built-in Plugins/Playbacks
8895
8951
 
@@ -9053,7 +9109,7 @@
9053
9109
  key: "supportedVersion",
9054
9110
  get: function get() {
9055
9111
  return {
9056
- min: "0.8.0"
9112
+ min: "0.10.0"
9057
9113
  };
9058
9114
  }
9059
9115
  }, {
@@ -9112,7 +9168,7 @@
9112
9168
  key: "supportedVersion",
9113
9169
  get: function get() {
9114
9170
  return {
9115
- min: "0.8.0"
9171
+ min: "0.10.0"
9116
9172
  };
9117
9173
  }
9118
9174
  }, {
@@ -9271,7 +9327,7 @@
9271
9327
  key: "supportedVersion",
9272
9328
  get: function get() {
9273
9329
  return {
9274
- min: "0.8.0"
9330
+ min: "0.10.0"
9275
9331
  };
9276
9332
  }
9277
9333
  }, {
@@ -9398,7 +9454,7 @@
9398
9454
  key: "supportedVersion",
9399
9455
  get: function get() {
9400
9456
  return {
9401
- min: "0.8.0"
9457
+ min: "0.10.0"
9402
9458
  };
9403
9459
  }
9404
9460
  }, {
@@ -9446,7 +9502,7 @@
9446
9502
  key: "supportedVersion",
9447
9503
  get: function get() {
9448
9504
  return {
9449
- min: "0.8.0"
9505
+ min: "0.10.0"
9450
9506
  };
9451
9507
  }
9452
9508
  }, {
@@ -9566,7 +9622,7 @@
9566
9622
  key: "supportedVersion",
9567
9623
  get: function get() {
9568
9624
  return {
9569
- min: "0.8.0"
9625
+ min: "0.10.0"
9570
9626
  };
9571
9627
  }
9572
9628
  }, {
@@ -9685,7 +9741,7 @@
9685
9741
  key: "supportedVersion",
9686
9742
  get: function get() {
9687
9743
  return {
9688
- min: "0.8.0"
9744
+ min: "0.10.0"
9689
9745
  };
9690
9746
  }
9691
9747
  }, {
@@ -10175,7 +10231,7 @@
10175
10231
  key: "supportedVersion",
10176
10232
  get: function get() {
10177
10233
  return {
10178
- min: "0.8.0"
10234
+ min: "0.10.0"
10179
10235
  };
10180
10236
  }
10181
10237
  }, {
@@ -10975,7 +11031,7 @@
10975
11031
  key: "supportedVersion",
10976
11032
  get: function get() {
10977
11033
  return {
10978
- min: "0.8.0"
11034
+ min: "0.10.0"
10979
11035
  };
10980
11036
  }
10981
11037
  }, {
@@ -11178,7 +11234,7 @@
11178
11234
  key: "supportedVersion",
11179
11235
  get: function get() {
11180
11236
  return {
11181
- min: "0.8.0"
11237
+ min: "0.10.0"
11182
11238
  };
11183
11239
  }
11184
11240
  }, {
@@ -11380,7 +11436,7 @@
11380
11436
  key: "supportedVersion",
11381
11437
  get: function get() {
11382
11438
  return {
11383
- min: "0.8.0"
11439
+ min: "0.10.0"
11384
11440
  };
11385
11441
  }
11386
11442
  }, {
@@ -11458,7 +11514,7 @@
11458
11514
  key: "supportedVersion",
11459
11515
  get: function get() {
11460
11516
  return {
11461
- min: "0.8.0"
11517
+ min: "0.10.0"
11462
11518
  };
11463
11519
  }
11464
11520
  }, {
@@ -11579,7 +11635,7 @@
11579
11635
  key: "supportedVersion",
11580
11636
  get: function get() {
11581
11637
  return {
11582
- min: "0.8.0"
11638
+ min: "0.10.0"
11583
11639
  };
11584
11640
  }
11585
11641
  }, {
@@ -11651,7 +11707,7 @@
11651
11707
  WaterMark: WaterMarkPlugin
11652
11708
  };
11653
11709
 
11654
- var version = "0.7.0";
11710
+ var version = "0.9.0";
11655
11711
  for (var _i = 0, _Object$values = Object.values(Plugins); _i < _Object$values.length; _i++) {
11656
11712
  var plugin = _Object$values[_i];
11657
11713
  Loader.registerPlugin(plugin);