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