@volcengine/veplayer 2.4.1-rc.0 → 2.5.0-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.
@@ -1312,7 +1312,7 @@ var VERSION_REG = {
1312
1312
  android: /(Android)\s([\d.]+)/,
1313
1313
  ios: /(Version)\/([\d.]+)/
1314
1314
  };
1315
- 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"];
1315
+ 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"];
1316
1316
  var sniffer$1 = {
1317
1317
  get device() {
1318
1318
  var r2 = sniffer$1.os;
@@ -1457,7 +1457,7 @@ var sniffer$1 = {
1457
1457
  }
1458
1458
  }
1459
1459
  };
1460
- var version = "3.0.19-rc.0";
1460
+ var version = "3.0.20-alpha.4";
1461
1461
  var ERROR_TYPE_MAP = {
1462
1462
  1: "media",
1463
1463
  2: "media",
@@ -2427,8 +2427,7 @@ function hook(hookName, handler) {
2427
2427
  }
2428
2428
  if (this.__hooks && this.__hooks[hookName]) {
2429
2429
  try {
2430
- var _this$__hooks$hookNam;
2431
- var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
2430
+ var preRet = runHooks(this, hookName, handler);
2432
2431
  if (preRet) {
2433
2432
  if (preRet.then) {
2434
2433
  preRet.then(function(isContinue) {
@@ -2453,6 +2452,19 @@ function hook(hookName, handler) {
2453
2452
  }
2454
2453
  }.bind(this);
2455
2454
  }
2455
+ function findHookIndex(hookName, handler) {
2456
+ var __hooks = this.__hooks;
2457
+ if (!__hooks || !Array.isArray(__hooks[hookName])) {
2458
+ return -1;
2459
+ }
2460
+ var hookHandlers = __hooks[hookName];
2461
+ for (var i2 = 0; i2 < hookHandlers.length; i2++) {
2462
+ if (hookHandlers[i2] === handler) {
2463
+ return i2;
2464
+ }
2465
+ }
2466
+ return -1;
2467
+ }
2456
2468
  function useHooks(hookName, handler) {
2457
2469
  var __hooks = this.__hooks;
2458
2470
  if (!__hooks) {
@@ -2462,7 +2474,12 @@ function useHooks(hookName, handler) {
2462
2474
  console.warn("has no supported hook which name [".concat(hookName, "]"));
2463
2475
  return false;
2464
2476
  }
2465
- __hooks && (__hooks[hookName] = handler);
2477
+ if (!Array.isArray(__hooks[hookName])) {
2478
+ __hooks[hookName] = [];
2479
+ }
2480
+ if (findHookIndex.call(this, hookName, handler) === -1) {
2481
+ __hooks[hookName].push(handler);
2482
+ }
2466
2483
  return true;
2467
2484
  }
2468
2485
  function removeHooks(hookName, handler) {
@@ -2470,6 +2487,13 @@ function removeHooks(hookName, handler) {
2470
2487
  if (!__hooks) {
2471
2488
  return;
2472
2489
  }
2490
+ if (Array.isArray(__hooks[hookName])) {
2491
+ var hooks = __hooks[hookName];
2492
+ var index = findHookIndex.call(this, hookName, handler);
2493
+ if (index !== -1) {
2494
+ hooks.splice(index, 1);
2495
+ }
2496
+ }
2473
2497
  delete __hooks[hookName];
2474
2498
  }
2475
2499
  function usePluginHooks(pluginName) {
@@ -2517,18 +2541,30 @@ function runHooks(obj, hookName, handler) {
2517
2541
  for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
2518
2542
  args[_key5 - 3] = arguments[_key5];
2519
2543
  }
2520
- if (obj.__hooks && obj.__hooks[hookName]) {
2521
- var _obj$__hooks$hookName;
2522
- var ret = (_obj$__hooks$hookName = obj.__hooks[hookName]).call.apply(_obj$__hooks$hookName, [obj, obj].concat(args));
2523
- if (ret && ret.then) {
2524
- ret.then(function(data) {
2525
- return data === false ? null : handler.call.apply(handler, [obj, obj].concat(args));
2526
- }).catch(function(e3) {
2527
- console.warn("[runHooks]".concat(hookName, " reject"), e3.message);
2528
- });
2529
- } else if (ret !== false) {
2530
- return handler.call.apply(handler, [obj, obj].concat(args));
2531
- }
2544
+ if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
2545
+ var hooks = obj.__hooks[hookName];
2546
+ var index = -1;
2547
+ var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
2548
+ for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
2549
+ args2[_key6 - 3] = arguments[_key6];
2550
+ }
2551
+ index++;
2552
+ if (hooks.length === 0 || index === hooks.length) {
2553
+ return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
2554
+ }
2555
+ var hook2 = hooks[index];
2556
+ var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
2557
+ if (ret && ret.then) {
2558
+ return ret.then(function(data) {
2559
+ return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
2560
+ }).catch(function(e3) {
2561
+ console.warn("[runHooks]".concat(hookName2, " reject"), e3.message);
2562
+ });
2563
+ } else if (ret !== false) {
2564
+ return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
2565
+ }
2566
+ };
2567
+ return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
2532
2568
  } else {
2533
2569
  return handler.call.apply(handler, [obj, obj].concat(args));
2534
2570
  }
@@ -4485,10 +4521,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4485
4521
  }
4486
4522
  var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4487
4523
  XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
4488
- if (_this.__startTime > 0 && _this.duration > 0) {
4489
- _this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
4490
- _this.__startTime = -1;
4491
- }
4524
+ _this._seekToStartTime();
4492
4525
  _this.playbackRate = defaultPlaybackRate;
4493
4526
  (autoplay2 || _this._useAutoplay) && _this.mediaPlay();
4494
4527
  _this.off(CANPLAY, _this.canPlayFunc);
@@ -4578,6 +4611,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4578
4611
  _this.waitTimer = null;
4579
4612
  _this.handleSource = true;
4580
4613
  _this._state = STATES.INITIAL;
4614
+ _this.isAd = false;
4581
4615
  _this.isError = false;
4582
4616
  _this._hasStart = false;
4583
4617
  _this.isSeeking = false;
@@ -4962,7 +4996,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4962
4996
  _pConfig.position && (options.position = _pConfig.position);
4963
4997
  var position = options.position ? options.position : options.config && options.config.position || PLUFGIN.defaultConfig && PLUFGIN.defaultConfig.position;
4964
4998
  if (!options.root && typeof position === "string" && position.indexOf("controls") > -1) {
4965
- return this.controls && this.controls.registerPlugin(PLUFGIN, options, PLUFGIN.pluginName);
4999
+ var _this$controls;
5000
+ return (_this$controls = this.controls) === null || _this$controls === void 0 ? void 0 : _this$controls.registerPlugin(PLUFGIN, options, PLUFGIN.pluginName);
4966
5001
  }
4967
5002
  if (!options.root) {
4968
5003
  options.root = this._getRootByPosition(position);
@@ -5110,10 +5145,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5110
5145
  reject(e3);
5111
5146
  };
5112
5147
  var _canplay = function _canplay2() {
5113
- if (_this9.duration > 0 && _this9.__startTime > 0) {
5114
- _this9.currentTime = _this9.__startTime;
5115
- _this9.__startTime = -1;
5116
- }
5148
+ _this9._seekToStartTime();
5117
5149
  if (isPaused) {
5118
5150
  _this9.pause();
5119
5151
  }
@@ -5734,11 +5766,17 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5734
5766
  }, {
5735
5767
  key: "onLoadeddata",
5736
5768
  value: function onLoadeddata() {
5769
+ var _this22 = this;
5737
5770
  this.isError = false;
5738
5771
  this.isSeeking = false;
5739
- if (this.__startTime > 0 && this.duration > 0) {
5740
- this.currentTime = this.__startTime;
5741
- this.__startTime = -1;
5772
+ if (this.__startTime > 0) {
5773
+ if (this.duration > 0) {
5774
+ this._seekToStartTime();
5775
+ } else {
5776
+ this.once(DURATION_CHANGE, function() {
5777
+ _this22._seekToStartTime();
5778
+ });
5779
+ }
5742
5780
  }
5743
5781
  }
5744
5782
  }, {
@@ -5807,27 +5845,27 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5807
5845
  }, {
5808
5846
  key: "onWaiting",
5809
5847
  value: function onWaiting() {
5810
- var _this22 = this;
5848
+ var _this23 = this;
5811
5849
  if (this.waitTimer) {
5812
5850
  util$1.clearTimeout(this, this.waitTimer);
5813
5851
  }
5814
5852
  this.updateAcc("waiting");
5815
5853
  this.waitTimer = util$1.setTimeout(this, function() {
5816
- _this22.addClass(STATE_CLASS.LOADING);
5817
- _this22.emit(LOADING);
5818
- util$1.clearTimeout(_this22, _this22.waitTimer);
5819
- _this22.waitTimer = null;
5854
+ _this23.addClass(STATE_CLASS.LOADING);
5855
+ _this23.emit(LOADING);
5856
+ util$1.clearTimeout(_this23, _this23.waitTimer);
5857
+ _this23.waitTimer = null;
5820
5858
  }, this.config.minWaitDelay);
5821
5859
  }
5822
5860
  }, {
5823
5861
  key: "onPlaying",
5824
5862
  value: function onPlaying() {
5825
- var _this23 = this;
5863
+ var _this24 = this;
5826
5864
  this.isError = false;
5827
5865
  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;
5828
5866
  var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
5829
5867
  clsList.forEach(function(cls) {
5830
- _this23.removeClass(cls);
5868
+ _this24.removeClass(cls);
5831
5869
  });
5832
5870
  if (!this._accPlayed.t && !this.paused && !this.ended) {
5833
5871
  this._accPlayed.t = (/* @__PURE__ */ new Date()).getTime();
@@ -5988,14 +6026,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5988
6026
  }, {
5989
6027
  key: "setConfig",
5990
6028
  value: function setConfig(config) {
5991
- var _this24 = this;
6029
+ var _this25 = this;
5992
6030
  if (!config) {
5993
6031
  return;
5994
6032
  }
5995
6033
  Object.keys(config).map(function(key) {
5996
6034
  if (key !== "plugins") {
5997
- _this24.config[key] = config[key];
5998
- var plugin = _this24.plugins[key.toLowerCase()];
6035
+ _this25.config[key] = config[key];
6036
+ var plugin = _this25.plugins[key.toLowerCase()];
5999
6037
  if (plugin && util$1.typeOf(plugin.setConfig) === "Function") {
6000
6038
  plugin.setConfig(config[key]);
6001
6039
  }
@@ -6005,20 +6043,20 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6005
6043
  }, {
6006
6044
  key: "playNext",
6007
6045
  value: function playNext(config) {
6008
- var _this25 = this;
6046
+ var _this26 = this;
6009
6047
  this.resetState();
6010
6048
  this.setConfig(config);
6011
6049
  this._currentTime = 0;
6012
6050
  this._duration = 0;
6013
6051
  runHooks(this, "playnext", function() {
6014
- _this25.start();
6015
- _this25.emit(PLAYNEXT, config);
6052
+ _this26.start();
6053
+ _this26.emit(PLAYNEXT, config);
6016
6054
  });
6017
6055
  }
6018
6056
  }, {
6019
6057
  key: "resize",
6020
6058
  value: function resize() {
6021
- var _this26 = this;
6059
+ var _this27 = this;
6022
6060
  if (!this.media) {
6023
6061
  return;
6024
6062
  }
@@ -6058,7 +6096,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6058
6096
  }
6059
6097
  if (!this.fullscreen && !this.cssfullscreen) {
6060
6098
  Object.keys(_style).forEach(function(key) {
6061
- _this26.root.style[key] = _style[key];
6099
+ _this27.root.style[key] = _style[key];
6062
6100
  });
6063
6101
  }
6064
6102
  if (videoFillMode === "fillHeight" && fit < videoFit || videoFillMode === "fillWidth" && fit > videoFit) {
@@ -6100,6 +6138,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6100
6138
  url
6101
6139
  };
6102
6140
  }
6141
+ }, {
6142
+ key: "_seekToStartTime",
6143
+ value: function _seekToStartTime() {
6144
+ if (this.__startTime > 0 && this.duration > 0) {
6145
+ this.currentTime = this.__startTime > this.duration ? this.duration : this.__startTime;
6146
+ this.__startTime = -1;
6147
+ }
6148
+ }
6103
6149
  }, {
6104
6150
  key: "state",
6105
6151
  get: function get() {
@@ -6150,15 +6196,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6150
6196
  return this.config.definition.list || [];
6151
6197
  },
6152
6198
  set: function set(list) {
6153
- var _this27 = this;
6199
+ var _this28 = this;
6154
6200
  var definition = this.config.definition;
6155
6201
  var curDef = null;
6156
6202
  var targetDef = null;
6157
6203
  definition.list = list;
6158
6204
  this.emit("resourceReady", list);
6159
6205
  list.forEach(function(item) {
6160
- var _this27$curDefinition;
6161
- if (((_this27$curDefinition = _this27.curDefinition) === null || _this27$curDefinition === void 0 ? void 0 : _this27$curDefinition.definition) === item.definition) {
6206
+ var _this28$curDefinition;
6207
+ if (((_this28$curDefinition = _this28.curDefinition) === null || _this28$curDefinition === void 0 ? void 0 : _this28$curDefinition.definition) === item.definition) {
6162
6208
  curDef = item;
6163
6209
  }
6164
6210
  if (definition.defaultDefinition === item.definition) {
@@ -6922,7 +6968,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6922
6968
  var className = _this.config.mode === "auto" ? "auto-hide" : "hide";
6923
6969
  util$1.addClass(_this.root, className);
6924
6970
  _this.autoPlayStart = true;
6925
- _this.onPlayPause("play");
6971
+ _this.toggleTo("play");
6926
6972
  });
6927
6973
  _this.autoPlayStart = false;
6928
6974
  return _this;
@@ -6930,9 +6976,19 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6930
6976
  _createClass$1(Start2, [{
6931
6977
  key: "afterCreate",
6932
6978
  value: function afterCreate() {
6979
+ var playerConfig = this.playerConfig;
6980
+ this.initIcons();
6981
+ this.listenEvents();
6982
+ this.bindClickEvents();
6983
+ if (!playerConfig.autoplay) {
6984
+ this.show();
6985
+ }
6986
+ }
6987
+ }, {
6988
+ key: "listenEvents",
6989
+ value: function listenEvents() {
6933
6990
  var _this2 = this;
6934
6991
  var player = this.player, playerConfig = this.playerConfig;
6935
- this.initIcons();
6936
6992
  this.once(READY, function() {
6937
6993
  if (playerConfig) {
6938
6994
  if (playerConfig.lang && playerConfig.lang === "en") {
@@ -6943,9 +6999,6 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6943
6999
  }
6944
7000
  });
6945
7001
  this.on(AUTOPLAY_STARTED, this.onAutoplayStart);
6946
- if (!playerConfig.autoplay) {
6947
- this.show();
6948
- }
6949
7002
  this.on(AUTOPLAY_PREVENTED, function() {
6950
7003
  var className = _this2.config.mode === "auto" ? "auto-hide" : "hide";
6951
7004
  _this2.setAttr("data-state", "play");
@@ -6953,20 +7006,25 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6953
7006
  _this2.show();
6954
7007
  });
6955
7008
  this.on(PLAY, function() {
6956
- _this2.onPlayPause("play");
7009
+ _this2.toggleTo("play");
6957
7010
  });
6958
7011
  this.on(PAUSE, function() {
6959
- _this2.onPlayPause("pause");
7012
+ _this2.toggleTo("pause");
6960
7013
  });
6961
7014
  this.on(RESET, function() {
6962
7015
  _this2.onPlayerReset();
6963
7016
  });
7017
+ }
7018
+ }, {
7019
+ key: "bindClickEvents",
7020
+ value: function bindClickEvents() {
7021
+ var _this3 = this;
6964
7022
  this.clickHandler = this.hook("startClick", this.switchPausePlay, {
6965
7023
  pre: function pre(e3) {
6966
7024
  e3.cancelable && e3.preventDefault();
6967
7025
  e3.stopPropagation();
6968
- var paused = _this2.player.paused;
6969
- _this2.emitUserAction(e3, "switch_play_pause", {
7026
+ var paused = _this3.player.paused;
7027
+ _this3.emitUserAction(e3, "switch_play_pause", {
6970
7028
  props: "paused",
6971
7029
  from: paused,
6972
7030
  to: !paused
@@ -7028,17 +7086,17 @@ var Start = /* @__PURE__ */ function(_Plugin) {
7028
7086
  }, {
7029
7087
  key: "animate",
7030
7088
  value: function animate(endShow) {
7031
- var _this3 = this;
7089
+ var _this4 = this;
7032
7090
  this._animateId = addAnimate("pauseplay", 400, {
7033
7091
  start: function start() {
7034
- util$1.addClass(_this3.root, "interact");
7035
- _this3.show();
7036
- _this3.switchStatus(true);
7092
+ util$1.addClass(_this4.root, "interact");
7093
+ _this4.show();
7094
+ _this4.switchStatus(true);
7037
7095
  },
7038
7096
  end: function end() {
7039
- util$1.removeClass(_this3.root, "interact");
7040
- !endShow && _this3.hide();
7041
- _this3._animateId = null;
7097
+ util$1.removeClass(_this4.root, "interact");
7098
+ !endShow && _this4.hide();
7099
+ _this4._animateId = null;
7042
7100
  }
7043
7101
  });
7044
7102
  }
@@ -7068,6 +7126,11 @@ var Start = /* @__PURE__ */ function(_Plugin) {
7068
7126
  }, {
7069
7127
  key: "onPlayPause",
7070
7128
  value: function onPlayPause(status) {
7129
+ this.toggleTo(status);
7130
+ }
7131
+ }, {
7132
+ key: "toggleTo",
7133
+ value: function toggleTo(status) {
7071
7134
  var config = this.config, player = this.player;
7072
7135
  if (!player || player.state < STATES.RUNNING || !this.autoPlayStart) {
7073
7136
  return;
@@ -9398,29 +9461,56 @@ var Play$1 = /* @__PURE__ */ function(_IconPlugin) {
9398
9461
  _inherits(Play2, _IconPlugin);
9399
9462
  var _super = _createSuper(Play2);
9400
9463
  function Play2() {
9464
+ var _this;
9401
9465
  _classCallCheck(this, Play2);
9402
- return _super.apply(this, arguments);
9466
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9467
+ args[_key] = arguments[_key];
9468
+ }
9469
+ _this = _super.call.apply(_super, [this].concat(args));
9470
+ _defineProperty$1(_assertThisInitialized(_this), "btnClick", function(e3) {
9471
+ e3.preventDefault();
9472
+ e3.stopPropagation();
9473
+ var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player;
9474
+ _this.emitUserAction(e3, "switch_play_pause", {
9475
+ prop: "paused",
9476
+ from: player.paused,
9477
+ to: !player.paused
9478
+ });
9479
+ if (player.ended) {
9480
+ player.replay();
9481
+ } else if (player.paused) {
9482
+ player.play();
9483
+ _this.animate(false);
9484
+ } else {
9485
+ player.pause();
9486
+ _this.animate(true);
9487
+ }
9488
+ return false;
9489
+ });
9490
+ return _this;
9403
9491
  }
9404
9492
  _createClass$1(Play2, [{
9405
9493
  key: "afterCreate",
9406
9494
  value: function afterCreate() {
9407
- var _this = this;
9408
9495
  _get(_getPrototypeOf(Play2.prototype), "afterCreate", this).call(this);
9409
- var player = this.player, config = this.config;
9496
+ var config = this.config;
9410
9497
  if (config.disable) {
9411
9498
  return;
9412
9499
  }
9413
9500
  this.initIcons();
9414
- this.btnClick = this.btnClick.bind(this);
9415
9501
  this.bind(["touchend", "click"], this.btnClick);
9416
- this.on([PAUSE, ERROR, EMPTIED], function() {
9417
- _this.animate(player.paused);
9418
- });
9419
- this.on(PLAY, function() {
9420
- _this.animate(player.paused);
9421
- });
9502
+ this.listenEvents();
9422
9503
  this.animate(true);
9423
9504
  }
9505
+ }, {
9506
+ key: "listenEvents",
9507
+ value: function listenEvents() {
9508
+ var _this2 = this;
9509
+ var player = this.player;
9510
+ this.on([PLAY, PAUSE, ERROR, EMPTIED], function() {
9511
+ _this2.animate(player.paused);
9512
+ });
9513
+ }
9424
9514
  }, {
9425
9515
  key: "registerIcons",
9426
9516
  value: function registerIcons() {
@@ -9435,28 +9525,6 @@ var Play$1 = /* @__PURE__ */ function(_IconPlugin) {
9435
9525
  }
9436
9526
  };
9437
9527
  }
9438
- }, {
9439
- key: "btnClick",
9440
- value: function btnClick(e3) {
9441
- e3.preventDefault();
9442
- e3.stopPropagation();
9443
- var player = this.player;
9444
- this.emitUserAction(e3, "switch_play_pause", {
9445
- prop: "paused",
9446
- from: player.paused,
9447
- to: !player.paused
9448
- });
9449
- if (player.ended) {
9450
- player.replay();
9451
- } else if (player.paused) {
9452
- player.play();
9453
- this.animate(false);
9454
- } else {
9455
- player.pause();
9456
- this.animate(true);
9457
- }
9458
- return false;
9459
- }
9460
9528
  }, {
9461
9529
  key: "initIcons",
9462
9530
  value: function initIcons() {
@@ -11575,10 +11643,10 @@ class OptionsIcon extends Plugin {
11575
11643
  const { controls } = this.player;
11576
11644
  const { listType } = this.config;
11577
11645
  if (isActive) {
11578
- listType && MODAL_TYPES.includes(listType) ? controls.blur() : controls.focus();
11646
+ listType && MODAL_TYPES.includes(listType) ? controls == null ? void 0 : controls.blur() : controls == null ? void 0 : controls.focus();
11579
11647
  this.optionsList && this.optionsList.show();
11580
11648
  } else {
11581
- listType && MODAL_TYPES.includes(listType) ? controls.focus() : controls.focusAwhile();
11649
+ listType && MODAL_TYPES.includes(listType) ? controls == null ? void 0 : controls.focus() : controls == null ? void 0 : controls.focusAwhile();
11582
11650
  this.optionsList && this.optionsList.hide();
11583
11651
  }
11584
11652
  this._isActive = isActive;
@@ -13045,6 +13113,7 @@ class Autoplay extends Plugin {
13045
13113
  }
13046
13114
  // 有音量修改,取消静音
13047
13115
  handleVolumechange() {
13116
+ this._state.mode = this.player.muted ? 1 : 0;
13048
13117
  if (!this._state.showUnmuteBt)
13049
13118
  return;
13050
13119
  this._state.showUnmuteBt = false;
@@ -13742,7 +13811,7 @@ class VePlayerBase {
13742
13811
  * @returns
13743
13812
  */
13744
13813
  get playerVersion() {
13745
- return "2.4.1-rc.0";
13814
+ return "2.5.0-rc.1";
13746
13815
  }
13747
13816
  /** {zh}
13748
13817
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
@@ -19063,29 +19132,6 @@ async function isRTMSupportCodec(codec = RTMCodec.H264) {
19063
19132
  return RtmPlugin.isSupportedH264();
19064
19133
  return false;
19065
19134
  }
19066
- const getAbrStrategy = async (options) => {
19067
- var _a, _b;
19068
- const streamType = options.url && getStreamType(options.url);
19069
- if (streamType === "rtm") {
19070
- return {};
19071
- }
19072
- const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
19073
- if (!abrOptions) {
19074
- return {};
19075
- }
19076
- const abrPlugin = await load(DynamicModule.PluginAbr).catch(() => void 0);
19077
- return {
19078
- options: {
19079
- [streamType === "flv" ? "abr" : "hlsabr"]: {
19080
- ...abrOptions,
19081
- open: abrOptions.enable ?? true
19082
- }
19083
- },
19084
- plugins: [
19085
- streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
19086
- ]
19087
- };
19088
- };
19089
19135
  const rtmStrategy = {
19090
19136
  options: {},
19091
19137
  module: DynamicModule.PluginRtm
@@ -19100,8 +19146,6 @@ const generateFallbackUrl = (url) => {
19100
19146
  const getRtmStrategy = async (options, player) => {
19101
19147
  var _a;
19102
19148
  let backupStrategy;
19103
- let backupOptions = {};
19104
- let backupModule = [];
19105
19149
  const { url } = options;
19106
19150
  const {
19107
19151
  fallbackUrl,
@@ -19116,7 +19160,7 @@ const getRtmStrategy = async (options, player) => {
19116
19160
  } else if (backupType === "hls" && (sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util.isMseSupported(Codec.H264)) {
19117
19161
  backupStrategy = createHlsMseStrategy(options);
19118
19162
  }
19119
- const [rtmCdn, backupCdn, backupAbr] = await Promise.all([
19163
+ const [rtmCdn, backupCdn] = await Promise.all([
19120
19164
  load(rtmStrategy.module).then((module) => {
19121
19165
  return module.RtmPlugin;
19122
19166
  }).catch(() => void 0),
@@ -19126,18 +19170,8 @@ const getRtmStrategy = async (options, player) => {
19126
19170
  } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule.PluginHls) {
19127
19171
  return module.HlsPlugin;
19128
19172
  }
19129
- }).catch(() => void 0),
19130
- getAbrStrategy({ ...options, url: actualFallbackUrl }).catch(
19131
- () => void 0
19132
- )
19173
+ }).catch(() => void 0)
19133
19174
  ]);
19134
- if (backupType) {
19135
- backupOptions = {
19136
- ...backupStrategy == null ? void 0 : backupStrategy.options,
19137
- ...backupAbr == null ? void 0 : backupAbr.options
19138
- };
19139
- backupModule = [backupCdn, ...(backupAbr == null ? void 0 : backupAbr.plugins) ?? []];
19140
- }
19141
19175
  const [RTMSupported, RTMSupportCodec] = await Promise.all([
19142
19176
  isRTMSupported(),
19143
19177
  isRTMSupportCodec()
@@ -19155,7 +19189,7 @@ const getRtmStrategy = async (options, player) => {
19155
19189
  }
19156
19190
  return {
19157
19191
  options: {
19158
- ...backupOptions || {},
19192
+ ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
19159
19193
  url: actualFallbackUrl,
19160
19194
  _RTMdegrade: {
19161
19195
  _originRtmUrl: url,
@@ -19163,19 +19197,19 @@ const getRtmStrategy = async (options, player) => {
19163
19197
  _isRTMSupportCodec: RTMSupportCodec
19164
19198
  }
19165
19199
  },
19166
- plugins: backupModule
19200
+ plugins: backupCdn ? [backupCdn] : []
19167
19201
  };
19168
19202
  }
19169
19203
  return {
19170
19204
  options: {
19171
- ...backupOptions || {},
19205
+ ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
19172
19206
  url: enableRTMAutoTranscode ? util.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
19173
19207
  _RTMdegrade: void 0,
19174
19208
  rts: {
19175
19209
  retryCount: 0,
19176
19210
  ...ret,
19177
19211
  backupURL: actualFallbackUrl,
19178
- backupConstruct: backupModule
19212
+ backupConstruct: backupCdn
19179
19213
  }
19180
19214
  },
19181
19215
  plugins: rtmCdn ? [rtmCdn] : []
@@ -22029,10 +22063,10 @@ class Logger extends Plugin {
22029
22063
  user_id: this._userId,
22030
22064
  device_id: this._deviceId,
22031
22065
  ext: {
22032
- veplayer_version: "2.4.1-rc.0",
22033
- flv_version: "3.0.19-rc.10",
22034
- hls_version: "3.0.19-rc.0",
22035
- rts_version: "0.2.1-alpha.1"
22066
+ veplayer_version: "2.5.0-rc.1",
22067
+ flv_version: "3.0.19-rc.0",
22068
+ hls_version: "3.0.20-alpha.2",
22069
+ rts_version: "0.2.1-alpha.0"
22036
22070
  }
22037
22071
  });
22038
22072
  }
@@ -22326,6 +22360,29 @@ const getDrmStrategy = async (options, player) => {
22326
22360
  }
22327
22361
  return {};
22328
22362
  };
22363
+ const getAbrStrategy = async (options) => {
22364
+ var _a, _b;
22365
+ const streamType = options.url && getStreamType(options.url);
22366
+ if (streamType === "rtm") {
22367
+ return {};
22368
+ }
22369
+ const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
22370
+ if (!abrOptions) {
22371
+ return {};
22372
+ }
22373
+ const abrPlugin = await load(DynamicModule.PluginAbr).catch(() => void 0);
22374
+ return {
22375
+ options: {
22376
+ [streamType === "flv" ? "abr" : "hlsabr"]: {
22377
+ ...abrOptions,
22378
+ open: abrOptions.enable ?? true
22379
+ }
22380
+ },
22381
+ plugins: [
22382
+ streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
22383
+ ]
22384
+ };
22385
+ };
22329
22386
  VeI18n.extend([
22330
22387
  {
22331
22388
  LANG: "zh-cn",