@volcengine/veplayer 2.0.0-rc.0 → 2.0.0-rc.2

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.
@@ -8,6 +8,21 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
 
11
+ var Codec = /* @__PURE__ */ ((Codec2) => {
12
+ Codec2["H265"] = "h265";
13
+ Codec2["H264"] = "h264";
14
+ return Codec2;
15
+ })(Codec || {});
16
+ var Degradation = /* @__PURE__ */ ((Degradation2) => {
17
+ Degradation2["SoftFirst"] = "soft-first";
18
+ Degradation2["H264First"] = "h264-first";
19
+ return Degradation2;
20
+ })(Degradation || {});
21
+ var DecodeType = /* @__PURE__ */ ((DecodeType2) => {
22
+ DecodeType2["Software"] = "software";
23
+ DecodeType2["Hardware"] = "hardware";
24
+ return DecodeType2;
25
+ })(DecodeType || {});
11
26
  function ownKeys$1(object, enumerableOnly) {
12
27
  var keys = Object.keys(object);
13
28
  if (Object.getOwnPropertySymbols) {
@@ -6131,7 +6146,7 @@ var __publicField = (obj, key, value) => {
6131
6146
  ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
6132
6147
  ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
6133
6148
  ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
6134
- ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 100] = "MODULE_LOAD_ERROR";
6149
+ ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
6135
6150
  ErrorCode2["UNKNOWN"] = "UNKNOWN";
6136
6151
  return ErrorCode2;
6137
6152
  })(ErrorCode$1 || {});
@@ -6228,7 +6243,7 @@ var __publicField = (obj, key, value) => {
6228
6243
  /* Error */
6229
6244
  },
6230
6245
  [
6231
- 100
6246
+ 110
6232
6247
  /* MODULE_LOAD_ERROR */
6233
6248
  ]: {
6234
6249
  messageTextKey: "MODULE_LOAD_ERROR",
@@ -6303,6 +6318,11 @@ var __publicField = (obj, key, value) => {
6303
6318
  }
6304
6319
  };
6305
6320
  let VeError$1 = class VeError extends Error {
6321
+ /**
6322
+ * @hidden
6323
+ * @param error
6324
+ * @param i18n
6325
+ */
6306
6326
  constructor(error2, i18n) {
6307
6327
  var _a;
6308
6328
  const errorInfo = typeof error2 === "string" ? {
@@ -6310,8 +6330,17 @@ var __publicField = (obj, key, value) => {
6310
6330
  } : error2;
6311
6331
  const message = (i18n == null ? void 0 : i18n.getText(errorInfo == null ? void 0 : errorInfo.messageTextKey)) ?? (errorInfo == null ? void 0 : errorInfo.message) ?? ((_a = errorInfo == null ? void 0 : errorInfo.error) == null ? void 0 : _a.message) ?? (i18n == null ? void 0 : i18n.getText("UNKNOWN"));
6312
6332
  super(message);
6333
+ /**
6334
+ * @brief 错误码,对应[错误码字典](#错误码)。
6335
+ */
6313
6336
  __publicField(this, "errorCode");
6337
+ /**
6338
+ * @brief 错误等级。
6339
+ */
6314
6340
  __publicField(this, "level");
6341
+ /**
6342
+ * @brief 其他错误信息。
6343
+ */
6315
6344
  __publicField(this, "ext");
6316
6345
  this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
6317
6346
  this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
@@ -10779,12 +10808,13 @@ var __publicField = (obj, key, value) => {
10779
10808
  }
10780
10809
  }
10781
10810
  var optionsIcon = "";
10782
- const ListType = {
10783
- Middle: "middle",
10784
- Bottom: "bottom",
10785
- Fullscreen: "fullscreen",
10786
- Inner: "inner"
10787
- };
10811
+ var ListType = /* @__PURE__ */ ((ListType2) => {
10812
+ ListType2["Middle"] = "middle";
10813
+ ListType2["Bottom"] = "bottom";
10814
+ ListType2["Fullscreen"] = "fullscreen";
10815
+ ListType2["Inner"] = "inner";
10816
+ return ListType2;
10817
+ })(ListType || {});
10788
10818
  var RenderType = /* @__PURE__ */ ((RenderType2) => {
10789
10819
  RenderType2["Icon"] = "Icon";
10790
10820
  RenderType2["Text"] = "Text";
@@ -10792,20 +10822,26 @@ var __publicField = (obj, key, value) => {
10792
10822
  })(RenderType || {});
10793
10823
  const isMobile$1 = sniffer$1.device === "mobile";
10794
10824
  const MOBILE_LIST_TYPES = [
10795
- ListType.Bottom,
10796
- ListType.Fullscreen,
10797
- ListType.Inner
10825
+ "bottom",
10826
+ "fullscreen",
10827
+ "inner"
10828
+ /* Inner */
10829
+ ];
10830
+ const PC_LIST_TYPES = [
10831
+ "middle"
10832
+ /* Middle */
10798
10833
  ];
10799
- const PC_LIST_TYPES = [ListType.Middle];
10800
10834
  const MODAL_TYPES = [
10801
- ListType.Bottom,
10802
- ListType.Inner,
10803
- ListType.Fullscreen
10835
+ "bottom",
10836
+ "inner",
10837
+ "fullscreen"
10838
+ /* Fullscreen */
10804
10839
  ];
10805
10840
  const CUSTOM_TYPES = [
10806
- ListType.Bottom,
10807
- ListType.Inner,
10808
- ListType.Fullscreen
10841
+ "bottom",
10842
+ "inner",
10843
+ "fullscreen"
10844
+ /* Fullscreen */
10809
10845
  ];
10810
10846
  class OptionsIcon extends Plugin {
10811
10847
  constructor(args) {
@@ -10843,7 +10879,7 @@ var __publicField = (obj, key, value) => {
10843
10879
  // 默认手机端在“右上角”,pc端在控制栏右侧
10844
10880
  position: isMobile$1 ? POSITIONS$1.ROOT_TOP_RIGHT : POSITIONS$1.CONTROLS_RIGHT,
10845
10881
  // 默认手机端列表展示底部,pc端在控制栏默认
10846
- listType: isMobile$1 ? ListType.Bottom : ListType.Middle,
10882
+ listType: isMobile$1 ? "bottom" : "middle",
10847
10883
  index: 100,
10848
10884
  list: [],
10849
10885
  listStyle: {},
@@ -11025,10 +11061,10 @@ var __publicField = (obj, key, value) => {
11025
11061
  listType = this.player.config.listType;
11026
11062
  }
11027
11063
  if (!isMobile$1 && (!listType || !MOBILE_LIST_TYPES.includes(listType))) {
11028
- listType = ListType.Bottom;
11064
+ listType = "bottom";
11029
11065
  }
11030
11066
  if (!isMobile$1 && (!listType || !PC_LIST_TYPES.includes(listType))) {
11031
- listType = ListType.Middle;
11067
+ listType = "middle";
11032
11068
  }
11033
11069
  return listType;
11034
11070
  }
@@ -12782,21 +12818,6 @@ var __publicField = (obj, key, value) => {
12782
12818
  }
12783
12819
  }
12784
12820
  var veplayerBase = "";
12785
- var Codec = /* @__PURE__ */ ((Codec2) => {
12786
- Codec2["H265"] = "h265";
12787
- Codec2["H264"] = "h264";
12788
- return Codec2;
12789
- })(Codec || {});
12790
- var Degradation = /* @__PURE__ */ ((Degradation2) => {
12791
- Degradation2["SoftFirst"] = "soft-first";
12792
- Degradation2["H264First"] = "h264-first";
12793
- return Degradation2;
12794
- })(Degradation || {});
12795
- var DecodeType = /* @__PURE__ */ ((DecodeType2) => {
12796
- DecodeType2["Software"] = "software";
12797
- DecodeType2["Hardware"] = "hardware";
12798
- return DecodeType2;
12799
- })(DecodeType || {});
12800
12821
  const { POSITIONS: XGPosition } = Plugin;
12801
12822
  const POSITIONS$1 = {
12802
12823
  ...XGPosition,
@@ -12806,7 +12827,7 @@ var __publicField = (obj, key, value) => {
12806
12827
  id: "veplayer",
12807
12828
  width: "100%",
12808
12829
  height: "100%",
12809
- decodeType: "hardware",
12830
+ decodeType: DecodeType.Hardware,
12810
12831
  fullscreen: {
12811
12832
  useCssFullscreen: false
12812
12833
  }
@@ -12834,6 +12855,9 @@ var __publicField = (obj, key, value) => {
12834
12855
  return xgOptions;
12835
12856
  };
12836
12857
  class VePlayerBase {
12858
+ /**
12859
+ * @hidden
12860
+ */
12837
12861
  constructor(options = {}) {
12838
12862
  __publicField(this, "_player");
12839
12863
  __publicField(this, "_sourceManager");
@@ -12885,74 +12909,162 @@ var __publicField = (obj, key, value) => {
12885
12909
  this._errorCallback = (err) => this._handleFallback(err);
12886
12910
  this._player.on(ERROR, this._errorCallback);
12887
12911
  }
12912
+ /**
12913
+ * @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
12914
+ * - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
12915
+ * - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
12916
+ * - `2`:HAVE_CURRENT_DATA,当前播放位置的数据可用,但不足以播放下一帧
12917
+ * - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
12918
+ * - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
12919
+ */
12888
12920
  get readyState() {
12889
12921
  return this._player.readyState;
12890
12922
  }
12923
+ /**
12924
+ * @brief 获取当前已缓冲的时间范围。
12925
+ */
12891
12926
  get buffered() {
12892
12927
  return this._player.buffered;
12893
12928
  }
12929
+ /**
12930
+ * @brief 获取已经播放的音频/视频的时间范围。
12931
+ */
12894
12932
  get played() {
12895
12933
  return this._player.played;
12896
12934
  }
12935
+ /**
12936
+ * @brief 设置/获取视频当前的播放时间, 单位为 s。
12937
+ */
12897
12938
  get cumulateTime() {
12898
12939
  return this._player.cumulateTime;
12899
12940
  }
12941
+ /**
12942
+ * @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
12943
+ */
12900
12944
  get isFocused() {
12901
12945
  return this._player.isActive;
12902
12946
  }
12947
+ /**
12948
+ * @brief 获取播放器是否处于全屏状态。
12949
+ */
12903
12950
  get isFullscreen() {
12904
12951
  return this._player.isFullscreen;
12905
12952
  }
12953
+ /**
12954
+ * @brief 获取播放器是否处于网页全屏状态。
12955
+ */
12906
12956
  get isCssFullscreen() {
12907
12957
  return this._player.isCssfullScreen;
12908
12958
  }
12959
+ /**
12960
+ * @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
12961
+ * - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
12962
+ * - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
12963
+ * - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
12964
+ * - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
12965
+ */
12909
12966
  get networkState() {
12910
12967
  return this._player.networkState;
12911
12968
  }
12969
+ /**
12970
+ * @brief 获取当前视频是否处于暂停状态。
12971
+ */
12912
12972
  get paused() {
12913
12973
  return this._player.paused;
12914
12974
  }
12975
+ /**
12976
+ * @brief 获取当前视频是否播放结束。
12977
+ */
12915
12978
  get ended() {
12916
12979
  return this._player.ended;
12917
12980
  }
12981
+ /**
12982
+ * @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
12983
+ * - `0`:ERROR,播放出现错误
12984
+ * - `1`:INITIAL,初始化
12985
+ * - `2`:READY,配置/事件/插件等均已经初始化/绑定/实例化完成
12986
+ * - `3`:ATTACHING,进入媒体对象挂载阶段
12987
+ * - `4`:ATTACHED,媒体对象已经挂载到了 DOM 中
12988
+ * - `5`:NOTALLOW,播放被阻止
12989
+ * - `6`:RUNNING,已经成功起播进入播放流程
12990
+ * - `7`:ENDED,播放结束
12991
+ * - `8`:DESTROYED,播放器实例处于已被销毁
12992
+ */
12918
12993
  get state() {
12919
12994
  return this._player.state;
12920
12995
  }
12996
+ /**
12997
+ * 获取当前播放视频的拉流地址。
12998
+ */
12921
12999
  get url() {
12922
13000
  return this._player.config.url;
12923
13001
  }
13002
+ /**
13003
+ * @brief 获取当播放视频的线路名称唯一标识(name)。
13004
+ */
12924
13005
  get source() {
12925
13006
  var _a;
12926
13007
  return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
12927
13008
  }
13009
+ /**
13010
+ * @brief 获取当前播放视频的清晰度唯一标识(definition)。
13011
+ */
12928
13012
  get definition() {
12929
13013
  var _a;
12930
13014
  return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
12931
13015
  }
13016
+ /**
13017
+ * @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
13018
+ */
12932
13019
  get crossOrigin() {
12933
13020
  return this._player.crossOrigin;
12934
13021
  }
13022
+ /**
13023
+ * @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
13024
+ */
12935
13025
  set crossOrigin(crossOrigin) {
12936
13026
  this._player.crossOrigin = crossOrigin;
12937
13027
  }
13028
+ /**
13029
+ * @brief 获取和设置视频的音量,取值范围为 [0,1]。
13030
+ */
12938
13031
  // eslint-disable-next-line @typescript-eslint/member-ordering
12939
13032
  get volume() {
12940
13033
  return this._player.volume;
12941
13034
  }
13035
+ /**
13036
+ * @brief 获取和设置视频的音量,取值范围为 [0,1]。
13037
+ */
12942
13038
  set volume(volume) {
12943
13039
  this._player.volume = volume;
12944
13040
  }
13041
+ /**
13042
+ * @brief 获取和设置视频静音状态。
13043
+ * - `true`:静音
13044
+ * - `false`:非静音
13045
+ */
12945
13046
  // eslint-disable-next-line @typescript-eslint/member-ordering
12946
13047
  get muted() {
12947
13048
  return this._player.muted;
12948
13049
  }
13050
+ /**
13051
+ * @brief 获取和设置视频静音状态。
13052
+ * - `true`:静音
13053
+ * - `false`:非静音
13054
+ */
12949
13055
  set muted(isMuted) {
12950
13056
  this._player.muted = isMuted;
12951
13057
  }
13058
+ /**
13059
+ * @brief 获取和设置当前语言。
13060
+ */
12952
13061
  // eslint-disable-next-line @typescript-eslint/member-ordering
12953
13062
  get lang() {
12954
13063
  return this._i18nManager.getLang();
12955
13064
  }
13065
+ /**
13066
+ * @brief 获取和设置当前语言。
13067
+ */
12956
13068
  set lang(lang) {
12957
13069
  var _a, _b;
12958
13070
  if (this._player.lang === lang) {
@@ -12974,6 +13086,9 @@ var __publicField = (obj, key, value) => {
12974
13086
  get _src() {
12975
13087
  return this._player.currentSrc;
12976
13088
  }
13089
+ /**
13090
+ * @hidden
13091
+ */
12977
13092
  static async create(options = {}, Constructor) {
12978
13093
  var _a;
12979
13094
  const sourceManager = new SourceManager({
@@ -12995,6 +13110,11 @@ var __publicField = (obj, key, value) => {
12995
13110
  sourceManager
12996
13111
  });
12997
13112
  }
13113
+ /**
13114
+ * @brief 调用此方法切换拉流地址、线路、清晰度。
13115
+ * @param target 目标地址,可以是播放地址,也可以是线路和清晰度
13116
+ * @param options 更多配置信息
13117
+ */
12998
13118
  async switch(target, options) {
12999
13119
  var _a, _b;
13000
13120
  if (typeof target === "string" && this._sourceManager.sources.length === 1 && ((_b = (_a = this._sourceManager.sources) == null ? void 0 : _a[0].definitions) == null ? void 0 : _b.length) === 1) {
@@ -13011,12 +13131,22 @@ var __publicField = (obj, key, value) => {
13011
13131
  await this._switch(targetDefinition);
13012
13132
  return targetDefinition;
13013
13133
  }
13134
+ /**
13135
+ * @brief 调用此方法更新拉流地址列表。
13136
+ * @param playlist 要更新的播放列表。
13137
+ * @param target 更新后默认播放的资源。
13138
+ */
13014
13139
  updatePlaylist(playlist, target) {
13015
13140
  const sourceManager = this._sourceManager.updateSources(playlist, target);
13016
13141
  return this._switch(sourceManager.definition);
13017
13142
  }
13018
13143
  // TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
13019
- once(event, callback, ...args) {
13144
+ /**
13145
+ * @brief 调用此方法监听指定事件,事件处理函数只执行一次。
13146
+ * @param event 表示事件的名称。
13147
+ * @param callback 表示事件的名称。
13148
+ */
13149
+ once(event, callback) {
13020
13150
  var _a;
13021
13151
  const { xgCallback, xgEventName } = this._transformEvent(event, callback);
13022
13152
  if (xgCallback) {
@@ -13024,27 +13154,45 @@ var __publicField = (obj, key, value) => {
13024
13154
  this._events[event] = /* @__PURE__ */ new Map();
13025
13155
  }
13026
13156
  this._events[event].set(callback, xgCallback);
13027
- this._player.once(xgEventName, xgCallback, ...args);
13157
+ this._player.once(xgEventName, xgCallback);
13028
13158
  }
13029
13159
  }
13030
- off(event, callback, ...args) {
13160
+ /**
13161
+ * @brief 调用此方法解绑或移除指定事件的事件监听。
13162
+ * @param event 表示事件的名称。
13163
+ * @param callback 表示事件的名称。
13164
+ */
13165
+ off(event, callback) {
13031
13166
  var _a;
13032
13167
  const xgCallback = (_a = this._events[event]) == null ? void 0 : _a.get(callback);
13033
13168
  const { xgEventName } = this._transformEvent(event);
13034
13169
  if (xgCallback) {
13035
- this._player.off(xgEventName, xgCallback, ...args);
13170
+ this._player.off(xgEventName, xgCallback);
13036
13171
  this._events[event].delete(callback);
13037
13172
  }
13038
13173
  }
13039
- emit(event, data, ...args) {
13174
+ /**
13175
+ * @brief 调用此方法触发指定事件。
13176
+ * @param event 表示事件的名称。
13177
+ * @param data 事件信息。
13178
+ */
13179
+ emit(event, data) {
13040
13180
  const { xgEventName } = this._transformEvent(event);
13041
- this._player.emit(xgEventName, data, ...args);
13181
+ this._player.emit(xgEventName, data);
13042
13182
  }
13183
+ /**
13184
+ * @brief 调用此方法解绑或移除指定事件的所有事件监听。
13185
+ */
13043
13186
  offAll() {
13044
13187
  this._events = {};
13045
13188
  this._player.offAll();
13046
13189
  }
13047
- on(event, callback, ...args) {
13190
+ /**
13191
+ * @brief 调用此方法监听指定事件。
13192
+ * @param event 事件。
13193
+ * @param callback 事件回调。
13194
+ */
13195
+ on(event, callback) {
13048
13196
  var _a;
13049
13197
  const { xgCallback, xgEventName } = this._transformEvent(event, callback);
13050
13198
  if (xgCallback) {
@@ -13052,56 +13200,105 @@ var __publicField = (obj, key, value) => {
13052
13200
  this._events[event] = /* @__PURE__ */ new Map();
13053
13201
  }
13054
13202
  this._events[event].set(callback, xgCallback);
13055
- this._player.on(xgEventName, xgCallback, ...args);
13203
+ this._player.on(xgEventName, xgCallback);
13056
13204
  }
13057
13205
  }
13206
+ /**
13207
+ * @brief 调用此方法开始播放 。
13208
+ */
13058
13209
  play() {
13059
13210
  /* istanbul ignore next -- @preserve */
13060
13211
  return this._player.play();
13061
13212
  }
13213
+ /**
13214
+ * @brief 调用此方法暂停播放。
13215
+ */
13062
13216
  pause() {
13063
13217
  /* istanbul ignore next -- @preserve */
13064
13218
  return this._player.pause();
13065
13219
  }
13220
+ /**
13221
+ * @brief 调用此方法打开画中画。
13222
+ */
13066
13223
  requestPIP() {
13067
13224
  var _a;
13068
13225
  /* istanbul ignore next -- @preserve */
13069
13226
  (_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
13070
13227
  }
13228
+ /**
13229
+ * @brief 调用此方法关闭画中画。
13230
+ */
13071
13231
  exitPIP() {
13072
13232
  var _a;
13073
13233
  /* istanbul ignore next -- @preserve */
13074
13234
  (_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
13075
13235
  }
13236
+ /**
13237
+ * @brief 调用此方法重新拉流。
13238
+ */
13076
13239
  retry() {
13077
- this._player.emit(Events$1.RETRY);
13078
13240
  return this._player.retry();
13079
13241
  }
13242
+ /**
13243
+ * @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
13244
+ * @param data 播放器获取焦点配置信息。
13245
+ */
13080
13246
  focus(data) {
13081
13247
  return this._player.focus(data);
13082
13248
  }
13249
+ /**
13250
+ * @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
13251
+ * @param data 播放器失去焦点配置信息。
13252
+ */
13083
13253
  blur(data) {
13084
13254
  return this._player.blur(data);
13085
13255
  }
13256
+ /**
13257
+ * @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
13258
+ * @param el 全屏作用的 DOM 节点。
13259
+ */
13086
13260
  getFullscreen(el) {
13087
13261
  return this._player.getFullscreen(el);
13088
13262
  }
13263
+ /**
13264
+ * @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
13265
+ * @param el 全屏作用的 DOM 节点。
13266
+ */
13089
13267
  exitFullscreen(el) {
13090
13268
  return this._player.exitFullscreen(el);
13091
13269
  }
13270
+ /**
13271
+ * @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
13272
+ * @param el 全屏作用的 DOM 节点。
13273
+ */
13092
13274
  getCssFullscreen(el) {
13093
13275
  return this._player.getCssFullscreen(el);
13094
13276
  }
13277
+ /**
13278
+ * @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
13279
+ */
13095
13280
  exitCssFullscreen() {
13096
13281
  return this._player.exitCssFullscreen();
13097
13282
  }
13283
+ /**
13284
+ * @brief 调用此方法在当前播放器上注册指定插件。
13285
+ * @param plugin 插件构造函数。
13286
+ * @param config 插件的配置列表。
13287
+ */
13098
13288
  registerPlugin(plugin, config) {
13099
13289
  return this._player.registerPlugin(plugin, config);
13100
13290
  }
13101
- unRegisterPlugin(plugin, removedFromConfig) {
13102
- return this._player.unRegisterPlugin(plugin, removedFromConfig);
13291
+ /**
13292
+ * @brief 调用此方法在当前播放器上销毁/注销指定插件。
13293
+ * @param plugin 插件实例或者插件名称。
13294
+ */
13295
+ unRegisterPlugin(plugin) {
13296
+ return this._player.unRegisterPlugin(plugin);
13103
13297
  }
13104
- // 显示插件
13298
+ /**
13299
+ * @brief 调用此接口显示指定插件图标。
13300
+ * @param pluginNames 插件名称
13301
+ */
13105
13302
  showIcon(pluginNames) {
13106
13303
  const morePlugin = this._player.getPlugin("more");
13107
13304
  pluginNames.forEach((pluginName) => {
@@ -13115,7 +13312,10 @@ var __publicField = (obj, key, value) => {
13115
13312
  }
13116
13313
  });
13117
13314
  }
13118
- // 隐藏插件显示
13315
+ /**
13316
+ * @brief 调用此接口隐藏指定插件图标。
13317
+ * @param pluginNames 插件名称
13318
+ */
13119
13319
  hideIcon(pluginNames) {
13120
13320
  const morePlugin = this._player.getPlugin("more");
13121
13321
  pluginNames.forEach((pluginName) => {
@@ -13129,10 +13329,16 @@ var __publicField = (obj, key, value) => {
13129
13329
  }
13130
13330
  });
13131
13331
  }
13332
+ /**
13333
+ * @brief 调用此方法销毁播放器实例。
13334
+ */
13132
13335
  destroy() {
13133
13336
  this._player.off(ERROR, this._errorCallback);
13134
13337
  this._player.destroy();
13135
13338
  }
13339
+ /**
13340
+ * @hidden
13341
+ */
13136
13342
  async prepare(url) {
13137
13343
  var _a, _b;
13138
13344
  const result = await ((_a = this._preparePlugins) == null ? void 0 : _a.call(this, url));
@@ -17759,7 +17965,7 @@ var __publicField = (obj, key, value) => {
17759
17965
  let mseStrategy;
17760
17966
  let softStrategy;
17761
17967
  const codec = await getCodec(options);
17762
- const isSoftDecode$1 = codec === "unknown" ? false : await isSoftDecode({ ...options, codec });
17968
+ const isSoftDecode$1 = await isSoftDecode(options, codec);
17763
17969
  if (isSoftDecode$1) {
17764
17970
  softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
17765
17971
  mseStrategy = createFlvMseStrategy(options);
@@ -17786,7 +17992,7 @@ var __publicField = (obj, key, value) => {
17786
17992
  let mseStrategy;
17787
17993
  let softStrategy;
17788
17994
  const codec = await getCodec(options);
17789
- const isSoftDecode$1 = codec === "unknown" ? false : await isSoftDecode({ ...options, codec });
17995
+ const isSoftDecode$1 = await isSoftDecode(options, codec);
17790
17996
  if (isSoftDecode$1) {
17791
17997
  softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
17792
17998
  mseStrategy = createHlsMseStrategy(options);
@@ -17892,10 +18098,13 @@ var __publicField = (obj, key, value) => {
17892
18098
  return "unknown";
17893
18099
  }
17894
18100
  }
17895
- async function isSoftDecode(options) {
18101
+ async function isSoftDecode(options, currentCodec) {
17896
18102
  if (options.decodeType === DecodeType.Software) {
17897
18103
  return true;
17898
18104
  }
18105
+ if (currentCodec === "unknown") {
18106
+ return false;
18107
+ }
17899
18108
  const codec = await getCodec(options);
17900
18109
  if (codec === Codec.H265) {
17901
18110
  if (sniffer$1.isHevcSupported()) {
@@ -17915,7 +18124,7 @@ var __publicField = (obj, key, value) => {
17915
18124
  }
17916
18125
  const { VeError } = error$1;
17917
18126
  var LiveErrorCode = /* @__PURE__ */ ((LiveErrorCode2) => {
17918
- LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] = 200] = "INVALID_PARAMETER";
18127
+ LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] = 210] = "INVALID_PARAMETER";
17919
18128
  return LiveErrorCode2;
17920
18129
  })(LiveErrorCode || {});
17921
18130
  const ErrorCode = {
@@ -17925,7 +18134,7 @@ var __publicField = (obj, key, value) => {
17925
18134
  const ERRORS = {
17926
18135
  ...ERROR_INFO,
17927
18136
  [
17928
- 200
18137
+ 210
17929
18138
  /* INVALID_PARAMETER */
17930
18139
  ]: {
17931
18140
  messageTextKey: "INVALID_PARAMETER",
@@ -17974,10 +18183,11 @@ var __publicField = (obj, key, value) => {
17974
18183
  const Rtm = await load(DynamicModule.PluginRtm);
17975
18184
  return Rtm.isSupported();
17976
18185
  };
17977
- const isRTMSupportCodec = async (codec = "h264", options) => {
18186
+ const isRTMSupportCodec = async (codec = "h264") => {
17978
18187
  const Rtm = await load(DynamicModule.PluginRtm);
17979
18188
  if (codec === "h264")
17980
- return Rtm.isSupportedH264(options == null ? void 0 : options.targetProfileLevel);
18189
+ return Rtm.isSupportedH264();
18190
+ return false;
17981
18191
  };
17982
18192
  const getTypeStrategy = async (options) => {
17983
18193
  const type = options.url ? util.getStreamType(options.url) : "";
@@ -20674,7 +20884,7 @@ var __publicField = (obj, key, value) => {
20674
20884
  user_id: this._userId,
20675
20885
  device_id: this._deviceId,
20676
20886
  ext: {
20677
- veplayer_version: "2.0.0-rc.0",
20887
+ veplayer_version: "2.0.0-rc.2",
20678
20888
  flv_version: "3.0.0-next.23",
20679
20889
  hls_version: "3.0.0-next.36-1",
20680
20890
  rts_version: "0.2.0-alpha.3"
@@ -20955,18 +21165,38 @@ var __publicField = (obj, key, value) => {
20955
21165
  };
20956
21166
  const LIVE_DEFAULT_PLUGINS = [...DEFAULT_PLUGINS, Refresh, Logger, InfoPanel];
20957
21167
  class VePlayerLive extends VePlayerBase {
21168
+ /**
21169
+ * @hidden
21170
+ * @param options
21171
+ */
21172
+ constructor(options) {
21173
+ super(options);
21174
+ }
21175
+ /** {zh}
21176
+ * @brief 调用此方法开启直播日志上报。
21177
+ */
20958
21178
  openLog() {
20959
21179
  var _a;
20960
21180
  (_a = this._player.plugins) == null ? void 0 : _a.logger.open();
20961
21181
  }
21182
+ /** {zh}
21183
+ * @brief 调用此方法关闭直播日志上报。
21184
+ */
20962
21185
  closeLog() {
20963
21186
  var _a;
20964
21187
  (_a = this._player.plugins) == null ? void 0 : _a.logger.close();
20965
21188
  }
21189
+ /** {zh}
21190
+ * @brief 调用此方法将打开直播信息面板,面板将展示拉流格式、帧率、码率、GOP、视频分辨率、编码方式、Buffer 水位、播放进度等基础信息。如果当前是软解,还会显示软解解码效率和解码消耗。
21191
+ */
20966
21192
  openInfoPanel() {
20967
21193
  var _a;
20968
21194
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.open();
20969
21195
  }
21196
+ /** {zh}
21197
+ * @brief 调用此方法关闭直播信息面板。
21198
+ *
21199
+ */
20970
21200
  closeInfoPanel() {
20971
21201
  var _a;
20972
21202
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();