@volcengine/veplayer 2.3.0-rc.3 → 2.4.0-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.
Files changed (40) hide show
  1. package/esm/index.d.ts +73 -3
  2. package/esm/veplayer.biz.live.development.js +92 -21
  3. package/esm/veplayer.biz.live.production.js +1 -1
  4. package/esm/veplayer.d.ts +290 -5
  5. package/esm/veplayer.development.css +1 -1
  6. package/esm/veplayer.development.js +217 -75
  7. package/esm/veplayer.live.d.ts +290 -5
  8. package/esm/veplayer.live.development.css +1 -1
  9. package/esm/veplayer.live.development.js +217 -75
  10. package/esm/veplayer.live.production.css +1 -1
  11. package/esm/veplayer.live.production.js +3 -3
  12. package/esm/veplayer.production.css +1 -1
  13. package/esm/veplayer.production.js +3 -3
  14. package/esm/veplayer.vod.d.ts +73 -3
  15. package/esm/veplayer.vod.development.css +1 -1
  16. package/esm/veplayer.vod.development.js +169 -68
  17. package/esm/veplayer.vod.production.css +1 -1
  18. package/esm/veplayer.vod.production.js +2 -2
  19. package/package.json +1 -1
  20. package/umd/index.d.ts +73 -3
  21. package/umd/veplayer.biz.live.development.js +92 -21
  22. package/umd/veplayer.biz.live.production.js +1 -1
  23. package/umd/veplayer.d.ts +290 -5
  24. package/umd/veplayer.development.css +1 -1
  25. package/umd/veplayer.development.js +217 -75
  26. package/umd/veplayer.live.d.ts +290 -5
  27. package/umd/veplayer.live.development.css +1 -1
  28. package/umd/veplayer.live.development.js +217 -75
  29. package/umd/veplayer.live.production.css +1 -1
  30. package/umd/veplayer.live.production.js +1 -1
  31. package/umd/veplayer.production.css +1 -1
  32. package/umd/veplayer.production.js +1 -1
  33. package/umd/veplayer.vod.d.ts +73 -3
  34. package/umd/veplayer.vod.development.css +1 -1
  35. package/umd/veplayer.vod.development.js +169 -68
  36. package/umd/veplayer.vod.production.css +1 -1
  37. package/umd/veplayer.vod.production.js +1 -1
  38. package/veplayer.d.ts +290 -5
  39. package/veplayer.live.d.ts +290 -5
  40. package/veplayer.vod.d.ts +73 -3
@@ -1010,6 +1010,9 @@ util$1.cancelAnimationFrame = function(frameId) {
1010
1010
  _fun && _fun(frameId);
1011
1011
  };
1012
1012
  util$1.isMSE = function(video) {
1013
+ if (video.media) {
1014
+ video = video.media;
1015
+ }
1013
1016
  if (!video || !(video instanceof HTMLMediaElement)) {
1014
1017
  return false;
1015
1018
  }
@@ -1454,7 +1457,7 @@ var sniffer$1 = {
1454
1457
  }
1455
1458
  }
1456
1459
  };
1457
- var version = "3.0.12";
1460
+ var version = "3.0.17";
1458
1461
  var ERROR_TYPE_MAP = {
1459
1462
  1: "media",
1460
1463
  2: "media",
@@ -1560,6 +1563,9 @@ var REPLAY = "replay";
1560
1563
  var DESTROY = "destroy";
1561
1564
  var URL_CHANGE = "urlchange";
1562
1565
  var DOWNLOAD_SPEED_CHANGE = "download_speed_change";
1566
+ var LEAVE_PLAYER = "leaveplayer";
1567
+ var ENTER_PLAYER = "enterplayer";
1568
+ var LOADING = "loading";
1563
1569
  var FULLSCREEN_CHANGE = "fullscreen_change";
1564
1570
  var CSS_FULLSCREEN_CHANGE = "cssFullscreen_change";
1565
1571
  var MINI_STATE_CHANGE = "mini_state_change";
@@ -1605,11 +1611,14 @@ var XGEvents = /* @__PURE__ */ Object.freeze({
1605
1611
  DURATION_CHANGE,
1606
1612
  EMPTIED,
1607
1613
  ENDED,
1614
+ ENTER_PLAYER,
1608
1615
  ERROR,
1609
1616
  FPS_STUCK,
1610
1617
  FULLSCREEN_CHANGE,
1618
+ LEAVE_PLAYER,
1611
1619
  LOADED_DATA,
1612
1620
  LOADED_METADATA,
1621
+ LOADING,
1613
1622
  LOAD_START,
1614
1623
  MINI_STATE_CHANGE,
1615
1624
  PAUSE,
@@ -2209,6 +2218,11 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
2209
2218
  }
2210
2219
  this.media.volume = vol;
2211
2220
  }
2221
+ }, {
2222
+ key: "aspectRatio",
2223
+ get: function get() {
2224
+ return this.media ? this.media.videoWidth / this.media.videoHeight : 0;
2225
+ }
2212
2226
  }, {
2213
2227
  key: "addInnerOP",
2214
2228
  value: function addInnerOP(event) {
@@ -2834,6 +2848,10 @@ var POSITIONS$2 = {
2834
2848
  CONTROLS_CENTER: "controlsCenter",
2835
2849
  CONTROLS: "controls"
2836
2850
  };
2851
+ var PLUGIN_STATE_CLASS = {
2852
+ ICON_DISABLE: "xg-icon-disable",
2853
+ ICON_HIDE: "xg-icon-hide"
2854
+ };
2837
2855
  function isUrl(str) {
2838
2856
  if (!str) {
2839
2857
  return false;
@@ -3067,6 +3085,18 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
3067
3085
  value: function plugins() {
3068
3086
  return this._children;
3069
3087
  }
3088
+ }, {
3089
+ key: "disable",
3090
+ value: function disable() {
3091
+ this.config.disable = true;
3092
+ util$1.addClass(this.find(".xgplayer-icon"), PLUGIN_STATE_CLASS.ICON_DISABLE);
3093
+ }
3094
+ }, {
3095
+ key: "enable",
3096
+ value: function enable() {
3097
+ this.config.disable = false;
3098
+ util$1.removeClass(this.find(".xgplayer-icon"), PLUGIN_STATE_CLASS.ICON_DISABLE);
3099
+ }
3070
3100
  }, {
3071
3101
  key: "children",
3072
3102
  value: function children() {
@@ -3213,7 +3243,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
3213
3243
  var cs = window.getComputedStyle(this.root, null);
3214
3244
  var cssDisplayValue = cs.getPropertyValue("display");
3215
3245
  if (cssDisplayValue === "none") {
3216
- this.root.style.display = "block";
3246
+ return this.root.style.display = "block";
3217
3247
  }
3218
3248
  }
3219
3249
  }, {
@@ -3759,15 +3789,8 @@ var pluginsManager = {
3759
3789
  var item = _Object$keys[_i];
3760
3790
  this.unRegister(cgid, item);
3761
3791
  }
3762
- var _isUseActive = player.isUseActive;
3763
3792
  delete this.pluginGroup[cgid];
3764
3793
  delete player._pluginInfoId;
3765
- if (_isUseActive) {
3766
- var keys = Object.keys(this.pluginGroup);
3767
- if (keys.length > 0) {
3768
- this.setCurrentUserActive(keys[keys.length - 1], true);
3769
- }
3770
- }
3771
3794
  }
3772
3795
  };
3773
3796
  var STATE_CLASS = {
@@ -4549,6 +4572,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4549
4572
  }
4550
4573
  _this.userTimer = null;
4551
4574
  _this.waitTimer = null;
4575
+ _this.handleSource = true;
4552
4576
  _this._state = STATES.INITIAL;
4553
4577
  _this.isError = false;
4554
4578
  _this._hasStart = false;
@@ -4777,6 +4801,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4777
4801
  this.media.removeEventListener("webkitbeginfullscreen", this._onWebkitbeginfullscreen);
4778
4802
  this.media.removeEventListener("webkitendfullscreen", this._onWebkitendfullscreen);
4779
4803
  }
4804
+ }, {
4805
+ key: "_clearUserTimer",
4806
+ value: function _clearUserTimer() {
4807
+ if (!this.userTimer) {
4808
+ return;
4809
+ }
4810
+ util$1.clearTimeout(this, this.userTimer);
4811
+ this.userTimer = null;
4812
+ }
4780
4813
  }, {
4781
4814
  key: "_startInit",
4782
4815
  value: function _startInit(url) {
@@ -4792,13 +4825,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4792
4825
  return;
4793
4826
  }
4794
4827
  }
4795
- this._detachSourceEvents(this.media);
4796
- if (util$1.typeOf(url) === "Array" && url.length > 0) {
4797
- this._attachSourceEvents(this.media, url);
4798
- } else if (!this.media.src || this.media.src !== url) {
4799
- this.media.src = url;
4800
- } else if (!url) {
4801
- this.media.removeAttribute("src");
4828
+ if (this.handleSource) {
4829
+ this._detachSourceEvents(this.media);
4830
+ if (util$1.typeOf(url) === "Array" && url.length > 0) {
4831
+ this._attachSourceEvents(this.media, url);
4832
+ } else if (!this.media.src || this.media.src !== url) {
4833
+ this.media.src = url;
4834
+ } else if (!url) {
4835
+ this.media.removeAttribute("src");
4836
+ }
4802
4837
  }
4803
4838
  if (util$1.typeOf(this.config.volume) === "Number") {
4804
4839
  this.volume = this.config.volume;
@@ -5041,7 +5076,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5041
5076
  if (!url) {
5042
5077
  url = _this8.url || _this8.config.url;
5043
5078
  }
5044
- var _furl = _this8.preProcessUrl(url);
5079
+ var _furl = _this8._preProcessUrl(url);
5045
5080
  var ret = _this8._startInit(_furl.url);
5046
5081
  return ret;
5047
5082
  }).catch(function(e3) {
@@ -5059,7 +5094,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5059
5094
  if (util$1.typeOf(url) === "Object") {
5060
5095
  _src = url.url;
5061
5096
  }
5062
- _src = this.preProcessUrl(_src).url;
5097
+ _src = this._preProcessUrl(_src).url;
5063
5098
  var curTime = this.currentTime;
5064
5099
  this.__startTime = curTime;
5065
5100
  var isPaused = this.paused && !this.isError;
@@ -5289,8 +5324,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5289
5324
  key: "resetState",
5290
5325
  value: function resetState() {
5291
5326
  var _this16 = this;
5292
- var NOT_ALLOW_AUTOPLAY = STATE_CLASS.NOT_ALLOW_AUTOPLAY, PLAYING2 = STATE_CLASS.PLAYING, NO_START = STATE_CLASS.NO_START, PAUSED = STATE_CLASS.PAUSED, REPLAY2 = STATE_CLASS.REPLAY, ENTER = STATE_CLASS.ENTER, ENDED2 = STATE_CLASS.ENDED, ERROR2 = STATE_CLASS.ERROR, LOADING = STATE_CLASS.LOADING;
5293
- var clsList = [NOT_ALLOW_AUTOPLAY, PLAYING2, NO_START, PAUSED, REPLAY2, ENTER, ENDED2, ERROR2, LOADING];
5327
+ var NOT_ALLOW_AUTOPLAY = STATE_CLASS.NOT_ALLOW_AUTOPLAY, PLAYING2 = STATE_CLASS.PLAYING, NO_START = STATE_CLASS.NO_START, PAUSED = STATE_CLASS.PAUSED, REPLAY2 = STATE_CLASS.REPLAY, ENTER = STATE_CLASS.ENTER, ENDED2 = STATE_CLASS.ENDED, ERROR2 = STATE_CLASS.ERROR, LOADING2 = STATE_CLASS.LOADING;
5328
+ var clsList = [NOT_ALLOW_AUTOPLAY, PLAYING2, NO_START, PAUSED, REPLAY2, ENTER, ENDED2, ERROR2, LOADING2];
5294
5329
  this.hasStart = false;
5295
5330
  this.isError = false;
5296
5331
  this._useAutoplay = false;
@@ -5390,7 +5425,6 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5390
5425
  });
5391
5426
  }
5392
5427
  });
5393
- _this19.play();
5394
5428
  _this19.emit(REPLAY);
5395
5429
  _this19.onPlay();
5396
5430
  });
@@ -5404,7 +5438,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5404
5438
  runHooks(this, "retry", function() {
5405
5439
  var cur = _this20.currentTime;
5406
5440
  var url = _this20.config.url;
5407
- var _srcRet = !util$1.isMSE(_this20.media) ? _this20.preProcessUrl(url) : {
5441
+ var _srcRet = !util$1.isMSE(_this20.media) ? _this20._preProcessUrl(url) : {
5408
5442
  url
5409
5443
  };
5410
5444
  _this20.src = _srcRet.url;
@@ -5632,6 +5666,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5632
5666
  this.onBlur(data);
5633
5667
  return;
5634
5668
  }
5669
+ this._clearUserTimer();
5635
5670
  this.emit(PLAYER_BLUR, _objectSpread2$1({
5636
5671
  paused: this.paused,
5637
5672
  ended: this.ended
@@ -5648,18 +5683,12 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5648
5683
  var innerStates = this.innerStates;
5649
5684
  this.isActive = true;
5650
5685
  this.removeClass(STATE_CLASS.INACTIVE);
5651
- if (this.userTimer) {
5652
- util$1.clearTimeout(this, this.userTimer);
5653
- this.userTimer = null;
5654
- }
5686
+ this._clearUserTimer();
5655
5687
  if (data.isLock !== void 0) {
5656
5688
  innerStates.isActiveLocked = data.isLock;
5657
5689
  }
5658
5690
  if (data.autoHide === false || data.isLock === true || innerStates.isActiveLocked) {
5659
- if (this.userTimer) {
5660
- util$1.clearTimeout(this, this.userTimer);
5661
- this.userTimer = null;
5662
- }
5691
+ this._clearUserTimer();
5663
5692
  return;
5664
5693
  }
5665
5694
  var time = data && data.delay ? data.delay : this.config.inactive;
@@ -5672,7 +5701,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5672
5701
  key: "onBlur",
5673
5702
  value: function onBlur() {
5674
5703
  var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$ignorePaused = _ref.ignorePaused, ignorePaused = _ref$ignorePaused === void 0 ? false : _ref$ignorePaused;
5675
- if (!this.isActive || this.innerStates.isActiveLocked) {
5704
+ if (this.innerStates.isActiveLocked) {
5676
5705
  return;
5677
5706
  }
5678
5707
  var closePauseVideoFocus = this.config.closePauseVideoFocus;
@@ -5731,10 +5760,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5731
5760
  this.addClass(STATE_CLASS.PAUSED);
5732
5761
  this.updateAcc("pause");
5733
5762
  if (!this.config.closePauseVideoFocus) {
5734
- if (this.userTimer) {
5735
- util$1.clearTimeout(this, this.userTimer);
5736
- this.userTimer = null;
5737
- }
5763
+ this._clearUserTimer();
5738
5764
  this.focus();
5739
5765
  }
5740
5766
  }
@@ -5785,6 +5811,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5785
5811
  this.updateAcc("waiting");
5786
5812
  this.waitTimer = util$1.setTimeout(this, function() {
5787
5813
  _this22.addClass(STATE_CLASS.LOADING);
5814
+ _this22.emit(LOADING);
5788
5815
  util$1.clearTimeout(_this22, _this22.waitTimer);
5789
5816
  _this22.waitTimer = null;
5790
5817
  }, this.config.minWaitDelay);
@@ -5794,8 +5821,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5794
5821
  value: function onPlaying() {
5795
5822
  var _this23 = this;
5796
5823
  this.isError = false;
5797
- var NO_START = STATE_CLASS.NO_START, PAUSED = STATE_CLASS.PAUSED, ENDED2 = STATE_CLASS.ENDED, ERROR2 = STATE_CLASS.ERROR, REPLAY2 = STATE_CLASS.REPLAY, LOADING = STATE_CLASS.LOADING;
5798
- var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING];
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;
5825
+ var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
5799
5826
  clsList.forEach(function(cls) {
5800
5827
  _this23.removeClass(cls);
5801
5828
  });
@@ -5864,6 +5891,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5864
5891
  }, {
5865
5892
  key: "checkBuffer",
5866
5893
  value: function checkBuffer(time) {
5894
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
5895
+ startDiff: 0,
5896
+ endDiff: 0
5897
+ };
5898
+ var _ref2 = options || {}, _ref2$startDiff = _ref2.startDiff, startDiff = _ref2$startDiff === void 0 ? 0 : _ref2$startDiff, _ref2$endDiff = _ref2.endDiff, endDiff = _ref2$endDiff === void 0 ? 0 : _ref2$endDiff;
5867
5899
  var buffered = this.media.buffered;
5868
5900
  if (!buffered || buffered.length === 0 || !this.duration) {
5869
5901
  return true;
@@ -5871,7 +5903,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5871
5903
  var currentTime = time || this.media.currentTime || 0.2;
5872
5904
  var len = buffered.length;
5873
5905
  for (var i2 = 0; i2 < len; i2++) {
5874
- if (buffered.start(i2) <= currentTime && buffered.end(i2) > currentTime) {
5906
+ if (buffered.start(i2) + startDiff <= currentTime && buffered.end(i2) - endDiff > currentTime) {
5875
5907
  return true;
5876
5908
  }
5877
5909
  }
@@ -6057,10 +6089,10 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6057
6089
  this._state = newState;
6058
6090
  }
6059
6091
  }, {
6060
- key: "preProcessUrl",
6061
- value: function preProcessUrl(url, ext) {
6062
- var preProcessUrl2 = this.config.preProcessUrl;
6063
- return !util$1.isBlob(url) && preProcessUrl2 && typeof preProcessUrl2 === "function" ? preProcessUrl2(url, ext) : {
6092
+ key: "_preProcessUrl",
6093
+ value: function _preProcessUrl(url, ext) {
6094
+ var preProcessUrl = this.config.preProcessUrl;
6095
+ return !util$1.isBlob(url) && typeof preProcessUrl === "function" ? preProcessUrl(url, ext) : {
6064
6096
  url
6065
6097
  };
6066
6098
  }
@@ -6326,13 +6358,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6326
6358
  }
6327
6359
  }, {
6328
6360
  key: "setUserActive",
6329
- value: function setUserActive(isActive) {
6330
- var isMuted = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
6361
+ value: function setUserActive(isActive, isMuted) {
6362
+ var _instManager3;
6331
6363
  if (typeof isMuted === "boolean" && isMuted !== this.muted) {
6332
6364
  this.addInnerOP("volumechange");
6333
- this.muted = isMuted;
6365
+ if (util$1.typeOf(isMuted) === Boolean) {
6366
+ this.muted = isMuted;
6367
+ }
6334
6368
  }
6335
- pluginsManager.setCurrentUserActive(this.playerId, isActive);
6369
+ (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.setActive(this.playerId, isActive);
6336
6370
  }
6337
6371
  }], [{
6338
6372
  key: "debugger",
@@ -6353,14 +6387,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6353
6387
  }, {
6354
6388
  key: "getCurrentUserActivePlayerId",
6355
6389
  value: function getCurrentUserActivePlayerId() {
6356
- var _instManager3;
6357
- return (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.getActiveId();
6390
+ var _instManager4;
6391
+ return (_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.getActiveId();
6358
6392
  }
6359
6393
  }, {
6360
6394
  key: "setCurrentUserActive",
6361
6395
  value: function setCurrentUserActive(playerId, isActive) {
6362
- var _instManager4;
6363
- (_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.setActive(playerId, isActive);
6396
+ var _instManager5;
6397
+ (_instManager5 = instManager) === null || _instManager5 === void 0 ? void 0 : _instManager5.setActive(playerId, isActive);
6364
6398
  }
6365
6399
  }, {
6366
6400
  key: "isHevcSupported",
@@ -6780,8 +6814,8 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
6780
6814
  case "cover":
6781
6815
  _bg = "cover";
6782
6816
  break;
6783
- case "container":
6784
- _bg = "container";
6817
+ case "contain":
6818
+ _bg = "contain";
6785
6819
  break;
6786
6820
  case "fixHeight":
6787
6821
  _bg = "auto 100%";
@@ -7824,6 +7858,7 @@ var PCPlugin = /* @__PURE__ */ function(_BasePlugin) {
7824
7858
  } else {
7825
7859
  player.focus();
7826
7860
  }
7861
+ _this.emit(ENTER_PLAYER);
7827
7862
  });
7828
7863
  _defineProperty$1(_assertThisInitialized(_this), "onMouseLeave", function(e3) {
7829
7864
  var _this$playerConfig = _this.playerConfig, closePlayerBlur = _this$playerConfig.closePlayerBlur, leavePlayerTime = _this$playerConfig.leavePlayerTime, closeDelayBlur = _this$playerConfig.closeDelayBlur;
@@ -7834,9 +7869,12 @@ var PCPlugin = /* @__PURE__ */ function(_BasePlugin) {
7834
7869
  delay: leavePlayerTime
7835
7870
  });
7836
7871
  } else {
7837
- _this.player.blur();
7872
+ _this.player.blur({
7873
+ ignorePaused: true
7874
+ });
7838
7875
  }
7839
7876
  }
7877
+ _this.emit(LEAVE_PLAYER);
7840
7878
  });
7841
7879
  _defineProperty$1(_assertThisInitialized(_this), "onVideoClick", function(e3) {
7842
7880
  var _assertThisInitialize3 = _assertThisInitialized(_this), player = _assertThisInitialize3.player, playerConfig = _assertThisInitialize3.playerConfig;
@@ -8215,6 +8253,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8215
8253
  var touche = _this.getTouche(e3);
8216
8254
  if (touche && !config.disableGesture && _this.duration > 0 && !player.ended) {
8217
8255
  pos.isStart = true;
8256
+ _this.timer && clearTimeout(_this.timer);
8218
8257
  util$1.checkIsFunction(playerConfig.disableSwipeHandler) && playerConfig.disableSwipeHandler();
8219
8258
  _this.find(".xg-dur").innerHTML = util$1.format(_this.duration);
8220
8259
  var rect = _this.root.getBoundingClientRect();
@@ -8275,6 +8314,9 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8275
8314
  });
8276
8315
  _defineProperty$1(_assertThisInitialized(_this), "onTouchEnd", function(e3) {
8277
8316
  var _assertThisInitialize3 = _assertThisInitialized(_this), player = _assertThisInitialize3.player, pos = _assertThisInitialize3.pos, playerConfig = _assertThisInitialize3.playerConfig;
8317
+ setTimeout(function() {
8318
+ player.getPlugin("progress") && player.getPlugin("progress").resetSeekState();
8319
+ }, 10);
8278
8320
  if (!pos.isStart) {
8279
8321
  return;
8280
8322
  }
@@ -8284,9 +8326,6 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8284
8326
  var _this$config = _this.config, disableGesture = _this$config.disableGesture, gestureX = _this$config.gestureX;
8285
8327
  if (!disableGesture && gestureX) {
8286
8328
  _this.endLastMove(pos.scope);
8287
- setTimeout(function() {
8288
- player.getPlugin("progress") && player.getPlugin("progress").resetSeekState();
8289
- }, 10);
8290
8329
  } else {
8291
8330
  pos.time = 0;
8292
8331
  }
@@ -8415,8 +8454,10 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8415
8454
  progressPlugin.addCallBack("dragmove", function(data) {
8416
8455
  _this2.activeSeekNote(data.currentTime, data.forward);
8417
8456
  });
8418
- progressPlugin.addCallBack("dragend", function() {
8419
- _this2.changeAction(ACTIONS.AUTO);
8457
+ ["dragend", "click"].forEach(function(key) {
8458
+ progressPlugin.addCallBack(key, function() {
8459
+ _this2.changeAction(ACTIONS.AUTO);
8460
+ });
8420
8461
  });
8421
8462
  }
8422
8463
  }
@@ -8436,15 +8477,23 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8436
8477
  key: "initCustomStyle",
8437
8478
  value: function initCustomStyle() {
8438
8479
  var _ref = this.playerConfig || {}, commonStyle = _ref.commonStyle;
8439
- var playedColor = commonStyle.playedColor, progressColor = commonStyle.progressColor;
8480
+ var playedColor = commonStyle.playedColor, progressColor = commonStyle.progressColor, timePreviewStyle = commonStyle.timePreviewStyle, curTimeColor = commonStyle.curTimeColor, durationColor = commonStyle.durationColor;
8440
8481
  if (playedColor) {
8441
8482
  this.find(".xg-curbar").style.backgroundColor = playedColor;
8442
- this.find(".xg-cur").style.color = playedColor;
8443
8483
  }
8444
8484
  if (progressColor) {
8445
8485
  this.find(".xg-bar").style.backgroundColor = progressColor;
8446
- this.find(".time-preview").style.color = progressColor;
8447
8486
  }
8487
+ if (timePreviewStyle) {
8488
+ var previewDom = this.find(".time-preview");
8489
+ Object.keys(timePreviewStyle).forEach(function(key) {
8490
+ previewDom.style[key] = timePreviewStyle[key];
8491
+ });
8492
+ }
8493
+ var curColor = curTimeColor || playedColor;
8494
+ var durColor = durationColor;
8495
+ curColor && (this.find(".xg-cur").style.color = curColor);
8496
+ durColor && (this.find(".xg-dur").style.color = durColor);
8448
8497
  this.config.disableTimeProgress && util$1.addClass(this.find(".xg-timebar"), "hide");
8449
8498
  }
8450
8499
  }, {
@@ -8777,7 +8826,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
8777
8826
  key: "render",
8778
8827
  value: function render() {
8779
8828
  var className = this.config.gradient !== "normal" ? "gradient ".concat(this.config.gradient) : "gradient";
8780
- return '\n <xg-trigger class="trigger">\n <div class="'.concat(className, '"></div>\n <div class="time-preview">\n <div class="xg-seek-show ').concat(this.config.disableSeekIcon ? " hide-seek-icon" : "", '">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span>/</span>\n <span class="xg-dur">00:00</span>\n </div>\n <div class="xg-bar xg-timebar">\n <div class="xg-curbar"></div>\n </div>\n </div>\n <div class="xg-playbackrate xg-top-note">\n <span><i>').concat(this.config.pressRate, "X</i>").concat(this.i18n.FORWARD, "</span>\n </div>\n </xg-trigger>\n ");
8829
+ return '\n <xg-trigger class="trigger">\n <div class="'.concat(className, '"></div>\n <div class="time-preview">\n <div class="xg-seek-show ').concat(this.config.disableSeekIcon ? " hide-seek-icon" : "", '">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span class="xg-separator">/</span>\n <span class="xg-dur">00:00</span>\n </div>\n <div class="xg-bar xg-timebar">\n <div class="xg-curbar"></div>\n </div>\n </div>\n <div class="xg-playbackrate xg-top-note">\n <span><i>').concat(this.config.pressRate, "X</i>").concat(this.i18n.FORWARD, "</span>\n </div>\n </xg-trigger>\n ");
8781
8830
  }
8782
8831
  }], [{
8783
8832
  key: "pluginName",
@@ -8971,6 +9020,14 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
8971
9020
  this.player.root.addEventListener("keydown", this.onKeydown);
8972
9021
  document.addEventListener("keydown", this.onBodyKeyDown);
8973
9022
  }
9023
+ }, {
9024
+ key: "setConfig",
9025
+ value: function setConfig(newConfig) {
9026
+ var _this3 = this;
9027
+ Object.keys(newConfig).forEach(function(key) {
9028
+ _this3.config[key] = newConfig[key];
9029
+ });
9030
+ }
8974
9031
  }, {
8975
9032
  key: "checkIsVisible",
8976
9033
  value: function checkIsVisible() {
@@ -8988,11 +9045,11 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
8988
9045
  }, {
8989
9046
  key: "checkCode",
8990
9047
  value: function checkCode(code, isBodyTarget) {
8991
- var _this3 = this;
9048
+ var _this4 = this;
8992
9049
  var flag = false;
8993
9050
  Object.keys(this.keyCodeMap).map(function(key) {
8994
- if (_this3.keyCodeMap[key] && code === _this3.keyCodeMap[key].keyCode && !_this3.keyCodeMap[key].disable) {
8995
- flag = !isBodyTarget || isBodyTarget && !_this3.keyCodeMap[key].noBodyTarget;
9051
+ if (_this4.keyCodeMap[key] && code === _this4.keyCodeMap[key].keyCode && !_this4.keyCodeMap[key].disable) {
9052
+ flag = !isBodyTarget || isBodyTarget && !_this4.keyCodeMap[key].noBodyTarget;
8996
9053
  }
8997
9054
  });
8998
9055
  return flag;
@@ -9183,6 +9240,7 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
9183
9240
  }, this.keyCodeMap[arr[i2]]));
9184
9241
  }
9185
9242
  preventDefault(event);
9243
+ event.stopPropagation();
9186
9244
  break;
9187
9245
  }
9188
9246
  }
@@ -9297,6 +9355,9 @@ var Icon = /* @__PURE__ */ function(_Plugin) {
9297
9355
  value: function afterCreate() {
9298
9356
  this.bind("mouseenter", this._onMouseenter);
9299
9357
  this.bind("mouseleave", this._onMouseLeave);
9358
+ if (this.config.disable) {
9359
+ this.disable();
9360
+ }
9300
9361
  }
9301
9362
  }, {
9302
9363
  key: "destroy",
@@ -9628,9 +9689,15 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
9628
9689
  } else {
9629
9690
  if (player.fullscreen) {
9630
9691
  player.exitFullscreen();
9692
+ if (config.useScreenOrientation) {
9693
+ this.unlockScreen();
9694
+ }
9631
9695
  } else {
9632
9696
  player.getFullscreen().catch(function(e22) {
9633
9697
  });
9698
+ if (config.useScreenOrientation && player.aspectRatio > 1) {
9699
+ this.lockScreen(config.lockOrientationType);
9700
+ }
9634
9701
  }
9635
9702
  }
9636
9703
  }
@@ -9657,6 +9724,24 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
9657
9724
  var langKey = "FULLSCREEN_TIPS";
9658
9725
  return '<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n '.concat(xgIconTips(this, langKey, this.playerConfig.isHideTips), "\n </xg-icon>");
9659
9726
  }
9727
+ }, {
9728
+ key: "lockScreen",
9729
+ value: function lockScreen(orientation) {
9730
+ try {
9731
+ screen.orientation.lock(orientation).catch(function(e3) {
9732
+ });
9733
+ } catch (e3) {
9734
+ }
9735
+ }
9736
+ }, {
9737
+ key: "unlockScreen",
9738
+ value: function unlockScreen() {
9739
+ try {
9740
+ screen.orientation.unlock().catch(function(e3) {
9741
+ });
9742
+ } catch (e3) {
9743
+ }
9744
+ }
9660
9745
  }], [{
9661
9746
  key: "pluginName",
9662
9747
  get: function get() {
@@ -9670,6 +9755,8 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
9670
9755
  index: 0,
9671
9756
  useCssFullscreen: false,
9672
9757
  rotateFullscreen: false,
9758
+ useScreenOrientation: false,
9759
+ lockOrientationType: "landscape",
9673
9760
  switchCallback: null,
9674
9761
  target: null,
9675
9762
  disable: false,
@@ -10532,7 +10619,10 @@ const BaseEvents = {
10532
10619
  AUTOPLAY_FAIL: "autoplayFail",
10533
10620
  AUTOPLAY_SUCCESS: "autoplaySuccess",
10534
10621
  ERROR_REFRESH_CLICK: "errorRefreshClick",
10535
- SOURCE_CHANGE: "sourceChange"
10622
+ SOURCE_CHANGE: "sourceChange",
10623
+ SWITCH_DEFINITION_START: "switchDefinitionStart",
10624
+ SWITCH_DEFINITION_SUCCESS: "switchDefinitionSuccess",
10625
+ DOWN_DEFINITION: "downDefinition"
10536
10626
  };
10537
10627
  const Events$1 = {
10538
10628
  ...XGEvents,
@@ -10578,6 +10668,15 @@ const EVENT_TRANSFORMATION = {
10578
10668
  },
10579
10669
  [BaseEvents.DOWNLOAD_SPEED_CHANGE]: {
10580
10670
  event: DOWNLOAD_SPEED_CHANGE
10671
+ },
10672
+ [BaseEvents.SWITCH_DEFINITION_START]: {
10673
+ event: "switch_definition_start"
10674
+ },
10675
+ [BaseEvents.SWITCH_DEFINITION_SUCCESS]: {
10676
+ event: "switch_definition_success"
10677
+ },
10678
+ [BaseEvents.DOWN_DEFINITION]: {
10679
+ event: "down_definition"
10581
10680
  }
10582
10681
  };
10583
10682
  function transform(event, callback) {
@@ -12477,7 +12576,8 @@ const NAME_MAP = {
12477
12576
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
12478
12577
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
12479
12578
  "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
12480
- "plugin:drm": "veplayer.plugin.drm.[env].[ext]"
12579
+ "plugin:drm": "veplayer.plugin.drm.[env].[ext]",
12580
+ "plugin:abr": "veplayer.plugin.abr.[env].[ext]"
12481
12581
  };
12482
12582
  var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
12483
12583
  DynamicModule2["BizVod"] = "biz:vod";
@@ -12489,6 +12589,7 @@ var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
12489
12589
  DynamicModule2["PluginRtm"] = "plugin:rtm";
12490
12590
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
12491
12591
  DynamicModule2["PluginDrm"] = "plugin:drm";
12592
+ DynamicModule2["PluginAbr"] = "plugin:abr";
12492
12593
  return DynamicModule2;
12493
12594
  })(DynamicModule || {});
12494
12595
  class Loader {
@@ -13802,7 +13903,7 @@ class VePlayerBase {
13802
13903
  * @param callback 表示事件的回调函数。
13803
13904
  */
13804
13905
  /** {en}
13805
- * @brief Listens for a specified event. The event handler is executed only once.
13906
+ * @brief Add a one-time listener function for the specified event.
13806
13907
  * @param event The event name.
13807
13908
  * @param callback The callback function for the event.
13808
13909
  */
@@ -21789,9 +21890,9 @@ class Logger extends Plugin {
21789
21890
  user_id: this._userId,
21790
21891
  device_id: this._deviceId,
21791
21892
  ext: {
21792
- veplayer_version: "2.3.0-rc.3",
21793
- flv_version: "3.0.12",
21794
- hls_version: "3.0.12",
21893
+ veplayer_version: "2.4.0-rc.0",
21894
+ flv_version: "3.0.17",
21895
+ hls_version: "3.0.17",
21795
21896
  rts_version: "0.2.0-alpha.5"
21796
21897
  }
21797
21898
  });
@@ -22086,6 +22187,25 @@ const getDrmStrategy = async (options, player) => {
22086
22187
  }
22087
22188
  return {};
22088
22189
  };
22190
+ const getAbrStrategy = async (options) => {
22191
+ var _a, _b;
22192
+ const streamType = options.url && getStreamType(options.url);
22193
+ if (streamType === "rtm")
22194
+ return {};
22195
+ 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;
22196
+ if (!abrOptions) {
22197
+ return {};
22198
+ }
22199
+ const abrPlugin = await load(DynamicModule.PluginAbr).catch(() => void 0);
22200
+ return {
22201
+ options: {
22202
+ [streamType === "flv" ? "abr" : "hlsabr"]: abrOptions
22203
+ },
22204
+ plugins: [
22205
+ streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
22206
+ ]
22207
+ };
22208
+ };
22089
22209
  VeI18n.extend([
22090
22210
  {
22091
22211
  LANG: "zh-cn",
@@ -22158,6 +22278,14 @@ class VePlayerLive extends VePlayerBase {
22158
22278
  var _a;
22159
22279
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
22160
22280
  }
22281
+ openAbr() {
22282
+ var _a, _b;
22283
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
22284
+ }
22285
+ closeAbr() {
22286
+ var _a, _b;
22287
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
22288
+ }
22161
22289
  /** {zh}
22162
22290
  * @brief 调用此方法更新 DRM 鉴权配置。
22163
22291
  * @hidden
@@ -22166,6 +22294,14 @@ class VePlayerLive extends VePlayerBase {
22166
22294
  var _a, _b, _c;
22167
22295
  (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
22168
22296
  }
22297
+ async switch(target, options) {
22298
+ var _a, _b, _c;
22299
+ const { abr, ...rest } = options ?? {};
22300
+ if (abr) {
22301
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.abr) == null ? void 0 : _c.updateConfig(abr);
22302
+ }
22303
+ return super.switch(target, rest);
22304
+ }
22169
22305
  }
22170
22306
  async function createLivePlayer(options) {
22171
22307
  var _a, _b;
@@ -22190,15 +22326,21 @@ async function createLivePlayer(options) {
22190
22326
  };
22191
22327
  },
22192
22328
  async preparePlugins(url) {
22193
- const [typeStrategy, drmStrategy] = await Promise.all([
22329
+ const [typeStrategy, drmStrategy, abrStrategy] = await Promise.all([
22194
22330
  getTypeStrategy({ ...finalOptions, url }, player),
22195
- getDrmStrategy({ ...finalOptions, url }, player)
22331
+ getDrmStrategy({ ...finalOptions, url }, player),
22332
+ getAbrStrategy({ ...finalOptions, url })
22196
22333
  ]);
22197
22334
  const { options: options2, plugins } = typeStrategy ?? {};
22198
22335
  const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
22336
+ const { options: abrOptions, plugins: abrPlugins } = abrStrategy ?? {};
22199
22337
  return {
22200
- options: Object.assign({}, options2, drmOptions),
22201
- plugins: [...plugins ?? [], ...drmPlugins ?? []]
22338
+ options: Object.assign({}, options2, drmOptions, abrOptions),
22339
+ plugins: [
22340
+ ...plugins ?? [],
22341
+ ...drmPlugins ?? [],
22342
+ ...abrPlugins ?? []
22343
+ ]
22202
22344
  };
22203
22345
  }
22204
22346
  },