@volcengine/veplayer 2.4.2-rc.1 → 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.
@@ -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.6";
1460
1460
  var ERROR_TYPE_MAP = {
1461
1461
  1: "media",
1462
1462
  2: "media",
@@ -2426,8 +2426,7 @@ var __publicField = (obj, key, value) => {
2426
2426
  }
2427
2427
  if (this.__hooks && this.__hooks[hookName]) {
2428
2428
  try {
2429
- var _this$__hooks$hookNam;
2430
- var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
2429
+ var preRet = runHooks(this, hookName, handler);
2431
2430
  if (preRet) {
2432
2431
  if (preRet.then) {
2433
2432
  preRet.then(function(isContinue) {
@@ -2452,6 +2451,19 @@ var __publicField = (obj, key, value) => {
2452
2451
  }
2453
2452
  }.bind(this);
2454
2453
  }
2454
+ function findHookIndex(hookName, handler) {
2455
+ var __hooks = this.__hooks;
2456
+ if (!__hooks || !Array.isArray(__hooks[hookName])) {
2457
+ return -1;
2458
+ }
2459
+ var hookHandlers = __hooks[hookName];
2460
+ for (var i = 0; i < hookHandlers.length; i++) {
2461
+ if (hookHandlers[i] === handler) {
2462
+ return i;
2463
+ }
2464
+ }
2465
+ return -1;
2466
+ }
2455
2467
  function useHooks(hookName, handler) {
2456
2468
  var __hooks = this.__hooks;
2457
2469
  if (!__hooks) {
@@ -2461,7 +2473,12 @@ var __publicField = (obj, key, value) => {
2461
2473
  console.warn("has no supported hook which name [".concat(hookName, "]"));
2462
2474
  return false;
2463
2475
  }
2464
- __hooks && (__hooks[hookName] = handler);
2476
+ if (!Array.isArray(__hooks[hookName])) {
2477
+ __hooks[hookName] = [];
2478
+ }
2479
+ if (findHookIndex.call(this, hookName, handler) === -1) {
2480
+ __hooks[hookName].push(handler);
2481
+ }
2465
2482
  return true;
2466
2483
  }
2467
2484
  function removeHooks(hookName, handler) {
@@ -2469,6 +2486,13 @@ var __publicField = (obj, key, value) => {
2469
2486
  if (!__hooks) {
2470
2487
  return;
2471
2488
  }
2489
+ if (Array.isArray(__hooks[hookName])) {
2490
+ var hooks = __hooks[hookName];
2491
+ var index = findHookIndex.call(this, hookName, handler);
2492
+ if (index !== -1) {
2493
+ hooks.splice(index, 1);
2494
+ }
2495
+ }
2472
2496
  delete __hooks[hookName];
2473
2497
  }
2474
2498
  function usePluginHooks(pluginName) {
@@ -2516,18 +2540,30 @@ var __publicField = (obj, key, value) => {
2516
2540
  for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
2517
2541
  args[_key5 - 3] = arguments[_key5];
2518
2542
  }
2519
- if (obj.__hooks && obj.__hooks[hookName]) {
2520
- var _obj$__hooks$hookName;
2521
- var ret = (_obj$__hooks$hookName = obj.__hooks[hookName]).call.apply(_obj$__hooks$hookName, [obj, obj].concat(args));
2522
- if (ret && ret.then) {
2523
- ret.then(function(data) {
2524
- return data === false ? null : handler.call.apply(handler, [obj, obj].concat(args));
2525
- }).catch(function(e) {
2526
- console.warn("[runHooks]".concat(hookName, " reject"), e.message);
2527
- });
2528
- } else if (ret !== false) {
2529
- return handler.call.apply(handler, [obj, obj].concat(args));
2530
- }
2543
+ if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
2544
+ var hooks = obj.__hooks[hookName];
2545
+ var index = -1;
2546
+ var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
2547
+ for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
2548
+ args2[_key6 - 3] = arguments[_key6];
2549
+ }
2550
+ index++;
2551
+ if (hooks.length === 0 || index === hooks.length) {
2552
+ return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
2553
+ }
2554
+ var hook2 = hooks[index];
2555
+ var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
2556
+ if (ret && ret.then) {
2557
+ return ret.then(function(data) {
2558
+ return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
2559
+ }).catch(function(e) {
2560
+ console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
2561
+ });
2562
+ } else if (ret !== false) {
2563
+ return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
2564
+ }
2565
+ };
2566
+ return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
2531
2567
  } else {
2532
2568
  return handler.call.apply(handler, [obj, obj].concat(args));
2533
2569
  }
@@ -2771,6 +2807,18 @@ var __publicField = (obj, key, value) => {
2771
2807
  }
2772
2808
  }
2773
2809
  }
2810
+ }, {
2811
+ key: "defineMethod",
2812
+ value: function defineMethod(Obj, map) {
2813
+ for (var key in map) {
2814
+ if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
2815
+ Object.defineProperty(Obj, key, {
2816
+ configurable: true,
2817
+ value: map[key]
2818
+ });
2819
+ }
2820
+ }
2821
+ }
2774
2822
  }, {
2775
2823
  key: "defaultConfig",
2776
2824
  get: function get() {
@@ -3416,7 +3464,7 @@ var __publicField = (obj, key, value) => {
3416
3464
  if (!this.observer) {
3417
3465
  return;
3418
3466
  }
3419
- this.observer && this.observer.observe(target);
3467
+ this.observer.observe(target);
3420
3468
  var _pid = target.getAttribute(PLATER_ID);
3421
3469
  var __handlers = this.__handlers;
3422
3470
  var index = -1;
@@ -3445,16 +3493,17 @@ var __publicField = (obj, key, value) => {
3445
3493
  }
3446
3494
  });
3447
3495
  try {
3448
- this.observer && this.observer.unobserve(target);
3496
+ var _this$observer;
3497
+ (_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.unobserve(target);
3449
3498
  } catch (e) {
3450
3499
  }
3451
- this.observer && this.observer.unobserve(target);
3452
3500
  i > -1 && this.__handlers.splice(i, 1);
3453
3501
  }
3454
3502
  }, {
3455
3503
  key: "destroyObserver",
3456
3504
  value: function destroyObserver() {
3457
- this.observer && this.observer.disconnect();
3505
+ var _this$observer2;
3506
+ (_this$observer2 = this.observer) === null || _this$observer2 === void 0 ? void 0 : _this$observer2.disconnect();
3458
3507
  this.observer = null;
3459
3508
  this.__handlers = null;
3460
3509
  }
@@ -3486,7 +3535,8 @@ var __publicField = (obj, key, value) => {
3486
3535
  return resizeObserver;
3487
3536
  }
3488
3537
  function unObserver(target, handler) {
3489
- resizeObserver.unObserver(target, handler);
3538
+ var _resizeObserver;
3539
+ (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.unObserver(target, handler);
3490
3540
  }
3491
3541
  var pluginsManager = {
3492
3542
  pluginGroup: {},
@@ -4484,10 +4534,7 @@ var __publicField = (obj, key, value) => {
4484
4534
  }
4485
4535
  var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4486
4536
  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
- }
4537
+ _this._seekToStartTime();
4491
4538
  _this.playbackRate = defaultPlaybackRate;
4492
4539
  (autoplay2 || _this._useAutoplay) && _this.mediaPlay();
4493
4540
  _this.off(CANPLAY, _this.canPlayFunc);
@@ -4577,6 +4624,7 @@ var __publicField = (obj, key, value) => {
4577
4624
  _this.waitTimer = null;
4578
4625
  _this.handleSource = true;
4579
4626
  _this._state = STATES.INITIAL;
4627
+ _this.isAd = false;
4580
4628
  _this.isError = false;
4581
4629
  _this._hasStart = false;
4582
4630
  _this.isSeeking = false;
@@ -4961,7 +5009,8 @@ var __publicField = (obj, key, value) => {
4961
5009
  _pConfig.position && (options.position = _pConfig.position);
4962
5010
  var position = options.position ? options.position : options.config && options.config.position || PLUFGIN.defaultConfig && PLUFGIN.defaultConfig.position;
4963
5011
  if (!options.root && typeof position === "string" && position.indexOf("controls") > -1) {
4964
- return this.controls && this.controls.registerPlugin(PLUFGIN, options, PLUFGIN.pluginName);
5012
+ var _this$controls;
5013
+ return (_this$controls = this.controls) === null || _this$controls === void 0 ? void 0 : _this$controls.registerPlugin(PLUFGIN, options, PLUFGIN.pluginName);
4965
5014
  }
4966
5015
  if (!options.root) {
4967
5016
  options.root = this._getRootByPosition(position);
@@ -5109,10 +5158,7 @@ var __publicField = (obj, key, value) => {
5109
5158
  reject(e);
5110
5159
  };
5111
5160
  var _canplay = function _canplay2() {
5112
- if (_this9.duration > 0 && _this9.__startTime > 0) {
5113
- _this9.currentTime = _this9.__startTime;
5114
- _this9.__startTime = -1;
5115
- }
5161
+ _this9._seekToStartTime();
5116
5162
  if (isPaused) {
5117
5163
  _this9.pause();
5118
5164
  }
@@ -5733,11 +5779,17 @@ var __publicField = (obj, key, value) => {
5733
5779
  }, {
5734
5780
  key: "onLoadeddata",
5735
5781
  value: function onLoadeddata() {
5782
+ var _this22 = this;
5736
5783
  this.isError = false;
5737
5784
  this.isSeeking = false;
5738
- if (this.__startTime > 0 && this.duration > 0) {
5739
- this.currentTime = this.__startTime;
5740
- this.__startTime = -1;
5785
+ if (this.__startTime > 0) {
5786
+ if (this.duration > 0) {
5787
+ this._seekToStartTime();
5788
+ } else {
5789
+ this.once(DURATION_CHANGE, function() {
5790
+ _this22._seekToStartTime();
5791
+ });
5792
+ }
5741
5793
  }
5742
5794
  }
5743
5795
  }, {
@@ -5806,27 +5858,27 @@ var __publicField = (obj, key, value) => {
5806
5858
  }, {
5807
5859
  key: "onWaiting",
5808
5860
  value: function onWaiting() {
5809
- var _this22 = this;
5861
+ var _this23 = this;
5810
5862
  if (this.waitTimer) {
5811
5863
  util.clearTimeout(this, this.waitTimer);
5812
5864
  }
5813
5865
  this.updateAcc("waiting");
5814
5866
  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;
5867
+ _this23.addClass(STATE_CLASS.LOADING);
5868
+ _this23.emit(LOADING);
5869
+ util.clearTimeout(_this23, _this23.waitTimer);
5870
+ _this23.waitTimer = null;
5819
5871
  }, this.config.minWaitDelay);
5820
5872
  }
5821
5873
  }, {
5822
5874
  key: "onPlaying",
5823
5875
  value: function onPlaying() {
5824
- var _this23 = this;
5876
+ var _this24 = this;
5825
5877
  this.isError = false;
5826
5878
  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
5879
  var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
5828
5880
  clsList.forEach(function(cls) {
5829
- _this23.removeClass(cls);
5881
+ _this24.removeClass(cls);
5830
5882
  });
5831
5883
  if (!this._accPlayed.t && !this.paused && !this.ended) {
5832
5884
  this._accPlayed.t = (/* @__PURE__ */ new Date()).getTime();
@@ -5987,14 +6039,14 @@ var __publicField = (obj, key, value) => {
5987
6039
  }, {
5988
6040
  key: "setConfig",
5989
6041
  value: function setConfig(config) {
5990
- var _this24 = this;
6042
+ var _this25 = this;
5991
6043
  if (!config) {
5992
6044
  return;
5993
6045
  }
5994
6046
  Object.keys(config).map(function(key) {
5995
6047
  if (key !== "plugins") {
5996
- _this24.config[key] = config[key];
5997
- var plugin = _this24.plugins[key.toLowerCase()];
6048
+ _this25.config[key] = config[key];
6049
+ var plugin = _this25.plugins[key.toLowerCase()];
5998
6050
  if (plugin && util.typeOf(plugin.setConfig) === "Function") {
5999
6051
  plugin.setConfig(config[key]);
6000
6052
  }
@@ -6004,20 +6056,20 @@ var __publicField = (obj, key, value) => {
6004
6056
  }, {
6005
6057
  key: "playNext",
6006
6058
  value: function playNext(config) {
6007
- var _this25 = this;
6059
+ var _this26 = this;
6008
6060
  this.resetState();
6009
6061
  this.setConfig(config);
6010
6062
  this._currentTime = 0;
6011
6063
  this._duration = 0;
6012
6064
  runHooks(this, "playnext", function() {
6013
- _this25.start();
6014
- _this25.emit(PLAYNEXT, config);
6065
+ _this26.start();
6066
+ _this26.emit(PLAYNEXT, config);
6015
6067
  });
6016
6068
  }
6017
6069
  }, {
6018
6070
  key: "resize",
6019
6071
  value: function resize() {
6020
- var _this26 = this;
6072
+ var _this27 = this;
6021
6073
  if (!this.media) {
6022
6074
  return;
6023
6075
  }
@@ -6057,7 +6109,7 @@ var __publicField = (obj, key, value) => {
6057
6109
  }
6058
6110
  if (!this.fullscreen && !this.cssfullscreen) {
6059
6111
  Object.keys(_style).forEach(function(key) {
6060
- _this26.root.style[key] = _style[key];
6112
+ _this27.root.style[key] = _style[key];
6061
6113
  });
6062
6114
  }
6063
6115
  if (videoFillMode === "fillHeight" && fit < videoFit || videoFillMode === "fillWidth" && fit > videoFit) {
@@ -6099,6 +6151,14 @@ var __publicField = (obj, key, value) => {
6099
6151
  url
6100
6152
  };
6101
6153
  }
6154
+ }, {
6155
+ key: "_seekToStartTime",
6156
+ value: function _seekToStartTime() {
6157
+ if (this.__startTime > 0 && this.duration > 0) {
6158
+ this.currentTime = this.__startTime > this.duration ? this.duration : this.__startTime;
6159
+ this.__startTime = -1;
6160
+ }
6161
+ }
6102
6162
  }, {
6103
6163
  key: "state",
6104
6164
  get: function get() {
@@ -6149,15 +6209,15 @@ var __publicField = (obj, key, value) => {
6149
6209
  return this.config.definition.list || [];
6150
6210
  },
6151
6211
  set: function set(list) {
6152
- var _this27 = this;
6212
+ var _this28 = this;
6153
6213
  var definition = this.config.definition;
6154
6214
  var curDef = null;
6155
6215
  var targetDef = null;
6156
6216
  definition.list = list;
6157
6217
  this.emit("resourceReady", list);
6158
6218
  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) {
6219
+ var _this28$curDefinition;
6220
+ if (((_this28$curDefinition = _this28.curDefinition) === null || _this28$curDefinition === void 0 ? void 0 : _this28$curDefinition.definition) === item.definition) {
6161
6221
  curDef = item;
6162
6222
  }
6163
6223
  if (definition.defaultDefinition === item.definition) {
@@ -6894,7 +6954,7 @@ var __publicField = (obj, key, value) => {
6894
6954
  var className = _this.config.mode === "auto" ? "auto-hide" : "hide";
6895
6955
  util.addClass(_this.root, className);
6896
6956
  _this.autoPlayStart = true;
6897
- _this.onPlayPause("play");
6957
+ _this.toggleTo("play");
6898
6958
  });
6899
6959
  _this.autoPlayStart = false;
6900
6960
  return _this;
@@ -6902,9 +6962,19 @@ var __publicField = (obj, key, value) => {
6902
6962
  _createClass(Start2, [{
6903
6963
  key: "afterCreate",
6904
6964
  value: function afterCreate() {
6965
+ var playerConfig = this.playerConfig;
6966
+ this.initIcons();
6967
+ this.listenEvents();
6968
+ this.bindClickEvents();
6969
+ if (!playerConfig.autoplay) {
6970
+ this.show();
6971
+ }
6972
+ }
6973
+ }, {
6974
+ key: "listenEvents",
6975
+ value: function listenEvents() {
6905
6976
  var _this2 = this;
6906
6977
  var player = this.player, playerConfig = this.playerConfig;
6907
- this.initIcons();
6908
6978
  this.once(READY, function() {
6909
6979
  if (playerConfig) {
6910
6980
  if (playerConfig.lang && playerConfig.lang === "en") {
@@ -6915,9 +6985,6 @@ var __publicField = (obj, key, value) => {
6915
6985
  }
6916
6986
  });
6917
6987
  this.on(AUTOPLAY_STARTED, this.onAutoplayStart);
6918
- if (!playerConfig.autoplay) {
6919
- this.show();
6920
- }
6921
6988
  this.on(AUTOPLAY_PREVENTED, function() {
6922
6989
  var className = _this2.config.mode === "auto" ? "auto-hide" : "hide";
6923
6990
  _this2.setAttr("data-state", "play");
@@ -6925,20 +6992,25 @@ var __publicField = (obj, key, value) => {
6925
6992
  _this2.show();
6926
6993
  });
6927
6994
  this.on(PLAY, function() {
6928
- _this2.onPlayPause("play");
6995
+ _this2.toggleTo("play");
6929
6996
  });
6930
6997
  this.on(PAUSE, function() {
6931
- _this2.onPlayPause("pause");
6998
+ _this2.toggleTo("pause");
6932
6999
  });
6933
7000
  this.on(RESET, function() {
6934
7001
  _this2.onPlayerReset();
6935
7002
  });
7003
+ }
7004
+ }, {
7005
+ key: "bindClickEvents",
7006
+ value: function bindClickEvents() {
7007
+ var _this3 = this;
6936
7008
  this.clickHandler = this.hook("startClick", this.switchPausePlay, {
6937
7009
  pre: function pre(e) {
6938
7010
  e.cancelable && e.preventDefault();
6939
7011
  e.stopPropagation();
6940
- var paused = _this2.player.paused;
6941
- _this2.emitUserAction(e, "switch_play_pause", {
7012
+ var paused = _this3.player.paused;
7013
+ _this3.emitUserAction(e, "switch_play_pause", {
6942
7014
  props: "paused",
6943
7015
  from: paused,
6944
7016
  to: !paused
@@ -7000,17 +7072,17 @@ var __publicField = (obj, key, value) => {
7000
7072
  }, {
7001
7073
  key: "animate",
7002
7074
  value: function animate(endShow) {
7003
- var _this3 = this;
7075
+ var _this4 = this;
7004
7076
  this._animateId = addAnimate("pauseplay", 400, {
7005
7077
  start: function start() {
7006
- util.addClass(_this3.root, "interact");
7007
- _this3.show();
7008
- _this3.switchStatus(true);
7078
+ util.addClass(_this4.root, "interact");
7079
+ _this4.show();
7080
+ _this4.switchStatus(true);
7009
7081
  },
7010
7082
  end: function end() {
7011
- util.removeClass(_this3.root, "interact");
7012
- !endShow && _this3.hide();
7013
- _this3._animateId = null;
7083
+ util.removeClass(_this4.root, "interact");
7084
+ !endShow && _this4.hide();
7085
+ _this4._animateId = null;
7014
7086
  }
7015
7087
  });
7016
7088
  }
@@ -7040,6 +7112,11 @@ var __publicField = (obj, key, value) => {
7040
7112
  }, {
7041
7113
  key: "onPlayPause",
7042
7114
  value: function onPlayPause(status) {
7115
+ this.toggleTo(status);
7116
+ }
7117
+ }, {
7118
+ key: "toggleTo",
7119
+ value: function toggleTo(status) {
7043
7120
  var config = this.config, player = this.player;
7044
7121
  if (!player || player.state < STATES.RUNNING || !this.autoPlayStart) {
7045
7122
  return;
@@ -8415,7 +8492,7 @@ var __publicField = (obj, key, value) => {
8415
8492
  }
8416
8493
  this.on(DURATION_CHANGE, function() {
8417
8494
  var player2 = _this2.player, config2 = _this2.config;
8418
- if (player2.duration * 1e3 < config2.moveDuration) {
8495
+ if (player2.duration > 0 && player2.duration * 1e3 < config2.moveDuration) {
8419
8496
  config2.moveDuration = player2.duration * 1e3;
8420
8497
  }
8421
8498
  });
@@ -8729,10 +8806,13 @@ var __publicField = (obj, key, value) => {
8729
8806
  }, {
8730
8807
  key: "updateBrightness",
8731
8808
  value: function updateBrightness(percent) {
8809
+ var pos = this.pos, config = this.config, xgMask = this.xgMask;
8810
+ if (!config.darkness) {
8811
+ return;
8812
+ }
8732
8813
  if (this.player.rotateDeg) {
8733
8814
  percent = -percent;
8734
8815
  }
8735
- var pos = this.pos, config = this.config, xgMask = this.xgMask;
8736
8816
  var light = pos.light + 0.8 * percent;
8737
8817
  light = light > config.maxDarkness ? config.maxDarkness : light < 0 ? 0 : light;
8738
8818
  if (xgMask) {
@@ -8793,12 +8873,12 @@ var __publicField = (obj, key, value) => {
8793
8873
  }, {
8794
8874
  key: "disableGesture",
8795
8875
  value: function disableGesture() {
8796
- this.config.disableGesture = false;
8876
+ this.config.disableGesture = true;
8797
8877
  }
8798
8878
  }, {
8799
8879
  key: "enableGesture",
8800
8880
  value: function enableGesture() {
8801
- this.config.disableGesture = true;
8881
+ this.config.disableGesture = false;
8802
8882
  }
8803
8883
  }, {
8804
8884
  key: "destroy",
@@ -9370,29 +9450,56 @@ var __publicField = (obj, key, value) => {
9370
9450
  _inherits(Play2, _IconPlugin);
9371
9451
  var _super = _createSuper(Play2);
9372
9452
  function Play2() {
9453
+ var _this;
9373
9454
  _classCallCheck(this, Play2);
9374
- return _super.apply(this, arguments);
9455
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9456
+ args[_key] = arguments[_key];
9457
+ }
9458
+ _this = _super.call.apply(_super, [this].concat(args));
9459
+ _defineProperty(_assertThisInitialized(_this), "btnClick", function(e) {
9460
+ e.preventDefault();
9461
+ e.stopPropagation();
9462
+ var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player;
9463
+ _this.emitUserAction(e, "switch_play_pause", {
9464
+ prop: "paused",
9465
+ from: player.paused,
9466
+ to: !player.paused
9467
+ });
9468
+ if (player.ended) {
9469
+ player.replay();
9470
+ } else if (player.paused) {
9471
+ player.play();
9472
+ _this.animate(false);
9473
+ } else {
9474
+ player.pause();
9475
+ _this.animate(true);
9476
+ }
9477
+ return false;
9478
+ });
9479
+ return _this;
9375
9480
  }
9376
9481
  _createClass(Play2, [{
9377
9482
  key: "afterCreate",
9378
9483
  value: function afterCreate() {
9379
- var _this = this;
9380
9484
  _get(_getPrototypeOf(Play2.prototype), "afterCreate", this).call(this);
9381
- var player = this.player, config = this.config;
9485
+ var config = this.config;
9382
9486
  if (config.disable) {
9383
9487
  return;
9384
9488
  }
9385
9489
  this.initIcons();
9386
- this.btnClick = this.btnClick.bind(this);
9387
9490
  this.bind(["touchend", "click"], this.btnClick);
9388
- this.on([PAUSE, ERROR, EMPTIED], function() {
9389
- _this.animate(player.paused);
9390
- });
9391
- this.on(PLAY, function() {
9392
- _this.animate(player.paused);
9393
- });
9491
+ this.listenEvents();
9394
9492
  this.animate(true);
9395
9493
  }
9494
+ }, {
9495
+ key: "listenEvents",
9496
+ value: function listenEvents() {
9497
+ var _this2 = this;
9498
+ var player = this.player;
9499
+ this.on([PLAY, PAUSE, ERROR, EMPTIED], function() {
9500
+ _this2.animate(player.paused);
9501
+ });
9502
+ }
9396
9503
  }, {
9397
9504
  key: "registerIcons",
9398
9505
  value: function registerIcons() {
@@ -9407,28 +9514,6 @@ var __publicField = (obj, key, value) => {
9407
9514
  }
9408
9515
  };
9409
9516
  }
9410
- }, {
9411
- key: "btnClick",
9412
- value: function btnClick(e) {
9413
- e.preventDefault();
9414
- e.stopPropagation();
9415
- var player = this.player;
9416
- this.emitUserAction(e, "switch_play_pause", {
9417
- prop: "paused",
9418
- from: player.paused,
9419
- to: !player.paused
9420
- });
9421
- if (player.ended) {
9422
- player.replay();
9423
- } else if (player.paused) {
9424
- player.play();
9425
- this.animate(false);
9426
- } else {
9427
- player.pause();
9428
- this.animate(true);
9429
- }
9430
- return false;
9431
- }
9432
9517
  }, {
9433
9518
  key: "initIcons",
9434
9519
  value: function initIcons() {
@@ -11471,10 +11556,10 @@ var __publicField = (obj, key, value) => {
11471
11556
  const { controls } = this.player;
11472
11557
  const { listType } = this.config;
11473
11558
  if (isActive) {
11474
- listType && MODAL_TYPES.includes(listType) ? controls.blur() : controls.focus();
11559
+ listType && MODAL_TYPES.includes(listType) ? controls == null ? void 0 : controls.blur() : controls == null ? void 0 : controls.focus();
11475
11560
  this.optionsList && this.optionsList.show();
11476
11561
  } else {
11477
- listType && MODAL_TYPES.includes(listType) ? controls.focus() : controls.focusAwhile();
11562
+ listType && MODAL_TYPES.includes(listType) ? controls == null ? void 0 : controls.focus() : controls == null ? void 0 : controls.focusAwhile();
11478
11563
  this.optionsList && this.optionsList.hide();
11479
11564
  }
11480
11565
  this._isActive = isActive;
@@ -13584,7 +13669,7 @@ var __publicField = (obj, key, value) => {
13584
13669
  * @returns
13585
13670
  */
13586
13671
  get playerVersion() {
13587
- return "2.4.2-rc.1";
13672
+ return "2.4.3-rc.0";
13588
13673
  }
13589
13674
  /** {zh}
13590
13675
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。