@volcengine/veplayer 2.4.2-rc.2 → 2.4.3-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", "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.6";
1456
1456
  var ERROR_TYPE_MAP = {
1457
1457
  1: "media",
1458
1458
  2: "media",
@@ -2422,8 +2422,7 @@ function hook(hookName, handler) {
2422
2422
  }
2423
2423
  if (this.__hooks && this.__hooks[hookName]) {
2424
2424
  try {
2425
- var _this$__hooks$hookNam;
2426
- var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
2425
+ var preRet = runHooks(this, hookName, handler);
2427
2426
  if (preRet) {
2428
2427
  if (preRet.then) {
2429
2428
  preRet.then(function(isContinue) {
@@ -2448,6 +2447,19 @@ function hook(hookName, handler) {
2448
2447
  }
2449
2448
  }.bind(this);
2450
2449
  }
2450
+ function findHookIndex(hookName, handler) {
2451
+ var __hooks = this.__hooks;
2452
+ if (!__hooks || !Array.isArray(__hooks[hookName])) {
2453
+ return -1;
2454
+ }
2455
+ var hookHandlers = __hooks[hookName];
2456
+ for (var i = 0; i < hookHandlers.length; i++) {
2457
+ if (hookHandlers[i] === handler) {
2458
+ return i;
2459
+ }
2460
+ }
2461
+ return -1;
2462
+ }
2451
2463
  function useHooks(hookName, handler) {
2452
2464
  var __hooks = this.__hooks;
2453
2465
  if (!__hooks) {
@@ -2457,7 +2469,12 @@ function useHooks(hookName, handler) {
2457
2469
  console.warn("has no supported hook which name [".concat(hookName, "]"));
2458
2470
  return false;
2459
2471
  }
2460
- __hooks && (__hooks[hookName] = handler);
2472
+ if (!Array.isArray(__hooks[hookName])) {
2473
+ __hooks[hookName] = [];
2474
+ }
2475
+ if (findHookIndex.call(this, hookName, handler) === -1) {
2476
+ __hooks[hookName].push(handler);
2477
+ }
2461
2478
  return true;
2462
2479
  }
2463
2480
  function removeHooks(hookName, handler) {
@@ -2465,6 +2482,13 @@ function removeHooks(hookName, handler) {
2465
2482
  if (!__hooks) {
2466
2483
  return;
2467
2484
  }
2485
+ if (Array.isArray(__hooks[hookName])) {
2486
+ var hooks = __hooks[hookName];
2487
+ var index = findHookIndex.call(this, hookName, handler);
2488
+ if (index !== -1) {
2489
+ hooks.splice(index, 1);
2490
+ }
2491
+ }
2468
2492
  delete __hooks[hookName];
2469
2493
  }
2470
2494
  function usePluginHooks(pluginName) {
@@ -2512,18 +2536,30 @@ function runHooks(obj, hookName, handler) {
2512
2536
  for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
2513
2537
  args[_key5 - 3] = arguments[_key5];
2514
2538
  }
2515
- if (obj.__hooks && obj.__hooks[hookName]) {
2516
- var _obj$__hooks$hookName;
2517
- var ret = (_obj$__hooks$hookName = obj.__hooks[hookName]).call.apply(_obj$__hooks$hookName, [obj, obj].concat(args));
2518
- if (ret && ret.then) {
2519
- ret.then(function(data) {
2520
- return data === false ? null : handler.call.apply(handler, [obj, obj].concat(args));
2521
- }).catch(function(e) {
2522
- console.warn("[runHooks]".concat(hookName, " reject"), e.message);
2523
- });
2524
- } else if (ret !== false) {
2525
- return handler.call.apply(handler, [obj, obj].concat(args));
2526
- }
2539
+ if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
2540
+ var hooks = obj.__hooks[hookName];
2541
+ var index = -1;
2542
+ var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
2543
+ for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
2544
+ args2[_key6 - 3] = arguments[_key6];
2545
+ }
2546
+ index++;
2547
+ if (hooks.length === 0 || index === hooks.length) {
2548
+ return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
2549
+ }
2550
+ var hook2 = hooks[index];
2551
+ var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
2552
+ if (ret && ret.then) {
2553
+ return ret.then(function(data) {
2554
+ return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
2555
+ }).catch(function(e) {
2556
+ console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
2557
+ });
2558
+ } else if (ret !== false) {
2559
+ return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
2560
+ }
2561
+ };
2562
+ return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
2527
2563
  } else {
2528
2564
  return handler.call.apply(handler, [obj, obj].concat(args));
2529
2565
  }
@@ -2767,6 +2803,18 @@ var BasePlugin = /* @__PURE__ */ function() {
2767
2803
  }
2768
2804
  }
2769
2805
  }
2806
+ }, {
2807
+ key: "defineMethod",
2808
+ value: function defineMethod(Obj, map) {
2809
+ for (var key in map) {
2810
+ if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
2811
+ Object.defineProperty(Obj, key, {
2812
+ configurable: true,
2813
+ value: map[key]
2814
+ });
2815
+ }
2816
+ }
2817
+ }
2770
2818
  }, {
2771
2819
  key: "defaultConfig",
2772
2820
  get: function get() {
@@ -3412,7 +3460,7 @@ var ResizeObserver = /* @__PURE__ */ function() {
3412
3460
  if (!this.observer) {
3413
3461
  return;
3414
3462
  }
3415
- this.observer && this.observer.observe(target);
3463
+ this.observer.observe(target);
3416
3464
  var _pid = target.getAttribute(PLATER_ID);
3417
3465
  var __handlers = this.__handlers;
3418
3466
  var index = -1;
@@ -3441,16 +3489,17 @@ var ResizeObserver = /* @__PURE__ */ function() {
3441
3489
  }
3442
3490
  });
3443
3491
  try {
3444
- this.observer && this.observer.unobserve(target);
3492
+ var _this$observer;
3493
+ (_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.unobserve(target);
3445
3494
  } catch (e) {
3446
3495
  }
3447
- this.observer && this.observer.unobserve(target);
3448
3496
  i > -1 && this.__handlers.splice(i, 1);
3449
3497
  }
3450
3498
  }, {
3451
3499
  key: "destroyObserver",
3452
3500
  value: function destroyObserver() {
3453
- this.observer && this.observer.disconnect();
3501
+ var _this$observer2;
3502
+ (_this$observer2 = this.observer) === null || _this$observer2 === void 0 ? void 0 : _this$observer2.disconnect();
3454
3503
  this.observer = null;
3455
3504
  this.__handlers = null;
3456
3505
  }
@@ -3482,7 +3531,8 @@ function addObserver(target, handler) {
3482
3531
  return resizeObserver;
3483
3532
  }
3484
3533
  function unObserver(target, handler) {
3485
- resizeObserver.unObserver(target, handler);
3534
+ var _resizeObserver;
3535
+ (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.unObserver(target, handler);
3486
3536
  }
3487
3537
  var pluginsManager = {
3488
3538
  pluginGroup: {},
@@ -4480,10 +4530,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4480
4530
  }
4481
4531
  var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4482
4532
  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
- }
4533
+ _this._seekToStartTime();
4487
4534
  _this.playbackRate = defaultPlaybackRate;
4488
4535
  (autoplay2 || _this._useAutoplay) && _this.mediaPlay();
4489
4536
  _this.off(CANPLAY, _this.canPlayFunc);
@@ -4573,6 +4620,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4573
4620
  _this.waitTimer = null;
4574
4621
  _this.handleSource = true;
4575
4622
  _this._state = STATES.INITIAL;
4623
+ _this.isAd = false;
4576
4624
  _this.isError = false;
4577
4625
  _this._hasStart = false;
4578
4626
  _this.isSeeking = false;
@@ -4957,7 +5005,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4957
5005
  _pConfig.position && (options.position = _pConfig.position);
4958
5006
  var position = options.position ? options.position : options.config && options.config.position || PLUFGIN.defaultConfig && PLUFGIN.defaultConfig.position;
4959
5007
  if (!options.root && typeof position === "string" && position.indexOf("controls") > -1) {
4960
- return this.controls && this.controls.registerPlugin(PLUFGIN, options, PLUFGIN.pluginName);
5008
+ var _this$controls;
5009
+ return (_this$controls = this.controls) === null || _this$controls === void 0 ? void 0 : _this$controls.registerPlugin(PLUFGIN, options, PLUFGIN.pluginName);
4961
5010
  }
4962
5011
  if (!options.root) {
4963
5012
  options.root = this._getRootByPosition(position);
@@ -5105,10 +5154,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5105
5154
  reject(e);
5106
5155
  };
5107
5156
  var _canplay = function _canplay2() {
5108
- if (_this9.duration > 0 && _this9.__startTime > 0) {
5109
- _this9.currentTime = _this9.__startTime;
5110
- _this9.__startTime = -1;
5111
- }
5157
+ _this9._seekToStartTime();
5112
5158
  if (isPaused) {
5113
5159
  _this9.pause();
5114
5160
  }
@@ -5729,11 +5775,17 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5729
5775
  }, {
5730
5776
  key: "onLoadeddata",
5731
5777
  value: function onLoadeddata() {
5778
+ var _this22 = this;
5732
5779
  this.isError = false;
5733
5780
  this.isSeeking = false;
5734
- if (this.__startTime > 0 && this.duration > 0) {
5735
- this.currentTime = this.__startTime;
5736
- this.__startTime = -1;
5781
+ if (this.__startTime > 0) {
5782
+ if (this.duration > 0) {
5783
+ this._seekToStartTime();
5784
+ } else {
5785
+ this.once(DURATION_CHANGE, function() {
5786
+ _this22._seekToStartTime();
5787
+ });
5788
+ }
5737
5789
  }
5738
5790
  }
5739
5791
  }, {
@@ -5802,27 +5854,27 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5802
5854
  }, {
5803
5855
  key: "onWaiting",
5804
5856
  value: function onWaiting() {
5805
- var _this22 = this;
5857
+ var _this23 = this;
5806
5858
  if (this.waitTimer) {
5807
5859
  util.clearTimeout(this, this.waitTimer);
5808
5860
  }
5809
5861
  this.updateAcc("waiting");
5810
5862
  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;
5863
+ _this23.addClass(STATE_CLASS.LOADING);
5864
+ _this23.emit(LOADING);
5865
+ util.clearTimeout(_this23, _this23.waitTimer);
5866
+ _this23.waitTimer = null;
5815
5867
  }, this.config.minWaitDelay);
5816
5868
  }
5817
5869
  }, {
5818
5870
  key: "onPlaying",
5819
5871
  value: function onPlaying() {
5820
- var _this23 = this;
5872
+ var _this24 = this;
5821
5873
  this.isError = false;
5822
5874
  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
5875
  var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
5824
5876
  clsList.forEach(function(cls) {
5825
- _this23.removeClass(cls);
5877
+ _this24.removeClass(cls);
5826
5878
  });
5827
5879
  if (!this._accPlayed.t && !this.paused && !this.ended) {
5828
5880
  this._accPlayed.t = (/* @__PURE__ */ new Date()).getTime();
@@ -5983,14 +6035,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5983
6035
  }, {
5984
6036
  key: "setConfig",
5985
6037
  value: function setConfig(config) {
5986
- var _this24 = this;
6038
+ var _this25 = this;
5987
6039
  if (!config) {
5988
6040
  return;
5989
6041
  }
5990
6042
  Object.keys(config).map(function(key) {
5991
6043
  if (key !== "plugins") {
5992
- _this24.config[key] = config[key];
5993
- var plugin = _this24.plugins[key.toLowerCase()];
6044
+ _this25.config[key] = config[key];
6045
+ var plugin = _this25.plugins[key.toLowerCase()];
5994
6046
  if (plugin && util.typeOf(plugin.setConfig) === "Function") {
5995
6047
  plugin.setConfig(config[key]);
5996
6048
  }
@@ -6000,20 +6052,20 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6000
6052
  }, {
6001
6053
  key: "playNext",
6002
6054
  value: function playNext(config) {
6003
- var _this25 = this;
6055
+ var _this26 = this;
6004
6056
  this.resetState();
6005
6057
  this.setConfig(config);
6006
6058
  this._currentTime = 0;
6007
6059
  this._duration = 0;
6008
6060
  runHooks(this, "playnext", function() {
6009
- _this25.start();
6010
- _this25.emit(PLAYNEXT, config);
6061
+ _this26.start();
6062
+ _this26.emit(PLAYNEXT, config);
6011
6063
  });
6012
6064
  }
6013
6065
  }, {
6014
6066
  key: "resize",
6015
6067
  value: function resize() {
6016
- var _this26 = this;
6068
+ var _this27 = this;
6017
6069
  if (!this.media) {
6018
6070
  return;
6019
6071
  }
@@ -6053,7 +6105,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6053
6105
  }
6054
6106
  if (!this.fullscreen && !this.cssfullscreen) {
6055
6107
  Object.keys(_style).forEach(function(key) {
6056
- _this26.root.style[key] = _style[key];
6108
+ _this27.root.style[key] = _style[key];
6057
6109
  });
6058
6110
  }
6059
6111
  if (videoFillMode === "fillHeight" && fit < videoFit || videoFillMode === "fillWidth" && fit > videoFit) {
@@ -6095,6 +6147,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6095
6147
  url
6096
6148
  };
6097
6149
  }
6150
+ }, {
6151
+ key: "_seekToStartTime",
6152
+ value: function _seekToStartTime() {
6153
+ if (this.__startTime > 0 && this.duration > 0) {
6154
+ this.currentTime = this.__startTime > this.duration ? this.duration : this.__startTime;
6155
+ this.__startTime = -1;
6156
+ }
6157
+ }
6098
6158
  }, {
6099
6159
  key: "state",
6100
6160
  get: function get() {
@@ -6145,15 +6205,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6145
6205
  return this.config.definition.list || [];
6146
6206
  },
6147
6207
  set: function set(list) {
6148
- var _this27 = this;
6208
+ var _this28 = this;
6149
6209
  var definition = this.config.definition;
6150
6210
  var curDef = null;
6151
6211
  var targetDef = null;
6152
6212
  definition.list = list;
6153
6213
  this.emit("resourceReady", list);
6154
6214
  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) {
6215
+ var _this28$curDefinition;
6216
+ if (((_this28$curDefinition = _this28.curDefinition) === null || _this28$curDefinition === void 0 ? void 0 : _this28$curDefinition.definition) === item.definition) {
6157
6217
  curDef = item;
6158
6218
  }
6159
6219
  if (definition.defaultDefinition === item.definition) {
@@ -6890,7 +6950,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6890
6950
  var className = _this.config.mode === "auto" ? "auto-hide" : "hide";
6891
6951
  util.addClass(_this.root, className);
6892
6952
  _this.autoPlayStart = true;
6893
- _this.onPlayPause("play");
6953
+ _this.toggleTo("play");
6894
6954
  });
6895
6955
  _this.autoPlayStart = false;
6896
6956
  return _this;
@@ -6898,9 +6958,19 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6898
6958
  _createClass(Start2, [{
6899
6959
  key: "afterCreate",
6900
6960
  value: function afterCreate() {
6961
+ var playerConfig = this.playerConfig;
6962
+ this.initIcons();
6963
+ this.listenEvents();
6964
+ this.bindClickEvents();
6965
+ if (!playerConfig.autoplay) {
6966
+ this.show();
6967
+ }
6968
+ }
6969
+ }, {
6970
+ key: "listenEvents",
6971
+ value: function listenEvents() {
6901
6972
  var _this2 = this;
6902
6973
  var player = this.player, playerConfig = this.playerConfig;
6903
- this.initIcons();
6904
6974
  this.once(READY, function() {
6905
6975
  if (playerConfig) {
6906
6976
  if (playerConfig.lang && playerConfig.lang === "en") {
@@ -6911,9 +6981,6 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6911
6981
  }
6912
6982
  });
6913
6983
  this.on(AUTOPLAY_STARTED, this.onAutoplayStart);
6914
- if (!playerConfig.autoplay) {
6915
- this.show();
6916
- }
6917
6984
  this.on(AUTOPLAY_PREVENTED, function() {
6918
6985
  var className = _this2.config.mode === "auto" ? "auto-hide" : "hide";
6919
6986
  _this2.setAttr("data-state", "play");
@@ -6921,20 +6988,25 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6921
6988
  _this2.show();
6922
6989
  });
6923
6990
  this.on(PLAY, function() {
6924
- _this2.onPlayPause("play");
6991
+ _this2.toggleTo("play");
6925
6992
  });
6926
6993
  this.on(PAUSE, function() {
6927
- _this2.onPlayPause("pause");
6994
+ _this2.toggleTo("pause");
6928
6995
  });
6929
6996
  this.on(RESET, function() {
6930
6997
  _this2.onPlayerReset();
6931
6998
  });
6999
+ }
7000
+ }, {
7001
+ key: "bindClickEvents",
7002
+ value: function bindClickEvents() {
7003
+ var _this3 = this;
6932
7004
  this.clickHandler = this.hook("startClick", this.switchPausePlay, {
6933
7005
  pre: function pre(e) {
6934
7006
  e.cancelable && e.preventDefault();
6935
7007
  e.stopPropagation();
6936
- var paused = _this2.player.paused;
6937
- _this2.emitUserAction(e, "switch_play_pause", {
7008
+ var paused = _this3.player.paused;
7009
+ _this3.emitUserAction(e, "switch_play_pause", {
6938
7010
  props: "paused",
6939
7011
  from: paused,
6940
7012
  to: !paused
@@ -6996,17 +7068,17 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6996
7068
  }, {
6997
7069
  key: "animate",
6998
7070
  value: function animate(endShow) {
6999
- var _this3 = this;
7071
+ var _this4 = this;
7000
7072
  this._animateId = addAnimate("pauseplay", 400, {
7001
7073
  start: function start() {
7002
- util.addClass(_this3.root, "interact");
7003
- _this3.show();
7004
- _this3.switchStatus(true);
7074
+ util.addClass(_this4.root, "interact");
7075
+ _this4.show();
7076
+ _this4.switchStatus(true);
7005
7077
  },
7006
7078
  end: function end() {
7007
- util.removeClass(_this3.root, "interact");
7008
- !endShow && _this3.hide();
7009
- _this3._animateId = null;
7079
+ util.removeClass(_this4.root, "interact");
7080
+ !endShow && _this4.hide();
7081
+ _this4._animateId = null;
7010
7082
  }
7011
7083
  });
7012
7084
  }
@@ -7036,6 +7108,11 @@ var Start = /* @__PURE__ */ function(_Plugin) {
7036
7108
  }, {
7037
7109
  key: "onPlayPause",
7038
7110
  value: function onPlayPause(status) {
7111
+ this.toggleTo(status);
7112
+ }
7113
+ }, {
7114
+ key: "toggleTo",
7115
+ value: function toggleTo(status) {
7039
7116
  var config = this.config, player = this.player;
7040
7117
  if (!player || player.state < STATES.RUNNING || !this.autoPlayStart) {
7041
7118
  return;
@@ -8411,7 +8488,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8411
8488
  }
8412
8489
  this.on(DURATION_CHANGE, function() {
8413
8490
  var player2 = _this2.player, config2 = _this2.config;
8414
- if (player2.duration * 1e3 < config2.moveDuration) {
8491
+ if (player2.duration > 0 && player2.duration * 1e3 < config2.moveDuration) {
8415
8492
  config2.moveDuration = player2.duration * 1e3;
8416
8493
  }
8417
8494
  });
@@ -8725,10 +8802,13 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8725
8802
  }, {
8726
8803
  key: "updateBrightness",
8727
8804
  value: function updateBrightness(percent) {
8805
+ var pos = this.pos, config = this.config, xgMask = this.xgMask;
8806
+ if (!config.darkness) {
8807
+ return;
8808
+ }
8728
8809
  if (this.player.rotateDeg) {
8729
8810
  percent = -percent;
8730
8811
  }
8731
- var pos = this.pos, config = this.config, xgMask = this.xgMask;
8732
8812
  var light = pos.light + 0.8 * percent;
8733
8813
  light = light > config.maxDarkness ? config.maxDarkness : light < 0 ? 0 : light;
8734
8814
  if (xgMask) {
@@ -8789,12 +8869,12 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8789
8869
  }, {
8790
8870
  key: "disableGesture",
8791
8871
  value: function disableGesture() {
8792
- this.config.disableGesture = false;
8872
+ this.config.disableGesture = true;
8793
8873
  }
8794
8874
  }, {
8795
8875
  key: "enableGesture",
8796
8876
  value: function enableGesture() {
8797
- this.config.disableGesture = true;
8877
+ this.config.disableGesture = false;
8798
8878
  }
8799
8879
  }, {
8800
8880
  key: "destroy",
@@ -9366,29 +9446,56 @@ var Play$1 = /* @__PURE__ */ function(_IconPlugin) {
9366
9446
  _inherits(Play2, _IconPlugin);
9367
9447
  var _super = _createSuper(Play2);
9368
9448
  function Play2() {
9449
+ var _this;
9369
9450
  _classCallCheck(this, Play2);
9370
- return _super.apply(this, arguments);
9451
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9452
+ args[_key] = arguments[_key];
9453
+ }
9454
+ _this = _super.call.apply(_super, [this].concat(args));
9455
+ _defineProperty(_assertThisInitialized(_this), "btnClick", function(e) {
9456
+ e.preventDefault();
9457
+ e.stopPropagation();
9458
+ var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player;
9459
+ _this.emitUserAction(e, "switch_play_pause", {
9460
+ prop: "paused",
9461
+ from: player.paused,
9462
+ to: !player.paused
9463
+ });
9464
+ if (player.ended) {
9465
+ player.replay();
9466
+ } else if (player.paused) {
9467
+ player.play();
9468
+ _this.animate(false);
9469
+ } else {
9470
+ player.pause();
9471
+ _this.animate(true);
9472
+ }
9473
+ return false;
9474
+ });
9475
+ return _this;
9371
9476
  }
9372
9477
  _createClass(Play2, [{
9373
9478
  key: "afterCreate",
9374
9479
  value: function afterCreate() {
9375
- var _this = this;
9376
9480
  _get(_getPrototypeOf(Play2.prototype), "afterCreate", this).call(this);
9377
- var player = this.player, config = this.config;
9481
+ var config = this.config;
9378
9482
  if (config.disable) {
9379
9483
  return;
9380
9484
  }
9381
9485
  this.initIcons();
9382
- this.btnClick = this.btnClick.bind(this);
9383
9486
  this.bind(["touchend", "click"], this.btnClick);
9384
- this.on([PAUSE, ERROR, EMPTIED], function() {
9385
- _this.animate(player.paused);
9386
- });
9387
- this.on(PLAY, function() {
9388
- _this.animate(player.paused);
9389
- });
9487
+ this.listenEvents();
9390
9488
  this.animate(true);
9391
9489
  }
9490
+ }, {
9491
+ key: "listenEvents",
9492
+ value: function listenEvents() {
9493
+ var _this2 = this;
9494
+ var player = this.player;
9495
+ this.on([PLAY, PAUSE, ERROR, EMPTIED], function() {
9496
+ _this2.animate(player.paused);
9497
+ });
9498
+ }
9392
9499
  }, {
9393
9500
  key: "registerIcons",
9394
9501
  value: function registerIcons() {
@@ -9403,28 +9510,6 @@ var Play$1 = /* @__PURE__ */ function(_IconPlugin) {
9403
9510
  }
9404
9511
  };
9405
9512
  }
9406
- }, {
9407
- key: "btnClick",
9408
- value: function btnClick(e) {
9409
- e.preventDefault();
9410
- e.stopPropagation();
9411
- var player = this.player;
9412
- this.emitUserAction(e, "switch_play_pause", {
9413
- prop: "paused",
9414
- from: player.paused,
9415
- to: !player.paused
9416
- });
9417
- if (player.ended) {
9418
- player.replay();
9419
- } else if (player.paused) {
9420
- player.play();
9421
- this.animate(false);
9422
- } else {
9423
- player.pause();
9424
- this.animate(true);
9425
- }
9426
- return false;
9427
- }
9428
9513
  }, {
9429
9514
  key: "initIcons",
9430
9515
  value: function initIcons() {
@@ -11467,10 +11552,10 @@ class OptionsIcon extends Plugin {
11467
11552
  const { controls } = this.player;
11468
11553
  const { listType } = this.config;
11469
11554
  if (isActive) {
11470
- listType && MODAL_TYPES.includes(listType) ? controls.blur() : controls.focus();
11555
+ listType && MODAL_TYPES.includes(listType) ? controls == null ? void 0 : controls.blur() : controls == null ? void 0 : controls.focus();
11471
11556
  this.optionsList && this.optionsList.show();
11472
11557
  } else {
11473
- listType && MODAL_TYPES.includes(listType) ? controls.focus() : controls.focusAwhile();
11558
+ listType && MODAL_TYPES.includes(listType) ? controls == null ? void 0 : controls.focus() : controls == null ? void 0 : controls.focusAwhile();
11474
11559
  this.optionsList && this.optionsList.hide();
11475
11560
  }
11476
11561
  this._isActive = isActive;
@@ -13580,7 +13665,7 @@ class VePlayerBase {
13580
13665
  * @returns
13581
13666
  */
13582
13667
  get playerVersion() {
13583
- return "2.4.2-rc.2";
13668
+ return "2.4.3-rc.0";
13584
13669
  }
13585
13670
  /** {zh}
13586
13671
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。