@byteplus/veplayer 2.4.1-rc.1 → 2.4.2-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.
@@ -1316,7 +1316,7 @@ var __publicField = (obj, key, value) => {
1316
1316
  android: /(Android)\s([\d.]+)/,
1317
1317
  ios: /(Version)\/([\d.]+)/
1318
1318
  };
1319
- 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"];
1319
+ 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"];
1320
1320
  var sniffer$1 = {
1321
1321
  get device() {
1322
1322
  var r2 = sniffer$1.os;
@@ -1461,7 +1461,7 @@ var __publicField = (obj, key, value) => {
1461
1461
  }
1462
1462
  }
1463
1463
  };
1464
- var version = "3.0.20-rc.3";
1464
+ var version = "3.0.19-rc.0";
1465
1465
  var ERROR_TYPE_MAP = {
1466
1466
  1: "media",
1467
1467
  2: "media",
@@ -3421,7 +3421,7 @@ var __publicField = (obj, key, value) => {
3421
3421
  if (!this.observer) {
3422
3422
  return;
3423
3423
  }
3424
- this.observer.observe(target);
3424
+ this.observer && this.observer.observe(target);
3425
3425
  var _pid = target.getAttribute(PLATER_ID);
3426
3426
  var __handlers = this.__handlers;
3427
3427
  var index = -1;
@@ -3450,17 +3450,16 @@ var __publicField = (obj, key, value) => {
3450
3450
  }
3451
3451
  });
3452
3452
  try {
3453
- var _this$observer;
3454
- (_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.unobserve(target);
3453
+ this.observer && this.observer.unobserve(target);
3455
3454
  } catch (e2) {
3456
3455
  }
3456
+ this.observer && this.observer.unobserve(target);
3457
3457
  i2 > -1 && this.__handlers.splice(i2, 1);
3458
3458
  }
3459
3459
  }, {
3460
3460
  key: "destroyObserver",
3461
3461
  value: function destroyObserver() {
3462
- var _this$observer2;
3463
- (_this$observer2 = this.observer) === null || _this$observer2 === void 0 ? void 0 : _this$observer2.disconnect();
3462
+ this.observer && this.observer.disconnect();
3464
3463
  this.observer = null;
3465
3464
  this.__handlers = null;
3466
3465
  }
@@ -3492,8 +3491,7 @@ var __publicField = (obj, key, value) => {
3492
3491
  return resizeObserver;
3493
3492
  }
3494
3493
  function unObserver(target, handler) {
3495
- var _resizeObserver;
3496
- (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.unObserver(target, handler);
3494
+ resizeObserver.unObserver(target, handler);
3497
3495
  }
3498
3496
  var pluginsManager = {
3499
3497
  pluginGroup: {},
@@ -4491,7 +4489,10 @@ var __publicField = (obj, key, value) => {
4491
4489
  }
4492
4490
  var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4493
4491
  XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
4494
- _this._seekToStartTime();
4492
+ if (_this.__startTime > 0 && _this.duration > 0) {
4493
+ _this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
4494
+ _this.__startTime = -1;
4495
+ }
4495
4496
  _this.playbackRate = defaultPlaybackRate;
4496
4497
  (autoplay2 || _this._useAutoplay) && _this.mediaPlay();
4497
4498
  _this.off(CANPLAY, _this.canPlayFunc);
@@ -5113,7 +5114,10 @@ var __publicField = (obj, key, value) => {
5113
5114
  reject(e2);
5114
5115
  };
5115
5116
  var _canplay = function _canplay2() {
5116
- _this9._seekToStartTime();
5117
+ if (_this9.duration > 0 && _this9.__startTime > 0) {
5118
+ _this9.currentTime = _this9.__startTime;
5119
+ _this9.__startTime = -1;
5120
+ }
5117
5121
  if (isPaused) {
5118
5122
  _this9.pause();
5119
5123
  }
@@ -5734,17 +5738,11 @@ var __publicField = (obj, key, value) => {
5734
5738
  }, {
5735
5739
  key: "onLoadeddata",
5736
5740
  value: function onLoadeddata() {
5737
- var _this22 = this;
5738
5741
  this.isError = false;
5739
5742
  this.isSeeking = false;
5740
- if (this.__startTime > 0) {
5741
- if (this.duration > 0) {
5742
- this._seekToStartTime();
5743
- } else {
5744
- this.once(DURATION_CHANGE, function() {
5745
- _this22._seekToStartTime();
5746
- });
5747
- }
5743
+ if (this.__startTime > 0 && this.duration > 0) {
5744
+ this.currentTime = this.__startTime;
5745
+ this.__startTime = -1;
5748
5746
  }
5749
5747
  }
5750
5748
  }, {
@@ -5813,27 +5811,27 @@ var __publicField = (obj, key, value) => {
5813
5811
  }, {
5814
5812
  key: "onWaiting",
5815
5813
  value: function onWaiting() {
5816
- var _this23 = this;
5814
+ var _this22 = this;
5817
5815
  if (this.waitTimer) {
5818
5816
  util$1.clearTimeout(this, this.waitTimer);
5819
5817
  }
5820
5818
  this.updateAcc("waiting");
5821
5819
  this.waitTimer = util$1.setTimeout(this, function() {
5822
- _this23.addClass(STATE_CLASS.LOADING);
5823
- _this23.emit(LOADING);
5824
- util$1.clearTimeout(_this23, _this23.waitTimer);
5825
- _this23.waitTimer = null;
5820
+ _this22.addClass(STATE_CLASS.LOADING);
5821
+ _this22.emit(LOADING);
5822
+ util$1.clearTimeout(_this22, _this22.waitTimer);
5823
+ _this22.waitTimer = null;
5826
5824
  }, this.config.minWaitDelay);
5827
5825
  }
5828
5826
  }, {
5829
5827
  key: "onPlaying",
5830
5828
  value: function onPlaying() {
5831
- var _this24 = this;
5829
+ var _this23 = this;
5832
5830
  this.isError = false;
5833
5831
  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;
5834
5832
  var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
5835
5833
  clsList.forEach(function(cls) {
5836
- _this24.removeClass(cls);
5834
+ _this23.removeClass(cls);
5837
5835
  });
5838
5836
  if (!this._accPlayed.t && !this.paused && !this.ended) {
5839
5837
  this._accPlayed.t = (/* @__PURE__ */ new Date()).getTime();
@@ -5994,14 +5992,14 @@ var __publicField = (obj, key, value) => {
5994
5992
  }, {
5995
5993
  key: "setConfig",
5996
5994
  value: function setConfig(config) {
5997
- var _this25 = this;
5995
+ var _this24 = this;
5998
5996
  if (!config) {
5999
5997
  return;
6000
5998
  }
6001
5999
  Object.keys(config).map(function(key) {
6002
6000
  if (key !== "plugins") {
6003
- _this25.config[key] = config[key];
6004
- var plugin = _this25.plugins[key.toLowerCase()];
6001
+ _this24.config[key] = config[key];
6002
+ var plugin = _this24.plugins[key.toLowerCase()];
6005
6003
  if (plugin && util$1.typeOf(plugin.setConfig) === "Function") {
6006
6004
  plugin.setConfig(config[key]);
6007
6005
  }
@@ -6011,20 +6009,20 @@ var __publicField = (obj, key, value) => {
6011
6009
  }, {
6012
6010
  key: "playNext",
6013
6011
  value: function playNext(config) {
6014
- var _this26 = this;
6012
+ var _this25 = this;
6015
6013
  this.resetState();
6016
6014
  this.setConfig(config);
6017
6015
  this._currentTime = 0;
6018
6016
  this._duration = 0;
6019
6017
  runHooks(this, "playnext", function() {
6020
- _this26.start();
6021
- _this26.emit(PLAYNEXT, config);
6018
+ _this25.start();
6019
+ _this25.emit(PLAYNEXT, config);
6022
6020
  });
6023
6021
  }
6024
6022
  }, {
6025
6023
  key: "resize",
6026
6024
  value: function resize() {
6027
- var _this27 = this;
6025
+ var _this26 = this;
6028
6026
  if (!this.media) {
6029
6027
  return;
6030
6028
  }
@@ -6064,7 +6062,7 @@ var __publicField = (obj, key, value) => {
6064
6062
  }
6065
6063
  if (!this.fullscreen && !this.cssfullscreen) {
6066
6064
  Object.keys(_style).forEach(function(key) {
6067
- _this27.root.style[key] = _style[key];
6065
+ _this26.root.style[key] = _style[key];
6068
6066
  });
6069
6067
  }
6070
6068
  if (videoFillMode === "fillHeight" && fit < videoFit || videoFillMode === "fillWidth" && fit > videoFit) {
@@ -6106,14 +6104,6 @@ var __publicField = (obj, key, value) => {
6106
6104
  url
6107
6105
  };
6108
6106
  }
6109
- }, {
6110
- key: "_seekToStartTime",
6111
- value: function _seekToStartTime() {
6112
- if (this.__startTime > 0 && this.duration > 0) {
6113
- this.currentTime = this.__startTime > this.duration ? this.duration : this.__startTime;
6114
- this.__startTime = -1;
6115
- }
6116
- }
6117
6107
  }, {
6118
6108
  key: "state",
6119
6109
  get: function get() {
@@ -6164,15 +6154,15 @@ var __publicField = (obj, key, value) => {
6164
6154
  return this.config.definition.list || [];
6165
6155
  },
6166
6156
  set: function set(list) {
6167
- var _this28 = this;
6157
+ var _this27 = this;
6168
6158
  var definition = this.config.definition;
6169
6159
  var curDef = null;
6170
6160
  var targetDef = null;
6171
6161
  definition.list = list;
6172
6162
  this.emit("resourceReady", list);
6173
6163
  list.forEach(function(item) {
6174
- var _this28$curDefinition;
6175
- if (((_this28$curDefinition = _this28.curDefinition) === null || _this28$curDefinition === void 0 ? void 0 : _this28$curDefinition.definition) === item.definition) {
6164
+ var _this27$curDefinition;
6165
+ if (((_this27$curDefinition = _this27.curDefinition) === null || _this27$curDefinition === void 0 ? void 0 : _this27$curDefinition.definition) === item.definition) {
6176
6166
  curDef = item;
6177
6167
  }
6178
6168
  if (definition.defaultDefinition === item.definition) {
@@ -8457,7 +8447,7 @@ var __publicField = (obj, key, value) => {
8457
8447
  }
8458
8448
  this.on(DURATION_CHANGE, function() {
8459
8449
  var player2 = _this2.player, config2 = _this2.config;
8460
- if (player2.duration > 0 && player2.duration * 1e3 < config2.moveDuration) {
8450
+ if (player2.duration * 1e3 < config2.moveDuration) {
8461
8451
  config2.moveDuration = player2.duration * 1e3;
8462
8452
  }
8463
8453
  });
@@ -8771,13 +8761,10 @@ var __publicField = (obj, key, value) => {
8771
8761
  }, {
8772
8762
  key: "updateBrightness",
8773
8763
  value: function updateBrightness(percent) {
8774
- var pos = this.pos, config = this.config, xgMask = this.xgMask;
8775
- if (!config.darkness) {
8776
- return;
8777
- }
8778
8764
  if (this.player.rotateDeg) {
8779
8765
  percent = -percent;
8780
8766
  }
8767
+ var pos = this.pos, config = this.config, xgMask = this.xgMask;
8781
8768
  var light = pos.light + 0.8 * percent;
8782
8769
  light = light > config.maxDarkness ? config.maxDarkness : light < 0 ? 0 : light;
8783
8770
  if (xgMask) {
@@ -13759,7 +13746,7 @@ var __publicField = (obj, key, value) => {
13759
13746
  * @returns
13760
13747
  */
13761
13748
  get playerVersion() {
13762
- return "2.4.1-rc.1";
13749
+ return "2.4.2-rc.1";
13763
13750
  }
13764
13751
  /** {zh}
13765
13752
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
@@ -19080,29 +19067,6 @@ var __publicField = (obj, key, value) => {
19080
19067
  return RtmPlugin.isSupportedH264();
19081
19068
  return false;
19082
19069
  }
19083
- const getAbrStrategy = async (options) => {
19084
- var _a, _b;
19085
- const streamType = options.url && getStreamType(options.url);
19086
- if (streamType === "rtm") {
19087
- return {};
19088
- }
19089
- 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;
19090
- if (!abrOptions) {
19091
- return {};
19092
- }
19093
- const abrPlugin = await load(DynamicModule.PluginAbr).catch(() => void 0);
19094
- return {
19095
- options: {
19096
- [streamType === "flv" ? "abr" : "hlsabr"]: {
19097
- ...abrOptions,
19098
- open: abrOptions.enable ?? true
19099
- }
19100
- },
19101
- plugins: [
19102
- streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
19103
- ]
19104
- };
19105
- };
19106
19070
  const rtmStrategy = {
19107
19071
  options: {},
19108
19072
  module: DynamicModule.PluginRtm
@@ -19117,8 +19081,6 @@ var __publicField = (obj, key, value) => {
19117
19081
  const getRtmStrategy = async (options, player) => {
19118
19082
  var _a;
19119
19083
  let backupStrategy;
19120
- let backupOptions = {};
19121
- let backupModule = [];
19122
19084
  const { url } = options;
19123
19085
  const {
19124
19086
  fallbackUrl,
@@ -19133,7 +19095,7 @@ var __publicField = (obj, key, value) => {
19133
19095
  } else if (backupType === "hls" && (sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util.isMseSupported(Codec.H264)) {
19134
19096
  backupStrategy = createHlsMseStrategy(options);
19135
19097
  }
19136
- const [rtmCdn, backupCdn, backupAbr] = await Promise.all([
19098
+ const [rtmCdn, backupCdn] = await Promise.all([
19137
19099
  load(rtmStrategy.module).then((module2) => {
19138
19100
  return module2.RtmPlugin;
19139
19101
  }).catch(() => void 0),
@@ -19143,18 +19105,8 @@ var __publicField = (obj, key, value) => {
19143
19105
  } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule.PluginHls) {
19144
19106
  return module2.HlsPlugin;
19145
19107
  }
19146
- }).catch(() => void 0),
19147
- getAbrStrategy({ ...options, url: actualFallbackUrl }).catch(
19148
- () => void 0
19149
- )
19108
+ }).catch(() => void 0)
19150
19109
  ]);
19151
- if (backupType) {
19152
- backupOptions = {
19153
- ...backupStrategy == null ? void 0 : backupStrategy.options,
19154
- ...backupAbr == null ? void 0 : backupAbr.options
19155
- };
19156
- backupModule = [backupCdn, ...(backupAbr == null ? void 0 : backupAbr.plugins) ?? []];
19157
- }
19158
19110
  const [RTMSupported, RTMSupportCodec] = await Promise.all([
19159
19111
  isRTMSupported(),
19160
19112
  isRTMSupportCodec()
@@ -19172,7 +19124,7 @@ var __publicField = (obj, key, value) => {
19172
19124
  }
19173
19125
  return {
19174
19126
  options: {
19175
- ...backupOptions || {},
19127
+ ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
19176
19128
  url: actualFallbackUrl,
19177
19129
  _RTMdegrade: {
19178
19130
  _originRtmUrl: url,
@@ -19180,19 +19132,19 @@ var __publicField = (obj, key, value) => {
19180
19132
  _isRTMSupportCodec: RTMSupportCodec
19181
19133
  }
19182
19134
  },
19183
- plugins: backupModule
19135
+ plugins: backupCdn ? [backupCdn] : []
19184
19136
  };
19185
19137
  }
19186
19138
  return {
19187
19139
  options: {
19188
- ...backupOptions || {},
19140
+ ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
19189
19141
  url: enableRTMAutoTranscode ? util.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
19190
19142
  _RTMdegrade: void 0,
19191
19143
  rts: {
19192
19144
  retryCount: 0,
19193
19145
  ...ret,
19194
19146
  backupURL: actualFallbackUrl,
19195
- backupConstruct: backupModule
19147
+ backupConstruct: backupCdn
19196
19148
  }
19197
19149
  },
19198
19150
  plugins: rtmCdn ? [rtmCdn] : []
@@ -22046,10 +21998,10 @@ var __publicField = (obj, key, value) => {
22046
21998
  user_id: this._userId,
22047
21999
  device_id: this._deviceId,
22048
22000
  ext: {
22049
- veplayer_version: "2.4.1-rc.1",
22050
- flv_version: "3.0.20-rc.3",
22051
- hls_version: "3.0.20-rc.3",
22052
- rts_version: "0.2.1-alpha.1"
22001
+ veplayer_version: "2.4.2-rc.1",
22002
+ flv_version: "3.0.19-rc.0",
22003
+ hls_version: "3.0.19-rc.0",
22004
+ rts_version: "0.2.1-alpha.4"
22053
22005
  }
22054
22006
  });
22055
22007
  }
@@ -22343,6 +22295,29 @@ var __publicField = (obj, key, value) => {
22343
22295
  }
22344
22296
  return {};
22345
22297
  };
22298
+ const getAbrStrategy = async (options) => {
22299
+ var _a, _b;
22300
+ const streamType = options.url && getStreamType(options.url);
22301
+ if (streamType === "rtm") {
22302
+ return {};
22303
+ }
22304
+ 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;
22305
+ if (!abrOptions) {
22306
+ return {};
22307
+ }
22308
+ const abrPlugin = await load(DynamicModule.PluginAbr).catch(() => void 0);
22309
+ return {
22310
+ options: {
22311
+ [streamType === "flv" ? "abr" : "hlsabr"]: {
22312
+ ...abrOptions,
22313
+ open: abrOptions.enable ?? true
22314
+ }
22315
+ },
22316
+ plugins: [
22317
+ streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
22318
+ ]
22319
+ };
22320
+ };
22346
22321
  VeI18n.extend([
22347
22322
  {
22348
22323
  LANG: "zh-cn",
@@ -22514,28 +22489,6 @@ var __publicField = (obj, key, value) => {
22514
22489
  var _a, _b, _c;
22515
22490
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
22516
22491
  }
22517
- /** {zh}
22518
- * @brief 调用此方法开始播放 。
22519
- */
22520
- /** {en}
22521
- * @brief Starts playback.
22522
- */
22523
- play() {
22524
- this.openAbr();
22525
- /* istanbul ignore next -- @preserve */
22526
- return this._player.play();
22527
- }
22528
- /** {zh}
22529
- * @brief 调用此方法暂停播放。
22530
- */
22531
- /** {en}
22532
- * @brief Pauses playback.
22533
- */
22534
- pause() {
22535
- this.closeAbr();
22536
- /* istanbul ignore next -- @preserve */
22537
- return this._player.pause();
22538
- }
22539
22492
  }
22540
22493
  async function createLivePlayer(options) {
22541
22494
  var _a, _b;