@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.
@@ -1307,7 +1307,7 @@ var VERSION_REG = {
1307
1307
  android: /(Android)\s([\d.]+)/,
1308
1308
  ios: /(Version)\/([\d.]+)/
1309
1309
  };
1310
- 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"];
1310
+ 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"];
1311
1311
  var sniffer = {
1312
1312
  get device() {
1313
1313
  var r = sniffer.os;
@@ -1452,7 +1452,7 @@ var sniffer = {
1452
1452
  }
1453
1453
  }
1454
1454
  };
1455
- var version = "3.0.19-rc.0";
1455
+ var version = "3.0.20-rc.3";
1456
1456
  var ERROR_TYPE_MAP = {
1457
1457
  1: "media",
1458
1458
  2: "media",
@@ -3412,7 +3412,7 @@ var ResizeObserver = /* @__PURE__ */ function() {
3412
3412
  if (!this.observer) {
3413
3413
  return;
3414
3414
  }
3415
- this.observer && this.observer.observe(target);
3415
+ this.observer.observe(target);
3416
3416
  var _pid = target.getAttribute(PLATER_ID);
3417
3417
  var __handlers = this.__handlers;
3418
3418
  var index = -1;
@@ -3441,16 +3441,17 @@ var ResizeObserver = /* @__PURE__ */ function() {
3441
3441
  }
3442
3442
  });
3443
3443
  try {
3444
- this.observer && this.observer.unobserve(target);
3444
+ var _this$observer;
3445
+ (_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.unobserve(target);
3445
3446
  } catch (e) {
3446
3447
  }
3447
- this.observer && this.observer.unobserve(target);
3448
3448
  i > -1 && this.__handlers.splice(i, 1);
3449
3449
  }
3450
3450
  }, {
3451
3451
  key: "destroyObserver",
3452
3452
  value: function destroyObserver() {
3453
- this.observer && this.observer.disconnect();
3453
+ var _this$observer2;
3454
+ (_this$observer2 = this.observer) === null || _this$observer2 === void 0 ? void 0 : _this$observer2.disconnect();
3454
3455
  this.observer = null;
3455
3456
  this.__handlers = null;
3456
3457
  }
@@ -3482,7 +3483,8 @@ function addObserver(target, handler) {
3482
3483
  return resizeObserver;
3483
3484
  }
3484
3485
  function unObserver(target, handler) {
3485
- resizeObserver.unObserver(target, handler);
3486
+ var _resizeObserver;
3487
+ (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.unObserver(target, handler);
3486
3488
  }
3487
3489
  var pluginsManager = {
3488
3490
  pluginGroup: {},
@@ -4480,10 +4482,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4480
4482
  }
4481
4483
  var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4482
4484
  XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
4483
- if (_this.__startTime > 0 && _this.duration > 0) {
4484
- _this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
4485
- _this.__startTime = -1;
4486
- }
4485
+ _this._seekToStartTime();
4487
4486
  _this.playbackRate = defaultPlaybackRate;
4488
4487
  (autoplay2 || _this._useAutoplay) && _this.mediaPlay();
4489
4488
  _this.off(CANPLAY, _this.canPlayFunc);
@@ -5105,10 +5104,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5105
5104
  reject(e);
5106
5105
  };
5107
5106
  var _canplay = function _canplay2() {
5108
- if (_this9.duration > 0 && _this9.__startTime > 0) {
5109
- _this9.currentTime = _this9.__startTime;
5110
- _this9.__startTime = -1;
5111
- }
5107
+ _this9._seekToStartTime();
5112
5108
  if (isPaused) {
5113
5109
  _this9.pause();
5114
5110
  }
@@ -5729,11 +5725,17 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5729
5725
  }, {
5730
5726
  key: "onLoadeddata",
5731
5727
  value: function onLoadeddata() {
5728
+ var _this22 = this;
5732
5729
  this.isError = false;
5733
5730
  this.isSeeking = false;
5734
- if (this.__startTime > 0 && this.duration > 0) {
5735
- this.currentTime = this.__startTime;
5736
- this.__startTime = -1;
5731
+ if (this.__startTime > 0) {
5732
+ if (this.duration > 0) {
5733
+ this._seekToStartTime();
5734
+ } else {
5735
+ this.once(DURATION_CHANGE, function() {
5736
+ _this22._seekToStartTime();
5737
+ });
5738
+ }
5737
5739
  }
5738
5740
  }
5739
5741
  }, {
@@ -5802,27 +5804,27 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5802
5804
  }, {
5803
5805
  key: "onWaiting",
5804
5806
  value: function onWaiting() {
5805
- var _this22 = this;
5807
+ var _this23 = this;
5806
5808
  if (this.waitTimer) {
5807
5809
  util.clearTimeout(this, this.waitTimer);
5808
5810
  }
5809
5811
  this.updateAcc("waiting");
5810
5812
  this.waitTimer = util.setTimeout(this, function() {
5811
- _this22.addClass(STATE_CLASS.LOADING);
5812
- _this22.emit(LOADING);
5813
- util.clearTimeout(_this22, _this22.waitTimer);
5814
- _this22.waitTimer = null;
5813
+ _this23.addClass(STATE_CLASS.LOADING);
5814
+ _this23.emit(LOADING);
5815
+ util.clearTimeout(_this23, _this23.waitTimer);
5816
+ _this23.waitTimer = null;
5815
5817
  }, this.config.minWaitDelay);
5816
5818
  }
5817
5819
  }, {
5818
5820
  key: "onPlaying",
5819
5821
  value: function onPlaying() {
5820
- var _this23 = this;
5822
+ var _this24 = this;
5821
5823
  this.isError = false;
5822
5824
  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;
5823
5825
  var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
5824
5826
  clsList.forEach(function(cls) {
5825
- _this23.removeClass(cls);
5827
+ _this24.removeClass(cls);
5826
5828
  });
5827
5829
  if (!this._accPlayed.t && !this.paused && !this.ended) {
5828
5830
  this._accPlayed.t = (/* @__PURE__ */ new Date()).getTime();
@@ -5983,14 +5985,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5983
5985
  }, {
5984
5986
  key: "setConfig",
5985
5987
  value: function setConfig(config) {
5986
- var _this24 = this;
5988
+ var _this25 = this;
5987
5989
  if (!config) {
5988
5990
  return;
5989
5991
  }
5990
5992
  Object.keys(config).map(function(key) {
5991
5993
  if (key !== "plugins") {
5992
- _this24.config[key] = config[key];
5993
- var plugin = _this24.plugins[key.toLowerCase()];
5994
+ _this25.config[key] = config[key];
5995
+ var plugin = _this25.plugins[key.toLowerCase()];
5994
5996
  if (plugin && util.typeOf(plugin.setConfig) === "Function") {
5995
5997
  plugin.setConfig(config[key]);
5996
5998
  }
@@ -6000,20 +6002,20 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6000
6002
  }, {
6001
6003
  key: "playNext",
6002
6004
  value: function playNext(config) {
6003
- var _this25 = this;
6005
+ var _this26 = this;
6004
6006
  this.resetState();
6005
6007
  this.setConfig(config);
6006
6008
  this._currentTime = 0;
6007
6009
  this._duration = 0;
6008
6010
  runHooks(this, "playnext", function() {
6009
- _this25.start();
6010
- _this25.emit(PLAYNEXT, config);
6011
+ _this26.start();
6012
+ _this26.emit(PLAYNEXT, config);
6011
6013
  });
6012
6014
  }
6013
6015
  }, {
6014
6016
  key: "resize",
6015
6017
  value: function resize() {
6016
- var _this26 = this;
6018
+ var _this27 = this;
6017
6019
  if (!this.media) {
6018
6020
  return;
6019
6021
  }
@@ -6053,7 +6055,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6053
6055
  }
6054
6056
  if (!this.fullscreen && !this.cssfullscreen) {
6055
6057
  Object.keys(_style).forEach(function(key) {
6056
- _this26.root.style[key] = _style[key];
6058
+ _this27.root.style[key] = _style[key];
6057
6059
  });
6058
6060
  }
6059
6061
  if (videoFillMode === "fillHeight" && fit < videoFit || videoFillMode === "fillWidth" && fit > videoFit) {
@@ -6095,6 +6097,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6095
6097
  url
6096
6098
  };
6097
6099
  }
6100
+ }, {
6101
+ key: "_seekToStartTime",
6102
+ value: function _seekToStartTime() {
6103
+ if (this.__startTime > 0 && this.duration > 0) {
6104
+ this.currentTime = this.__startTime > this.duration ? this.duration : this.__startTime;
6105
+ this.__startTime = -1;
6106
+ }
6107
+ }
6098
6108
  }, {
6099
6109
  key: "state",
6100
6110
  get: function get() {
@@ -6145,15 +6155,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6145
6155
  return this.config.definition.list || [];
6146
6156
  },
6147
6157
  set: function set(list) {
6148
- var _this27 = this;
6158
+ var _this28 = this;
6149
6159
  var definition = this.config.definition;
6150
6160
  var curDef = null;
6151
6161
  var targetDef = null;
6152
6162
  definition.list = list;
6153
6163
  this.emit("resourceReady", list);
6154
6164
  list.forEach(function(item) {
6155
- var _this27$curDefinition;
6156
- if (((_this27$curDefinition = _this27.curDefinition) === null || _this27$curDefinition === void 0 ? void 0 : _this27$curDefinition.definition) === item.definition) {
6165
+ var _this28$curDefinition;
6166
+ if (((_this28$curDefinition = _this28.curDefinition) === null || _this28$curDefinition === void 0 ? void 0 : _this28$curDefinition.definition) === item.definition) {
6157
6167
  curDef = item;
6158
6168
  }
6159
6169
  if (definition.defaultDefinition === item.definition) {
@@ -8411,7 +8421,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8411
8421
  }
8412
8422
  this.on(DURATION_CHANGE, function() {
8413
8423
  var player2 = _this2.player, config2 = _this2.config;
8414
- if (player2.duration * 1e3 < config2.moveDuration) {
8424
+ if (player2.duration > 0 && player2.duration * 1e3 < config2.moveDuration) {
8415
8425
  config2.moveDuration = player2.duration * 1e3;
8416
8426
  }
8417
8427
  });
@@ -8725,10 +8735,13 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8725
8735
  }, {
8726
8736
  key: "updateBrightness",
8727
8737
  value: function updateBrightness(percent) {
8738
+ var pos = this.pos, config = this.config, xgMask = this.xgMask;
8739
+ if (!config.darkness) {
8740
+ return;
8741
+ }
8728
8742
  if (this.player.rotateDeg) {
8729
8743
  percent = -percent;
8730
8744
  }
8731
- var pos = this.pos, config = this.config, xgMask = this.xgMask;
8732
8745
  var light = pos.light + 0.8 * percent;
8733
8746
  light = light > config.maxDarkness ? config.maxDarkness : light < 0 ? 0 : light;
8734
8747
  if (xgMask) {
@@ -13580,7 +13593,7 @@ class VePlayerBase {
13580
13593
  * @returns
13581
13594
  */
13582
13595
  get playerVersion() {
13583
- return "2.4.0";
13596
+ return "2.4.1-rc.1";
13584
13597
  }
13585
13598
  /** {zh}
13586
13599
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。