@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
@@ -1014,6 +1014,9 @@ var __publicField = (obj, key, value) => {
1014
1014
  _fun && _fun(frameId);
1015
1015
  };
1016
1016
  util$1.isMSE = function(video) {
1017
+ if (video.media) {
1018
+ video = video.media;
1019
+ }
1017
1020
  if (!video || !(video instanceof HTMLMediaElement)) {
1018
1021
  return false;
1019
1022
  }
@@ -1458,7 +1461,7 @@ var __publicField = (obj, key, value) => {
1458
1461
  }
1459
1462
  }
1460
1463
  };
1461
- var version = "3.0.12";
1464
+ var version = "3.0.17";
1462
1465
  var ERROR_TYPE_MAP = {
1463
1466
  1: "media",
1464
1467
  2: "media",
@@ -1564,6 +1567,9 @@ var __publicField = (obj, key, value) => {
1564
1567
  var DESTROY = "destroy";
1565
1568
  var URL_CHANGE = "urlchange";
1566
1569
  var DOWNLOAD_SPEED_CHANGE = "download_speed_change";
1570
+ var LEAVE_PLAYER = "leaveplayer";
1571
+ var ENTER_PLAYER = "enterplayer";
1572
+ var LOADING = "loading";
1567
1573
  var FULLSCREEN_CHANGE = "fullscreen_change";
1568
1574
  var CSS_FULLSCREEN_CHANGE = "cssFullscreen_change";
1569
1575
  var MINI_STATE_CHANGE = "mini_state_change";
@@ -1609,11 +1615,14 @@ var __publicField = (obj, key, value) => {
1609
1615
  DURATION_CHANGE,
1610
1616
  EMPTIED,
1611
1617
  ENDED,
1618
+ ENTER_PLAYER,
1612
1619
  ERROR,
1613
1620
  FPS_STUCK,
1614
1621
  FULLSCREEN_CHANGE,
1622
+ LEAVE_PLAYER,
1615
1623
  LOADED_DATA,
1616
1624
  LOADED_METADATA,
1625
+ LOADING,
1617
1626
  LOAD_START,
1618
1627
  MINI_STATE_CHANGE,
1619
1628
  PAUSE,
@@ -2213,6 +2222,11 @@ var __publicField = (obj, key, value) => {
2213
2222
  }
2214
2223
  this.media.volume = vol;
2215
2224
  }
2225
+ }, {
2226
+ key: "aspectRatio",
2227
+ get: function get() {
2228
+ return this.media ? this.media.videoWidth / this.media.videoHeight : 0;
2229
+ }
2216
2230
  }, {
2217
2231
  key: "addInnerOP",
2218
2232
  value: function addInnerOP(event) {
@@ -2838,6 +2852,10 @@ var __publicField = (obj, key, value) => {
2838
2852
  CONTROLS_CENTER: "controlsCenter",
2839
2853
  CONTROLS: "controls"
2840
2854
  };
2855
+ var PLUGIN_STATE_CLASS = {
2856
+ ICON_DISABLE: "xg-icon-disable",
2857
+ ICON_HIDE: "xg-icon-hide"
2858
+ };
2841
2859
  function isUrl(str) {
2842
2860
  if (!str) {
2843
2861
  return false;
@@ -3071,6 +3089,18 @@ var __publicField = (obj, key, value) => {
3071
3089
  value: function plugins() {
3072
3090
  return this._children;
3073
3091
  }
3092
+ }, {
3093
+ key: "disable",
3094
+ value: function disable() {
3095
+ this.config.disable = true;
3096
+ util$1.addClass(this.find(".xgplayer-icon"), PLUGIN_STATE_CLASS.ICON_DISABLE);
3097
+ }
3098
+ }, {
3099
+ key: "enable",
3100
+ value: function enable() {
3101
+ this.config.disable = false;
3102
+ util$1.removeClass(this.find(".xgplayer-icon"), PLUGIN_STATE_CLASS.ICON_DISABLE);
3103
+ }
3074
3104
  }, {
3075
3105
  key: "children",
3076
3106
  value: function children() {
@@ -3217,7 +3247,7 @@ var __publicField = (obj, key, value) => {
3217
3247
  var cs = window.getComputedStyle(this.root, null);
3218
3248
  var cssDisplayValue = cs.getPropertyValue("display");
3219
3249
  if (cssDisplayValue === "none") {
3220
- this.root.style.display = "block";
3250
+ return this.root.style.display = "block";
3221
3251
  }
3222
3252
  }
3223
3253
  }, {
@@ -3763,15 +3793,8 @@ var __publicField = (obj, key, value) => {
3763
3793
  var item = _Object$keys[_i];
3764
3794
  this.unRegister(cgid, item);
3765
3795
  }
3766
- var _isUseActive = player.isUseActive;
3767
3796
  delete this.pluginGroup[cgid];
3768
3797
  delete player._pluginInfoId;
3769
- if (_isUseActive) {
3770
- var keys = Object.keys(this.pluginGroup);
3771
- if (keys.length > 0) {
3772
- this.setCurrentUserActive(keys[keys.length - 1], true);
3773
- }
3774
- }
3775
3798
  }
3776
3799
  };
3777
3800
  var STATE_CLASS = {
@@ -4553,6 +4576,7 @@ var __publicField = (obj, key, value) => {
4553
4576
  }
4554
4577
  _this.userTimer = null;
4555
4578
  _this.waitTimer = null;
4579
+ _this.handleSource = true;
4556
4580
  _this._state = STATES.INITIAL;
4557
4581
  _this.isError = false;
4558
4582
  _this._hasStart = false;
@@ -4781,6 +4805,15 @@ var __publicField = (obj, key, value) => {
4781
4805
  this.media.removeEventListener("webkitbeginfullscreen", this._onWebkitbeginfullscreen);
4782
4806
  this.media.removeEventListener("webkitendfullscreen", this._onWebkitendfullscreen);
4783
4807
  }
4808
+ }, {
4809
+ key: "_clearUserTimer",
4810
+ value: function _clearUserTimer() {
4811
+ if (!this.userTimer) {
4812
+ return;
4813
+ }
4814
+ util$1.clearTimeout(this, this.userTimer);
4815
+ this.userTimer = null;
4816
+ }
4784
4817
  }, {
4785
4818
  key: "_startInit",
4786
4819
  value: function _startInit(url) {
@@ -4796,13 +4829,15 @@ var __publicField = (obj, key, value) => {
4796
4829
  return;
4797
4830
  }
4798
4831
  }
4799
- this._detachSourceEvents(this.media);
4800
- if (util$1.typeOf(url) === "Array" && url.length > 0) {
4801
- this._attachSourceEvents(this.media, url);
4802
- } else if (!this.media.src || this.media.src !== url) {
4803
- this.media.src = url;
4804
- } else if (!url) {
4805
- this.media.removeAttribute("src");
4832
+ if (this.handleSource) {
4833
+ this._detachSourceEvents(this.media);
4834
+ if (util$1.typeOf(url) === "Array" && url.length > 0) {
4835
+ this._attachSourceEvents(this.media, url);
4836
+ } else if (!this.media.src || this.media.src !== url) {
4837
+ this.media.src = url;
4838
+ } else if (!url) {
4839
+ this.media.removeAttribute("src");
4840
+ }
4806
4841
  }
4807
4842
  if (util$1.typeOf(this.config.volume) === "Number") {
4808
4843
  this.volume = this.config.volume;
@@ -5045,7 +5080,7 @@ var __publicField = (obj, key, value) => {
5045
5080
  if (!url) {
5046
5081
  url = _this8.url || _this8.config.url;
5047
5082
  }
5048
- var _furl = _this8.preProcessUrl(url);
5083
+ var _furl = _this8._preProcessUrl(url);
5049
5084
  var ret = _this8._startInit(_furl.url);
5050
5085
  return ret;
5051
5086
  }).catch(function(e2) {
@@ -5063,7 +5098,7 @@ var __publicField = (obj, key, value) => {
5063
5098
  if (util$1.typeOf(url) === "Object") {
5064
5099
  _src = url.url;
5065
5100
  }
5066
- _src = this.preProcessUrl(_src).url;
5101
+ _src = this._preProcessUrl(_src).url;
5067
5102
  var curTime = this.currentTime;
5068
5103
  this.__startTime = curTime;
5069
5104
  var isPaused = this.paused && !this.isError;
@@ -5293,8 +5328,8 @@ var __publicField = (obj, key, value) => {
5293
5328
  key: "resetState",
5294
5329
  value: function resetState() {
5295
5330
  var _this16 = this;
5296
- 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;
5297
- var clsList = [NOT_ALLOW_AUTOPLAY, PLAYING2, NO_START, PAUSED, REPLAY2, ENTER, ENDED2, ERROR2, LOADING];
5331
+ 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;
5332
+ var clsList = [NOT_ALLOW_AUTOPLAY, PLAYING2, NO_START, PAUSED, REPLAY2, ENTER, ENDED2, ERROR2, LOADING2];
5298
5333
  this.hasStart = false;
5299
5334
  this.isError = false;
5300
5335
  this._useAutoplay = false;
@@ -5394,7 +5429,6 @@ var __publicField = (obj, key, value) => {
5394
5429
  });
5395
5430
  }
5396
5431
  });
5397
- _this19.play();
5398
5432
  _this19.emit(REPLAY);
5399
5433
  _this19.onPlay();
5400
5434
  });
@@ -5408,7 +5442,7 @@ var __publicField = (obj, key, value) => {
5408
5442
  runHooks(this, "retry", function() {
5409
5443
  var cur = _this20.currentTime;
5410
5444
  var url = _this20.config.url;
5411
- var _srcRet = !util$1.isMSE(_this20.media) ? _this20.preProcessUrl(url) : {
5445
+ var _srcRet = !util$1.isMSE(_this20.media) ? _this20._preProcessUrl(url) : {
5412
5446
  url
5413
5447
  };
5414
5448
  _this20.src = _srcRet.url;
@@ -5636,6 +5670,7 @@ var __publicField = (obj, key, value) => {
5636
5670
  this.onBlur(data);
5637
5671
  return;
5638
5672
  }
5673
+ this._clearUserTimer();
5639
5674
  this.emit(PLAYER_BLUR, _objectSpread2$1({
5640
5675
  paused: this.paused,
5641
5676
  ended: this.ended
@@ -5652,18 +5687,12 @@ var __publicField = (obj, key, value) => {
5652
5687
  var innerStates = this.innerStates;
5653
5688
  this.isActive = true;
5654
5689
  this.removeClass(STATE_CLASS.INACTIVE);
5655
- if (this.userTimer) {
5656
- util$1.clearTimeout(this, this.userTimer);
5657
- this.userTimer = null;
5658
- }
5690
+ this._clearUserTimer();
5659
5691
  if (data.isLock !== void 0) {
5660
5692
  innerStates.isActiveLocked = data.isLock;
5661
5693
  }
5662
5694
  if (data.autoHide === false || data.isLock === true || innerStates.isActiveLocked) {
5663
- if (this.userTimer) {
5664
- util$1.clearTimeout(this, this.userTimer);
5665
- this.userTimer = null;
5666
- }
5695
+ this._clearUserTimer();
5667
5696
  return;
5668
5697
  }
5669
5698
  var time = data && data.delay ? data.delay : this.config.inactive;
@@ -5676,7 +5705,7 @@ var __publicField = (obj, key, value) => {
5676
5705
  key: "onBlur",
5677
5706
  value: function onBlur() {
5678
5707
  var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$ignorePaused = _ref.ignorePaused, ignorePaused = _ref$ignorePaused === void 0 ? false : _ref$ignorePaused;
5679
- if (!this.isActive || this.innerStates.isActiveLocked) {
5708
+ if (this.innerStates.isActiveLocked) {
5680
5709
  return;
5681
5710
  }
5682
5711
  var closePauseVideoFocus = this.config.closePauseVideoFocus;
@@ -5735,10 +5764,7 @@ var __publicField = (obj, key, value) => {
5735
5764
  this.addClass(STATE_CLASS.PAUSED);
5736
5765
  this.updateAcc("pause");
5737
5766
  if (!this.config.closePauseVideoFocus) {
5738
- if (this.userTimer) {
5739
- util$1.clearTimeout(this, this.userTimer);
5740
- this.userTimer = null;
5741
- }
5767
+ this._clearUserTimer();
5742
5768
  this.focus();
5743
5769
  }
5744
5770
  }
@@ -5789,6 +5815,7 @@ var __publicField = (obj, key, value) => {
5789
5815
  this.updateAcc("waiting");
5790
5816
  this.waitTimer = util$1.setTimeout(this, function() {
5791
5817
  _this22.addClass(STATE_CLASS.LOADING);
5818
+ _this22.emit(LOADING);
5792
5819
  util$1.clearTimeout(_this22, _this22.waitTimer);
5793
5820
  _this22.waitTimer = null;
5794
5821
  }, this.config.minWaitDelay);
@@ -5798,8 +5825,8 @@ var __publicField = (obj, key, value) => {
5798
5825
  value: function onPlaying() {
5799
5826
  var _this23 = this;
5800
5827
  this.isError = false;
5801
- 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;
5802
- var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING];
5828
+ 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;
5829
+ var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
5803
5830
  clsList.forEach(function(cls) {
5804
5831
  _this23.removeClass(cls);
5805
5832
  });
@@ -5868,6 +5895,11 @@ var __publicField = (obj, key, value) => {
5868
5895
  }, {
5869
5896
  key: "checkBuffer",
5870
5897
  value: function checkBuffer(time) {
5898
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
5899
+ startDiff: 0,
5900
+ endDiff: 0
5901
+ };
5902
+ 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;
5871
5903
  var buffered = this.media.buffered;
5872
5904
  if (!buffered || buffered.length === 0 || !this.duration) {
5873
5905
  return true;
@@ -5875,7 +5907,7 @@ var __publicField = (obj, key, value) => {
5875
5907
  var currentTime = time || this.media.currentTime || 0.2;
5876
5908
  var len = buffered.length;
5877
5909
  for (var i2 = 0; i2 < len; i2++) {
5878
- if (buffered.start(i2) <= currentTime && buffered.end(i2) > currentTime) {
5910
+ if (buffered.start(i2) + startDiff <= currentTime && buffered.end(i2) - endDiff > currentTime) {
5879
5911
  return true;
5880
5912
  }
5881
5913
  }
@@ -6061,10 +6093,10 @@ var __publicField = (obj, key, value) => {
6061
6093
  this._state = newState;
6062
6094
  }
6063
6095
  }, {
6064
- key: "preProcessUrl",
6065
- value: function preProcessUrl(url, ext) {
6066
- var preProcessUrl2 = this.config.preProcessUrl;
6067
- return !util$1.isBlob(url) && preProcessUrl2 && typeof preProcessUrl2 === "function" ? preProcessUrl2(url, ext) : {
6096
+ key: "_preProcessUrl",
6097
+ value: function _preProcessUrl(url, ext) {
6098
+ var preProcessUrl = this.config.preProcessUrl;
6099
+ return !util$1.isBlob(url) && typeof preProcessUrl === "function" ? preProcessUrl(url, ext) : {
6068
6100
  url
6069
6101
  };
6070
6102
  }
@@ -6330,13 +6362,15 @@ var __publicField = (obj, key, value) => {
6330
6362
  }
6331
6363
  }, {
6332
6364
  key: "setUserActive",
6333
- value: function setUserActive(isActive) {
6334
- var isMuted = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
6365
+ value: function setUserActive(isActive, isMuted) {
6366
+ var _instManager3;
6335
6367
  if (typeof isMuted === "boolean" && isMuted !== this.muted) {
6336
6368
  this.addInnerOP("volumechange");
6337
- this.muted = isMuted;
6369
+ if (util$1.typeOf(isMuted) === Boolean) {
6370
+ this.muted = isMuted;
6371
+ }
6338
6372
  }
6339
- pluginsManager.setCurrentUserActive(this.playerId, isActive);
6373
+ (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.setActive(this.playerId, isActive);
6340
6374
  }
6341
6375
  }], [{
6342
6376
  key: "debugger",
@@ -6357,14 +6391,14 @@ var __publicField = (obj, key, value) => {
6357
6391
  }, {
6358
6392
  key: "getCurrentUserActivePlayerId",
6359
6393
  value: function getCurrentUserActivePlayerId() {
6360
- var _instManager3;
6361
- return (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.getActiveId();
6394
+ var _instManager4;
6395
+ return (_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.getActiveId();
6362
6396
  }
6363
6397
  }, {
6364
6398
  key: "setCurrentUserActive",
6365
6399
  value: function setCurrentUserActive(playerId, isActive) {
6366
- var _instManager4;
6367
- (_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.setActive(playerId, isActive);
6400
+ var _instManager5;
6401
+ (_instManager5 = instManager) === null || _instManager5 === void 0 ? void 0 : _instManager5.setActive(playerId, isActive);
6368
6402
  }
6369
6403
  }, {
6370
6404
  key: "isHevcSupported",
@@ -6784,8 +6818,8 @@ var __publicField = (obj, key, value) => {
6784
6818
  case "cover":
6785
6819
  _bg = "cover";
6786
6820
  break;
6787
- case "container":
6788
- _bg = "container";
6821
+ case "contain":
6822
+ _bg = "contain";
6789
6823
  break;
6790
6824
  case "fixHeight":
6791
6825
  _bg = "auto 100%";
@@ -7828,6 +7862,7 @@ var __publicField = (obj, key, value) => {
7828
7862
  } else {
7829
7863
  player.focus();
7830
7864
  }
7865
+ _this.emit(ENTER_PLAYER);
7831
7866
  });
7832
7867
  _defineProperty$1(_assertThisInitialized(_this), "onMouseLeave", function(e2) {
7833
7868
  var _this$playerConfig = _this.playerConfig, closePlayerBlur = _this$playerConfig.closePlayerBlur, leavePlayerTime = _this$playerConfig.leavePlayerTime, closeDelayBlur = _this$playerConfig.closeDelayBlur;
@@ -7838,9 +7873,12 @@ var __publicField = (obj, key, value) => {
7838
7873
  delay: leavePlayerTime
7839
7874
  });
7840
7875
  } else {
7841
- _this.player.blur();
7876
+ _this.player.blur({
7877
+ ignorePaused: true
7878
+ });
7842
7879
  }
7843
7880
  }
7881
+ _this.emit(LEAVE_PLAYER);
7844
7882
  });
7845
7883
  _defineProperty$1(_assertThisInitialized(_this), "onVideoClick", function(e2) {
7846
7884
  var _assertThisInitialize3 = _assertThisInitialized(_this), player = _assertThisInitialize3.player, playerConfig = _assertThisInitialize3.playerConfig;
@@ -8219,6 +8257,7 @@ var __publicField = (obj, key, value) => {
8219
8257
  var touche = _this.getTouche(e2);
8220
8258
  if (touche && !config.disableGesture && _this.duration > 0 && !player.ended) {
8221
8259
  pos.isStart = true;
8260
+ _this.timer && clearTimeout(_this.timer);
8222
8261
  util$1.checkIsFunction(playerConfig.disableSwipeHandler) && playerConfig.disableSwipeHandler();
8223
8262
  _this.find(".xg-dur").innerHTML = util$1.format(_this.duration);
8224
8263
  var rect = _this.root.getBoundingClientRect();
@@ -8279,6 +8318,9 @@ var __publicField = (obj, key, value) => {
8279
8318
  });
8280
8319
  _defineProperty$1(_assertThisInitialized(_this), "onTouchEnd", function(e2) {
8281
8320
  var _assertThisInitialize3 = _assertThisInitialized(_this), player = _assertThisInitialize3.player, pos = _assertThisInitialize3.pos, playerConfig = _assertThisInitialize3.playerConfig;
8321
+ setTimeout(function() {
8322
+ player.getPlugin("progress") && player.getPlugin("progress").resetSeekState();
8323
+ }, 10);
8282
8324
  if (!pos.isStart) {
8283
8325
  return;
8284
8326
  }
@@ -8288,9 +8330,6 @@ var __publicField = (obj, key, value) => {
8288
8330
  var _this$config = _this.config, disableGesture = _this$config.disableGesture, gestureX = _this$config.gestureX;
8289
8331
  if (!disableGesture && gestureX) {
8290
8332
  _this.endLastMove(pos.scope);
8291
- setTimeout(function() {
8292
- player.getPlugin("progress") && player.getPlugin("progress").resetSeekState();
8293
- }, 10);
8294
8333
  } else {
8295
8334
  pos.time = 0;
8296
8335
  }
@@ -8419,8 +8458,10 @@ var __publicField = (obj, key, value) => {
8419
8458
  progressPlugin.addCallBack("dragmove", function(data) {
8420
8459
  _this2.activeSeekNote(data.currentTime, data.forward);
8421
8460
  });
8422
- progressPlugin.addCallBack("dragend", function() {
8423
- _this2.changeAction(ACTIONS.AUTO);
8461
+ ["dragend", "click"].forEach(function(key) {
8462
+ progressPlugin.addCallBack(key, function() {
8463
+ _this2.changeAction(ACTIONS.AUTO);
8464
+ });
8424
8465
  });
8425
8466
  }
8426
8467
  }
@@ -8440,15 +8481,23 @@ var __publicField = (obj, key, value) => {
8440
8481
  key: "initCustomStyle",
8441
8482
  value: function initCustomStyle() {
8442
8483
  var _ref = this.playerConfig || {}, commonStyle = _ref.commonStyle;
8443
- var playedColor = commonStyle.playedColor, progressColor = commonStyle.progressColor;
8484
+ var playedColor = commonStyle.playedColor, progressColor = commonStyle.progressColor, timePreviewStyle = commonStyle.timePreviewStyle, curTimeColor = commonStyle.curTimeColor, durationColor = commonStyle.durationColor;
8444
8485
  if (playedColor) {
8445
8486
  this.find(".xg-curbar").style.backgroundColor = playedColor;
8446
- this.find(".xg-cur").style.color = playedColor;
8447
8487
  }
8448
8488
  if (progressColor) {
8449
8489
  this.find(".xg-bar").style.backgroundColor = progressColor;
8450
- this.find(".time-preview").style.color = progressColor;
8451
8490
  }
8491
+ if (timePreviewStyle) {
8492
+ var previewDom = this.find(".time-preview");
8493
+ Object.keys(timePreviewStyle).forEach(function(key) {
8494
+ previewDom.style[key] = timePreviewStyle[key];
8495
+ });
8496
+ }
8497
+ var curColor = curTimeColor || playedColor;
8498
+ var durColor = durationColor;
8499
+ curColor && (this.find(".xg-cur").style.color = curColor);
8500
+ durColor && (this.find(".xg-dur").style.color = durColor);
8452
8501
  this.config.disableTimeProgress && util$1.addClass(this.find(".xg-timebar"), "hide");
8453
8502
  }
8454
8503
  }, {
@@ -8781,7 +8830,7 @@ var __publicField = (obj, key, value) => {
8781
8830
  key: "render",
8782
8831
  value: function render() {
8783
8832
  var className = this.config.gradient !== "normal" ? "gradient ".concat(this.config.gradient) : "gradient";
8784
- 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 ");
8833
+ 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 ");
8785
8834
  }
8786
8835
  }], [{
8787
8836
  key: "pluginName",
@@ -8975,6 +9024,14 @@ var __publicField = (obj, key, value) => {
8975
9024
  this.player.root.addEventListener("keydown", this.onKeydown);
8976
9025
  document.addEventListener("keydown", this.onBodyKeyDown);
8977
9026
  }
9027
+ }, {
9028
+ key: "setConfig",
9029
+ value: function setConfig(newConfig) {
9030
+ var _this3 = this;
9031
+ Object.keys(newConfig).forEach(function(key) {
9032
+ _this3.config[key] = newConfig[key];
9033
+ });
9034
+ }
8978
9035
  }, {
8979
9036
  key: "checkIsVisible",
8980
9037
  value: function checkIsVisible() {
@@ -8992,11 +9049,11 @@ var __publicField = (obj, key, value) => {
8992
9049
  }, {
8993
9050
  key: "checkCode",
8994
9051
  value: function checkCode(code, isBodyTarget) {
8995
- var _this3 = this;
9052
+ var _this4 = this;
8996
9053
  var flag = false;
8997
9054
  Object.keys(this.keyCodeMap).map(function(key) {
8998
- if (_this3.keyCodeMap[key] && code === _this3.keyCodeMap[key].keyCode && !_this3.keyCodeMap[key].disable) {
8999
- flag = !isBodyTarget || isBodyTarget && !_this3.keyCodeMap[key].noBodyTarget;
9055
+ if (_this4.keyCodeMap[key] && code === _this4.keyCodeMap[key].keyCode && !_this4.keyCodeMap[key].disable) {
9056
+ flag = !isBodyTarget || isBodyTarget && !_this4.keyCodeMap[key].noBodyTarget;
9000
9057
  }
9001
9058
  });
9002
9059
  return flag;
@@ -9187,6 +9244,7 @@ var __publicField = (obj, key, value) => {
9187
9244
  }, this.keyCodeMap[arr[i2]]));
9188
9245
  }
9189
9246
  preventDefault(event);
9247
+ event.stopPropagation();
9190
9248
  break;
9191
9249
  }
9192
9250
  }
@@ -9301,6 +9359,9 @@ var __publicField = (obj, key, value) => {
9301
9359
  value: function afterCreate() {
9302
9360
  this.bind("mouseenter", this._onMouseenter);
9303
9361
  this.bind("mouseleave", this._onMouseLeave);
9362
+ if (this.config.disable) {
9363
+ this.disable();
9364
+ }
9304
9365
  }
9305
9366
  }, {
9306
9367
  key: "destroy",
@@ -9632,9 +9693,15 @@ var __publicField = (obj, key, value) => {
9632
9693
  } else {
9633
9694
  if (player.fullscreen) {
9634
9695
  player.exitFullscreen();
9696
+ if (config.useScreenOrientation) {
9697
+ this.unlockScreen();
9698
+ }
9635
9699
  } else {
9636
9700
  player.getFullscreen().catch(function(e22) {
9637
9701
  });
9702
+ if (config.useScreenOrientation && player.aspectRatio > 1) {
9703
+ this.lockScreen(config.lockOrientationType);
9704
+ }
9638
9705
  }
9639
9706
  }
9640
9707
  }
@@ -9661,6 +9728,24 @@ var __publicField = (obj, key, value) => {
9661
9728
  var langKey = "FULLSCREEN_TIPS";
9662
9729
  return '<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n '.concat(xgIconTips(this, langKey, this.playerConfig.isHideTips), "\n </xg-icon>");
9663
9730
  }
9731
+ }, {
9732
+ key: "lockScreen",
9733
+ value: function lockScreen(orientation) {
9734
+ try {
9735
+ screen.orientation.lock(orientation).catch(function(e2) {
9736
+ });
9737
+ } catch (e2) {
9738
+ }
9739
+ }
9740
+ }, {
9741
+ key: "unlockScreen",
9742
+ value: function unlockScreen() {
9743
+ try {
9744
+ screen.orientation.unlock().catch(function(e2) {
9745
+ });
9746
+ } catch (e2) {
9747
+ }
9748
+ }
9664
9749
  }], [{
9665
9750
  key: "pluginName",
9666
9751
  get: function get() {
@@ -9674,6 +9759,8 @@ var __publicField = (obj, key, value) => {
9674
9759
  index: 0,
9675
9760
  useCssFullscreen: false,
9676
9761
  rotateFullscreen: false,
9762
+ useScreenOrientation: false,
9763
+ lockOrientationType: "landscape",
9677
9764
  switchCallback: null,
9678
9765
  target: null,
9679
9766
  disable: false,
@@ -10536,7 +10623,10 @@ var __publicField = (obj, key, value) => {
10536
10623
  AUTOPLAY_FAIL: "autoplayFail",
10537
10624
  AUTOPLAY_SUCCESS: "autoplaySuccess",
10538
10625
  ERROR_REFRESH_CLICK: "errorRefreshClick",
10539
- SOURCE_CHANGE: "sourceChange"
10626
+ SOURCE_CHANGE: "sourceChange",
10627
+ SWITCH_DEFINITION_START: "switchDefinitionStart",
10628
+ SWITCH_DEFINITION_SUCCESS: "switchDefinitionSuccess",
10629
+ DOWN_DEFINITION: "downDefinition"
10540
10630
  };
10541
10631
  const Events$1 = {
10542
10632
  ...XGEvents,
@@ -10582,6 +10672,15 @@ var __publicField = (obj, key, value) => {
10582
10672
  },
10583
10673
  [BaseEvents.DOWNLOAD_SPEED_CHANGE]: {
10584
10674
  event: DOWNLOAD_SPEED_CHANGE
10675
+ },
10676
+ [BaseEvents.SWITCH_DEFINITION_START]: {
10677
+ event: "switch_definition_start"
10678
+ },
10679
+ [BaseEvents.SWITCH_DEFINITION_SUCCESS]: {
10680
+ event: "switch_definition_success"
10681
+ },
10682
+ [BaseEvents.DOWN_DEFINITION]: {
10683
+ event: "down_definition"
10585
10684
  }
10586
10685
  };
10587
10686
  function transform(event, callback) {
@@ -12481,7 +12580,8 @@ var __publicField = (obj, key, value) => {
12481
12580
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
12482
12581
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
12483
12582
  "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
12484
- "plugin:drm": "veplayer.plugin.drm.[env].[ext]"
12583
+ "plugin:drm": "veplayer.plugin.drm.[env].[ext]",
12584
+ "plugin:abr": "veplayer.plugin.abr.[env].[ext]"
12485
12585
  };
12486
12586
  var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
12487
12587
  DynamicModule2["BizVod"] = "biz:vod";
@@ -12493,6 +12593,7 @@ var __publicField = (obj, key, value) => {
12493
12593
  DynamicModule2["PluginRtm"] = "plugin:rtm";
12494
12594
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
12495
12595
  DynamicModule2["PluginDrm"] = "plugin:drm";
12596
+ DynamicModule2["PluginAbr"] = "plugin:abr";
12496
12597
  return DynamicModule2;
12497
12598
  })(DynamicModule || {});
12498
12599
  class Loader {
@@ -13806,7 +13907,7 @@ var __publicField = (obj, key, value) => {
13806
13907
  * @param callback 表示事件的回调函数。
13807
13908
  */
13808
13909
  /** {en}
13809
- * @brief Listens for a specified event. The event handler is executed only once.
13910
+ * @brief Add a one-time listener function for the specified event.
13810
13911
  * @param event The event name.
13811
13912
  * @param callback The callback function for the event.
13812
13913
  */
@@ -21793,9 +21894,9 @@ var __publicField = (obj, key, value) => {
21793
21894
  user_id: this._userId,
21794
21895
  device_id: this._deviceId,
21795
21896
  ext: {
21796
- veplayer_version: "2.3.0-rc.3",
21797
- flv_version: "3.0.12",
21798
- hls_version: "3.0.12",
21897
+ veplayer_version: "2.4.0-rc.0",
21898
+ flv_version: "3.0.17",
21899
+ hls_version: "3.0.17",
21799
21900
  rts_version: "0.2.0-alpha.5"
21800
21901
  }
21801
21902
  });
@@ -22090,6 +22191,25 @@ var __publicField = (obj, key, value) => {
22090
22191
  }
22091
22192
  return {};
22092
22193
  };
22194
+ const getAbrStrategy = async (options) => {
22195
+ var _a, _b;
22196
+ const streamType = options.url && getStreamType(options.url);
22197
+ if (streamType === "rtm")
22198
+ return {};
22199
+ 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;
22200
+ if (!abrOptions) {
22201
+ return {};
22202
+ }
22203
+ const abrPlugin = await load(DynamicModule.PluginAbr).catch(() => void 0);
22204
+ return {
22205
+ options: {
22206
+ [streamType === "flv" ? "abr" : "hlsabr"]: abrOptions
22207
+ },
22208
+ plugins: [
22209
+ streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
22210
+ ]
22211
+ };
22212
+ };
22093
22213
  VeI18n.extend([
22094
22214
  {
22095
22215
  LANG: "zh-cn",
@@ -22162,6 +22282,14 @@ var __publicField = (obj, key, value) => {
22162
22282
  var _a;
22163
22283
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
22164
22284
  }
22285
+ openAbr() {
22286
+ var _a, _b;
22287
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
22288
+ }
22289
+ closeAbr() {
22290
+ var _a, _b;
22291
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
22292
+ }
22165
22293
  /** {zh}
22166
22294
  * @brief 调用此方法更新 DRM 鉴权配置。
22167
22295
  * @hidden
@@ -22170,6 +22298,14 @@ var __publicField = (obj, key, value) => {
22170
22298
  var _a, _b, _c;
22171
22299
  (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
22172
22300
  }
22301
+ async switch(target, options) {
22302
+ var _a, _b, _c;
22303
+ const { abr, ...rest } = options ?? {};
22304
+ if (abr) {
22305
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.abr) == null ? void 0 : _c.updateConfig(abr);
22306
+ }
22307
+ return super.switch(target, rest);
22308
+ }
22173
22309
  }
22174
22310
  async function createLivePlayer(options) {
22175
22311
  var _a, _b;
@@ -22194,15 +22330,21 @@ var __publicField = (obj, key, value) => {
22194
22330
  };
22195
22331
  },
22196
22332
  async preparePlugins(url) {
22197
- const [typeStrategy, drmStrategy] = await Promise.all([
22333
+ const [typeStrategy, drmStrategy, abrStrategy] = await Promise.all([
22198
22334
  getTypeStrategy({ ...finalOptions, url }, player),
22199
- getDrmStrategy({ ...finalOptions, url }, player)
22335
+ getDrmStrategy({ ...finalOptions, url }, player),
22336
+ getAbrStrategy({ ...finalOptions, url })
22200
22337
  ]);
22201
22338
  const { options: options2, plugins } = typeStrategy ?? {};
22202
22339
  const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
22340
+ const { options: abrOptions, plugins: abrPlugins } = abrStrategy ?? {};
22203
22341
  return {
22204
- options: Object.assign({}, options2, drmOptions),
22205
- plugins: [...plugins ?? [], ...drmPlugins ?? []]
22342
+ options: Object.assign({}, options2, drmOptions, abrOptions),
22343
+ plugins: [
22344
+ ...plugins ?? [],
22345
+ ...drmPlugins ?? [],
22346
+ ...abrPlugins ?? []
22347
+ ]
22206
22348
  };
22207
22349
  }
22208
22350
  },