@byteplus/veplayer 2.4.1-rc.1 → 2.4.2-rc.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.
@@ -1311,7 +1311,7 @@ var __publicField = (obj, key, value) => {
1311
1311
  android: /(Android)\s([\d.]+)/,
1312
1312
  ios: /(Version)\/([\d.]+)/
1313
1313
  };
1314
- var H264_MIMETYPES = ["avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "avc1.42E01E", "mp4v.20.8", "mp4v.20.8, mp4a.40.2", "mp4v.20.240, mp4a.40.2"];
1314
+ var H264_MIMETYPES = ["avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "avc1.42E01E", "mp4v.20.8", "avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "mp4v.20.8, mp4a.40.2", "mp4v.20.240, mp4a.40.2"];
1315
1315
  var sniffer = {
1316
1316
  get device() {
1317
1317
  var r = sniffer.os;
@@ -1456,7 +1456,7 @@ var __publicField = (obj, key, value) => {
1456
1456
  }
1457
1457
  }
1458
1458
  };
1459
- var version = "3.0.20-rc.3";
1459
+ var version = "3.0.19-rc.0";
1460
1460
  var ERROR_TYPE_MAP = {
1461
1461
  1: "media",
1462
1462
  2: "media",
@@ -3416,7 +3416,7 @@ var __publicField = (obj, key, value) => {
3416
3416
  if (!this.observer) {
3417
3417
  return;
3418
3418
  }
3419
- this.observer.observe(target);
3419
+ this.observer && this.observer.observe(target);
3420
3420
  var _pid = target.getAttribute(PLATER_ID);
3421
3421
  var __handlers = this.__handlers;
3422
3422
  var index = -1;
@@ -3445,17 +3445,16 @@ var __publicField = (obj, key, value) => {
3445
3445
  }
3446
3446
  });
3447
3447
  try {
3448
- var _this$observer;
3449
- (_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.unobserve(target);
3448
+ this.observer && this.observer.unobserve(target);
3450
3449
  } catch (e) {
3451
3450
  }
3451
+ this.observer && this.observer.unobserve(target);
3452
3452
  i > -1 && this.__handlers.splice(i, 1);
3453
3453
  }
3454
3454
  }, {
3455
3455
  key: "destroyObserver",
3456
3456
  value: function destroyObserver() {
3457
- var _this$observer2;
3458
- (_this$observer2 = this.observer) === null || _this$observer2 === void 0 ? void 0 : _this$observer2.disconnect();
3457
+ this.observer && this.observer.disconnect();
3459
3458
  this.observer = null;
3460
3459
  this.__handlers = null;
3461
3460
  }
@@ -3487,8 +3486,7 @@ var __publicField = (obj, key, value) => {
3487
3486
  return resizeObserver;
3488
3487
  }
3489
3488
  function unObserver(target, handler) {
3490
- var _resizeObserver;
3491
- (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.unObserver(target, handler);
3489
+ resizeObserver.unObserver(target, handler);
3492
3490
  }
3493
3491
  var pluginsManager = {
3494
3492
  pluginGroup: {},
@@ -4486,7 +4484,10 @@ var __publicField = (obj, key, value) => {
4486
4484
  }
4487
4485
  var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4488
4486
  XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
4489
- _this._seekToStartTime();
4487
+ if (_this.__startTime > 0 && _this.duration > 0) {
4488
+ _this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
4489
+ _this.__startTime = -1;
4490
+ }
4490
4491
  _this.playbackRate = defaultPlaybackRate;
4491
4492
  (autoplay2 || _this._useAutoplay) && _this.mediaPlay();
4492
4493
  _this.off(CANPLAY, _this.canPlayFunc);
@@ -5108,7 +5109,10 @@ var __publicField = (obj, key, value) => {
5108
5109
  reject(e);
5109
5110
  };
5110
5111
  var _canplay = function _canplay2() {
5111
- _this9._seekToStartTime();
5112
+ if (_this9.duration > 0 && _this9.__startTime > 0) {
5113
+ _this9.currentTime = _this9.__startTime;
5114
+ _this9.__startTime = -1;
5115
+ }
5112
5116
  if (isPaused) {
5113
5117
  _this9.pause();
5114
5118
  }
@@ -5729,17 +5733,11 @@ var __publicField = (obj, key, value) => {
5729
5733
  }, {
5730
5734
  key: "onLoadeddata",
5731
5735
  value: function onLoadeddata() {
5732
- var _this22 = this;
5733
5736
  this.isError = false;
5734
5737
  this.isSeeking = false;
5735
- if (this.__startTime > 0) {
5736
- if (this.duration > 0) {
5737
- this._seekToStartTime();
5738
- } else {
5739
- this.once(DURATION_CHANGE, function() {
5740
- _this22._seekToStartTime();
5741
- });
5742
- }
5738
+ if (this.__startTime > 0 && this.duration > 0) {
5739
+ this.currentTime = this.__startTime;
5740
+ this.__startTime = -1;
5743
5741
  }
5744
5742
  }
5745
5743
  }, {
@@ -5808,27 +5806,27 @@ var __publicField = (obj, key, value) => {
5808
5806
  }, {
5809
5807
  key: "onWaiting",
5810
5808
  value: function onWaiting() {
5811
- var _this23 = this;
5809
+ var _this22 = this;
5812
5810
  if (this.waitTimer) {
5813
5811
  util.clearTimeout(this, this.waitTimer);
5814
5812
  }
5815
5813
  this.updateAcc("waiting");
5816
5814
  this.waitTimer = util.setTimeout(this, function() {
5817
- _this23.addClass(STATE_CLASS.LOADING);
5818
- _this23.emit(LOADING);
5819
- util.clearTimeout(_this23, _this23.waitTimer);
5820
- _this23.waitTimer = null;
5815
+ _this22.addClass(STATE_CLASS.LOADING);
5816
+ _this22.emit(LOADING);
5817
+ util.clearTimeout(_this22, _this22.waitTimer);
5818
+ _this22.waitTimer = null;
5821
5819
  }, this.config.minWaitDelay);
5822
5820
  }
5823
5821
  }, {
5824
5822
  key: "onPlaying",
5825
5823
  value: function onPlaying() {
5826
- var _this24 = this;
5824
+ var _this23 = this;
5827
5825
  this.isError = false;
5828
5826
  var NO_START = STATE_CLASS.NO_START, PAUSED = STATE_CLASS.PAUSED, ENDED2 = STATE_CLASS.ENDED, ERROR2 = STATE_CLASS.ERROR, REPLAY2 = STATE_CLASS.REPLAY, LOADING2 = STATE_CLASS.LOADING;
5829
5827
  var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
5830
5828
  clsList.forEach(function(cls) {
5831
- _this24.removeClass(cls);
5829
+ _this23.removeClass(cls);
5832
5830
  });
5833
5831
  if (!this._accPlayed.t && !this.paused && !this.ended) {
5834
5832
  this._accPlayed.t = (/* @__PURE__ */ new Date()).getTime();
@@ -5989,14 +5987,14 @@ var __publicField = (obj, key, value) => {
5989
5987
  }, {
5990
5988
  key: "setConfig",
5991
5989
  value: function setConfig(config) {
5992
- var _this25 = this;
5990
+ var _this24 = this;
5993
5991
  if (!config) {
5994
5992
  return;
5995
5993
  }
5996
5994
  Object.keys(config).map(function(key) {
5997
5995
  if (key !== "plugins") {
5998
- _this25.config[key] = config[key];
5999
- var plugin = _this25.plugins[key.toLowerCase()];
5996
+ _this24.config[key] = config[key];
5997
+ var plugin = _this24.plugins[key.toLowerCase()];
6000
5998
  if (plugin && util.typeOf(plugin.setConfig) === "Function") {
6001
5999
  plugin.setConfig(config[key]);
6002
6000
  }
@@ -6006,20 +6004,20 @@ var __publicField = (obj, key, value) => {
6006
6004
  }, {
6007
6005
  key: "playNext",
6008
6006
  value: function playNext(config) {
6009
- var _this26 = this;
6007
+ var _this25 = this;
6010
6008
  this.resetState();
6011
6009
  this.setConfig(config);
6012
6010
  this._currentTime = 0;
6013
6011
  this._duration = 0;
6014
6012
  runHooks(this, "playnext", function() {
6015
- _this26.start();
6016
- _this26.emit(PLAYNEXT, config);
6013
+ _this25.start();
6014
+ _this25.emit(PLAYNEXT, config);
6017
6015
  });
6018
6016
  }
6019
6017
  }, {
6020
6018
  key: "resize",
6021
6019
  value: function resize() {
6022
- var _this27 = this;
6020
+ var _this26 = this;
6023
6021
  if (!this.media) {
6024
6022
  return;
6025
6023
  }
@@ -6059,7 +6057,7 @@ var __publicField = (obj, key, value) => {
6059
6057
  }
6060
6058
  if (!this.fullscreen && !this.cssfullscreen) {
6061
6059
  Object.keys(_style).forEach(function(key) {
6062
- _this27.root.style[key] = _style[key];
6060
+ _this26.root.style[key] = _style[key];
6063
6061
  });
6064
6062
  }
6065
6063
  if (videoFillMode === "fillHeight" && fit < videoFit || videoFillMode === "fillWidth" && fit > videoFit) {
@@ -6101,14 +6099,6 @@ var __publicField = (obj, key, value) => {
6101
6099
  url
6102
6100
  };
6103
6101
  }
6104
- }, {
6105
- key: "_seekToStartTime",
6106
- value: function _seekToStartTime() {
6107
- if (this.__startTime > 0 && this.duration > 0) {
6108
- this.currentTime = this.__startTime > this.duration ? this.duration : this.__startTime;
6109
- this.__startTime = -1;
6110
- }
6111
- }
6112
6102
  }, {
6113
6103
  key: "state",
6114
6104
  get: function get() {
@@ -6159,15 +6149,15 @@ var __publicField = (obj, key, value) => {
6159
6149
  return this.config.definition.list || [];
6160
6150
  },
6161
6151
  set: function set(list) {
6162
- var _this28 = this;
6152
+ var _this27 = this;
6163
6153
  var definition = this.config.definition;
6164
6154
  var curDef = null;
6165
6155
  var targetDef = null;
6166
6156
  definition.list = list;
6167
6157
  this.emit("resourceReady", list);
6168
6158
  list.forEach(function(item) {
6169
- var _this28$curDefinition;
6170
- if (((_this28$curDefinition = _this28.curDefinition) === null || _this28$curDefinition === void 0 ? void 0 : _this28$curDefinition.definition) === item.definition) {
6159
+ var _this27$curDefinition;
6160
+ if (((_this27$curDefinition = _this27.curDefinition) === null || _this27$curDefinition === void 0 ? void 0 : _this27$curDefinition.definition) === item.definition) {
6171
6161
  curDef = item;
6172
6162
  }
6173
6163
  if (definition.defaultDefinition === item.definition) {
@@ -8425,7 +8415,7 @@ var __publicField = (obj, key, value) => {
8425
8415
  }
8426
8416
  this.on(DURATION_CHANGE, function() {
8427
8417
  var player2 = _this2.player, config2 = _this2.config;
8428
- if (player2.duration > 0 && player2.duration * 1e3 < config2.moveDuration) {
8418
+ if (player2.duration * 1e3 < config2.moveDuration) {
8429
8419
  config2.moveDuration = player2.duration * 1e3;
8430
8420
  }
8431
8421
  });
@@ -8739,13 +8729,10 @@ var __publicField = (obj, key, value) => {
8739
8729
  }, {
8740
8730
  key: "updateBrightness",
8741
8731
  value: function updateBrightness(percent) {
8742
- var pos = this.pos, config = this.config, xgMask = this.xgMask;
8743
- if (!config.darkness) {
8744
- return;
8745
- }
8746
8732
  if (this.player.rotateDeg) {
8747
8733
  percent = -percent;
8748
8734
  }
8735
+ var pos = this.pos, config = this.config, xgMask = this.xgMask;
8749
8736
  var light = pos.light + 0.8 * percent;
8750
8737
  light = light > config.maxDarkness ? config.maxDarkness : light < 0 ? 0 : light;
8751
8738
  if (xgMask) {
@@ -13597,7 +13584,7 @@ var __publicField = (obj, key, value) => {
13597
13584
  * @returns
13598
13585
  */
13599
13586
  get playerVersion() {
13600
- return "2.4.1-rc.1";
13587
+ return "2.4.2-rc.0";
13601
13588
  }
13602
13589
  /** {zh}
13603
13590
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。