@byteplus/veplayer 2.4.0 → 2.4.1-rc.1

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