@byteplus/veplayer 1.8.1 → 2.3.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +6 -39
  3. package/esm/index.d.ts +4629 -0
  4. package/esm/veplayer.biz.live.development.css +41 -0
  5. package/esm/veplayer.biz.live.development.js +3417 -0
  6. package/esm/veplayer.biz.live.production.css +1 -0
  7. package/esm/veplayer.biz.live.production.js +2 -0
  8. package/esm/veplayer.biz.vod.development.js +13 -0
  9. package/esm/veplayer.biz.vod.production.js +2 -0
  10. package/esm/veplayer.d.ts +10012 -0
  11. package/esm/veplayer.development.css +743 -0
  12. package/esm/veplayer.development.js +22252 -0
  13. package/esm/veplayer.live.d.ts +10014 -0
  14. package/esm/veplayer.live.development.css +743 -0
  15. package/esm/veplayer.live.development.js +22251 -0
  16. package/esm/veplayer.live.production.css +1 -0
  17. package/esm/veplayer.live.production.js +11 -0
  18. package/esm/veplayer.production.css +1 -0
  19. package/esm/veplayer.production.js +11 -0
  20. package/esm/veplayer.vod.d.ts +4629 -0
  21. package/esm/veplayer.vod.development.css +702 -0
  22. package/esm/veplayer.vod.development.js +14064 -0
  23. package/esm/veplayer.vod.production.css +1 -0
  24. package/esm/veplayer.vod.production.js +11 -0
  25. package/package.json +78 -8
  26. package/umd/index.d.ts +4629 -0
  27. package/umd/veplayer.biz.live.development.css +41 -0
  28. package/umd/veplayer.biz.live.development.js +3429 -0
  29. package/umd/veplayer.biz.live.production.css +1 -0
  30. package/umd/veplayer.biz.live.production.js +1 -0
  31. package/umd/veplayer.biz.vod.development.js +30 -0
  32. package/umd/veplayer.biz.vod.production.js +1 -0
  33. package/umd/veplayer.d.ts +10012 -0
  34. package/umd/veplayer.development.css +743 -0
  35. package/umd/veplayer.development.js +22255 -0
  36. package/umd/veplayer.live.d.ts +10014 -0
  37. package/umd/veplayer.live.development.css +743 -0
  38. package/umd/veplayer.live.development.js +22263 -0
  39. package/umd/veplayer.live.production.css +1 -0
  40. package/umd/veplayer.live.production.js +1 -0
  41. package/umd/veplayer.production.css +1 -0
  42. package/umd/veplayer.production.js +1 -0
  43. package/umd/veplayer.vod.d.ts +4629 -0
  44. package/umd/veplayer.vod.development.css +702 -0
  45. package/umd/veplayer.vod.development.js +14079 -0
  46. package/umd/veplayer.vod.production.css +1 -0
  47. package/umd/veplayer.vod.production.js +1 -0
  48. package/veplayer.d.ts +10012 -0
  49. package/veplayer.live.d.ts +10014 -0
  50. package/veplayer.vod.d.ts +4629 -0
  51. package/index.d.ts +0 -3974
  52. package/index.min.css +0 -1
  53. package/index.min.js +0 -2
package/esm/index.d.ts ADDED
@@ -0,0 +1,4629 @@
1
+ import Player from "xgplayer";
2
+ import { IXGI18nText, Plugin, IPluginOptions } from "xgplayer";
3
+ import { IPlayerOptions as PlayerOptions } from "xgplayer";
4
+ import { IDefinition as XGDefinition } from "xgplayer";
5
+ import { default as Player$0 } from "xgplayer";
6
+ import { IError as XGError } from "xgplayer";
7
+ import { IBasePluginOptions as XGPluginOptions } from "xgplayer";
8
+ import { IXGI18n } from "xgplayer/es/lang/i18n";
9
+ import XG_EN from "xgplayer/es/lang/en";
10
+ import XG_ZH_CN from "xgplayer/es/lang/zh-cn";
11
+ import OptionList from "xgplayer/es/plugins/common/optionList";
12
+ import { default as XGPlayer } from "xgplayer/es/player";
13
+ declare const EN: {
14
+ DEFINITION_FALLBACK_TOAST: string;
15
+ DEFINITION_SWITCHING: string;
16
+ ERROR_REFRESH: string;
17
+ UNMUTE: string;
18
+ MANIFEST: string;
19
+ NETWORK: string;
20
+ NETWORK_TIMEOUT: string;
21
+ NETWORK_FORBIDDEN: string;
22
+ NETWORK_NOTFOUND: string;
23
+ DEMUX: string;
24
+ REMUX: string;
25
+ MEDIA: string;
26
+ MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
27
+ MEDIA_ERR_URL_EMPTY: string;
28
+ DRM: string;
29
+ DRM_LICENSE: string;
30
+ OTHER: string;
31
+ RUNTIME: string;
32
+ MODULE_LOAD_ERROR: string;
33
+ UNKNOWN: string;
34
+ ERROR_TYPES: typeof XG_EN.TEXT.ERROR_TYPES;
35
+ HAVE_NOTHING: string;
36
+ HAVE_METADATA: string;
37
+ HAVE_CURRENT_DATA: string;
38
+ HAVE_FUTURE_DATA: string;
39
+ HAVE_ENOUGH_DATA: string;
40
+ NETWORK_EMPTY: string;
41
+ NETWORK_IDLE: string;
42
+ NETWORK_LOADING: string;
43
+ NETWORK_NO_SOURCE: string;
44
+ MEDIA_ERR_ABORTED: string;
45
+ MEDIA_ERR_NETWORK: string;
46
+ MEDIA_ERR_DECODE: string;
47
+ MEDIA_ERR_SRC_NOT_SUPPORTED: string;
48
+ REPLAY: string;
49
+ ERROR: string;
50
+ PLAY_TIPS: string;
51
+ PAUSE_TIPS: string;
52
+ PLAYNEXT_TIPS: string;
53
+ DOWNLOAD_TIPS: string;
54
+ ROTATE_TIPS: string;
55
+ RELOAD_TIPS: string;
56
+ FULLSCREEN_TIPS: string;
57
+ EXITFULLSCREEN_TIPS: string;
58
+ CSSFULLSCREEN_TIPS: string;
59
+ EXITCSSFULLSCREEN_TIPS: string;
60
+ TEXTTRACK: string;
61
+ PIP: string;
62
+ SCREENSHOT: string;
63
+ LIVE: string;
64
+ OFF: string;
65
+ OPEN: string;
66
+ MINI_DRAG: string;
67
+ MINISCREEN: string;
68
+ REFRESH_TIPS: string;
69
+ REFRESH: string;
70
+ FORWARD: string;
71
+ LIVE_TIP: string;
72
+ };
73
+ type TextKey = keyof typeof EN;
74
+ type Lang = "zh-cn" | "zh-hk" | "en" | "jp" | string;
75
+ declare class VeI18n<T extends string = TextKey> {
76
+ private _lang;
77
+ constructor(config?: {
78
+ lang?: Lang;
79
+ i18n?: {
80
+ texts?: Record<Lang, Record<string, string>>;
81
+ };
82
+ });
83
+ static get langKeys(): string[];
84
+ static isLangValid(lang: Lang): boolean;
85
+ static extend(i18nTextList: Array<IXGI18nText>, i18nLangs?: IXGI18n): void;
86
+ setLang(lang: string): void;
87
+ getLang(): string;
88
+ normalize(text?: string | Record<Lang, string>): string;
89
+ getText(textKey?: T | string): Record<string | T, string>[string | T] | undefined;
90
+ }
91
+ interface DefinitionUrl {
92
+ url: string;
93
+ next: DefinitionUrl | null;
94
+ }
95
+ declare class Definition implements XGDefinition {
96
+ readonly definition: string;
97
+ readonly source: Source;
98
+ readonly text?: Record<Lang, string> | string;
99
+ readonly fallbackUrl: DefinitionUrl;
100
+ readonly urls: string[];
101
+ private _currentUrlRef;
102
+ constructor(definitionSetting: {
103
+ url: string;
104
+ definition: string;
105
+ source: Source;
106
+ text?: Record<Lang, string> | string;
107
+ fallbackUrls?: string[];
108
+ });
109
+ get url(): string;
110
+ set url(url: string);
111
+ next(): DefinitionUrl;
112
+ }
113
+ /** {zh}
114
+ * @list option
115
+ * @kind property
116
+ * @id Definition
117
+ * @name Definition
118
+ *
119
+ */
120
+ /** {en}
121
+ * @list option
122
+ * @kind property
123
+ * @id Definition
124
+ * @alias Definition
125
+ *
126
+ */
127
+ interface ExposedDefinition {
128
+ /** {zh}
129
+ * @brief 播放地址。
130
+ * @default 无
131
+ */
132
+ /** {en}
133
+ * @brief The playback address.
134
+ */
135
+ url: string;
136
+ /** {zh}
137
+ * @brief 清晰度标识(唯一值)。
138
+ * @default 无
139
+ *
140
+ */
141
+ /** {en}
142
+ * @brief The resolution ID. This value must be unique.
143
+ *
144
+ */
145
+ definition: string;
146
+ /** {zh}
147
+ * @brief 清晰度展示名称。可设置多语言 `{text: {'zh-cn': '高清', 'en': 'HD'}}`。
148
+ * @default 无
149
+ */
150
+ /** {en}
151
+ * @brief The display name of the resolution. Multiple languages are supported, such as `{text: {'zh-cn': '高清', 'en': 'HD'}}`.
152
+ */
153
+ text?: Record<Lang, string> | string;
154
+ /** {zh}
155
+ * @brief 为当前清晰度地址设置备路拉流地址,支持设置多个备路拉流地址。当前清晰度地址拉流失败时,会在当前清晰度地址和备路直播地址之间循环拉流,直到拉流成功。
156
+ * @default 无
157
+ *
158
+ */
159
+ /** {en}
160
+ * @brief The backup pull stream address for the current resolution. You can set multiple backup addresses. When the player fails to pull a stream from the current address, it will loop between the current and the backup addresses until it successfully pulls a stream.
161
+ *
162
+ */
163
+ fallbackUrls?: string[];
164
+ }
165
+ /** {zh}
166
+ * @list option
167
+ * @kind property
168
+ * @id Source
169
+ * @alias Source
170
+ */
171
+ /** {en}
172
+ * @list option
173
+ * @kind property
174
+ * @id Source
175
+ * @alias Source
176
+ */
177
+ interface ExposedSource {
178
+ /** {zh}
179
+ * @brief 线路标识(唯一值)。
180
+ * @default 无
181
+ */
182
+ /** {en}
183
+ * @brief The playback source ID. This value must be unique.
184
+ */
185
+ name?: string;
186
+ /** {zh}
187
+ * @brief 线路展示名称。可设置多语言 `{text: {'zh-cn': '线路一', 'en': 'LineOne'}}`。
188
+ * @default 无
189
+ *
190
+ */
191
+ /** {en}
192
+ * @brief The display name of the live stream source. Multiple languages are supported. For example, you set it to `{text: {'zh-cn': '线路一', 'en': 'LineOne'}}`.
193
+ *
194
+ */
195
+ text?: Record<Lang, string> | string;
196
+ /** {zh}
197
+ * @brief 该线路下清晰度列表。
198
+ * @default 无
199
+ *
200
+ */
201
+ /** {en}
202
+ * @brief A list of resolutions of the current source.
203
+ *
204
+ */
205
+ definitions: Array<ExposedDefinition | string>;
206
+ }
207
+ interface CompoundSources {
208
+ sources?: ExposedSource[];
209
+ url?: string;
210
+ fallbackUrls?: string[];
211
+ }
212
+ declare class Source {
213
+ readonly name?: string;
214
+ readonly text?: Record<Lang, string> | string;
215
+ readonly definitions: Array<Definition & {
216
+ source: Source;
217
+ }>;
218
+ private constructor();
219
+ get defaultDefinition(): Definition & {
220
+ source: Source;
221
+ };
222
+ static normalize(input: CompoundSources | ExposedSource[] | string): Source[];
223
+ private static normalizeUrl;
224
+ add(definition: Definition): void;
225
+ }
226
+ interface Config {
227
+ listType: ListType;
228
+ isAutoChange?: boolean;
229
+ onItemClick?: (e: Event, data: CallbackData) => void;
230
+ onOptionClick?: (e: Event, data: CallbackData) => void;
231
+ hide?: () => void;
232
+ list?: ListItem[];
233
+ panel?: {
234
+ className?: string;
235
+ title?: string | Record<Lang, string>;
236
+ };
237
+ }
238
+ interface Options {
239
+ config: Config;
240
+ root: HTMLElement | null;
241
+ player: Player;
242
+ }
243
+ declare class MobilePlayerPanel {
244
+ private _root?;
245
+ private _config;
246
+ private _parent;
247
+ private _listDom?;
248
+ private _container?;
249
+ private _titleDom?;
250
+ private _player;
251
+ private _delegates?;
252
+ private _listType?;
253
+ constructor(args: Options);
254
+ changeMode(listType: ListType): void;
255
+ // 渲染选择列表
256
+ renderItemList(data?: ListItem[]): HTMLElement;
257
+ // 渲染panel的标题
258
+ renderTitle(): HTMLElement | undefined;
259
+ updatePanel(listType: ListType): void;
260
+ // 渲染panel
261
+ renderPanel(): void;
262
+ show(): void;
263
+ hide(): void;
264
+ destroy(): void;
265
+ private _bind;
266
+ private _unbind;
267
+ private _initEvents;
268
+ private _unbindEvents;
269
+ private _handleOrientationChange;
270
+ private _bindDomEvent;
271
+ private _unbindDomEvent;
272
+ private _stopPropagation;
273
+ private _onItemClick;
274
+ private _handleHide;
275
+ }
276
+ declare module MobilePlayerPanelWrapper {
277
+ export { MobilePlayerPanel };
278
+ }
279
+ import MobilePanel = MobilePlayerPanelWrapper.MobilePlayerPanel;
280
+ /** {zh}
281
+ * @detail option
282
+ * @brief **清晰度选择**或**线路选择**时的**选择面板样式**,仅在移动端有效。
283
+ */
284
+ /** {en}
285
+ * @detail option
286
+ * @brief The panel style for resolution and live stream source selection. This setting is effective on mobile devices only.
287
+ */
288
+ declare enum ListType {
289
+ /** {zh}
290
+ * @brief 全屏布局
291
+ * @hidden
292
+ */
293
+ /** {en}
294
+ * @brief Fullscreen layout.
295
+ * @hidden
296
+ */
297
+ Middle = "middle",
298
+ /** {zh}
299
+ * @brief 底部抽屉
300
+ */
301
+ /** {en}
302
+ * @brief Bottom navigation drawer.
303
+ */
304
+ Bottom = "bottom",
305
+ /** {zh}
306
+ * @brief 右侧抽屉,常用于全屏时展示
307
+ */
308
+ /** {en}
309
+ * @brief Right navigation drawer. This is often used for fullscreen display.
310
+ */
311
+ Fullscreen = "fullscreen",
312
+ /** {zh}
313
+ * @brief 窗口蒙层展示
314
+ */
315
+ /** {en}
316
+ * @brief Overlay.
317
+ */
318
+ Inner = "inner"
319
+ }
320
+ interface ListItem {
321
+ [key: string]: any;
322
+ selected?: boolean;
323
+ className?: string;
324
+ showText?: string | HTMLElement;
325
+ text?: string | Record<Lang, string>;
326
+ iconText?: string | Record<Lang, string>;
327
+ }
328
+ type CallbackData = {
329
+ to?: ListItem;
330
+ from?: ListItem;
331
+ };
332
+ declare const enum RenderType {
333
+ Icon = "Icon",
334
+ Text = "Text"
335
+ }
336
+ type Config$0<T> = {
337
+ [key: string]: any;
338
+ // 【xg】顺序
339
+ index?: number;
340
+ // 【xg】展示的选择列表
341
+ list?: Array<T>;
342
+ // 【xg】竖屏
343
+ hidePortrait?: boolean;
344
+ // 【xg】列表点击之后是否隐藏列表
345
+ isItemClickHide?: boolean;
346
+ className?: string;
347
+ // 【xg】是否展示已选择的
348
+ isShowIcon?: boolean;
349
+ // 【xg 扩展】列表渲染样式类型
350
+ listType?: ListType;
351
+ // 已选择的展示类型(文案 or icon)
352
+ renderType?: RenderType;
353
+ // 列表数据只有一个是否展示
354
+ hideOnSingleOption?: boolean;
355
+ // 横屏的时候是否切换mode
356
+ isAutoChange?: boolean;
357
+ // 自定义组件 mobilePanel的配置
358
+ panel?: {
359
+ className?: string;
360
+ // panel 的标题
361
+ title?: string | Record<Lang, string>;
362
+ };
363
+ };
364
+ // 源自packages/xgplayer/src/plugins/common/optionsIcon.js
365
+ // 自定义了几种选择类型
366
+ declare class OptionsIcon extends Plugin {
367
+ icons: Record<string, any>;
368
+ config: Config$0<ListItem>;
369
+ optionsList?: MobilePanel | OptionList;
370
+ private _isIcon?;
371
+ private _isActive?;
372
+ private _curIndex;
373
+ private activeEvent?;
374
+ constructor(args: IPluginOptions);
375
+ static get pluginName(): string;
376
+ static get defaultConfig(): Config$0<ListItem>;
377
+ updateLang(): void;
378
+ afterCreate(): void;
379
+ initIcons(): void;
380
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
381
+ // @ts-ignore
382
+ show(): void;
383
+ hide(): void;
384
+ onEnter: (e: Event) => void;
385
+ onLeave: (e: Event) => void;
386
+ // 状态切换
387
+ toggle(isActive: boolean): void;
388
+ // 列表选择回调
389
+ onItemClick(e: Event, data: CallbackData): void;
390
+ // 列表点击回调
391
+ onOptionClick(e: Event, _data: CallbackData): void;
392
+ // 已选择 option 的文案
393
+ changeCurrentText(): void;
394
+ renderItemList(itemList: ListItem[], curIndex?: number): void;
395
+ destroy(): void;
396
+ render(): string;
397
+ private _getListType;
398
+ }
399
+ /** {zh}
400
+ * @detail error
401
+ */
402
+ /** {en}
403
+ * @detail error
404
+ */
405
+ declare enum Level {
406
+ /** {zh}
407
+ * @brief 严重
408
+ *
409
+ */
410
+ /** {en}
411
+ * @brief Fatal.
412
+ *
413
+ */
414
+ Fatal = "Fatal",
415
+ /** {zh}
416
+ * @brief 报错
417
+ */
418
+ /** {en}
419
+ * @brief Error.
420
+ */
421
+ Error = "Error"
422
+ }
423
+ declare enum ErrorCode {
424
+ /** {zh}
425
+ * @brief 视频解析错误
426
+ * @solution 请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
427
+ */
428
+ /** {en}
429
+ * @brief Video parsing error.
430
+ * @solution Please contact your [technical support](https://www.byteplus.com/en/support).
431
+ */
432
+ MANIFEST_HLS_ERROR = 1100,
433
+ /** {zh}
434
+ * @brief 视频解析错误
435
+ * @solution 请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
436
+ */
437
+ /** {en}
438
+ * @brief Video parsing error.
439
+ * @solution Please contact your [technical support](https://www.byteplus.com/en/support).
440
+ */
441
+ MANIFEST_DASH_ERROR = 1200,
442
+ /** {zh}
443
+ * @brief 网络错误
444
+ * @solution 请检查当前网络环境或播放地址是否合法。
445
+ */
446
+ /** {en}
447
+ * @brief Network error.
448
+ * @solution Please check the current network environment and ensure the pull stream address is valid.
449
+ */
450
+ NETWORK = 2100,
451
+ /** {zh}
452
+ * @brief 网络请求超时
453
+ * @solution 请检查拉流地址是否合法。
454
+ */
455
+ /** {en}
456
+ * @brief Network request timed out
457
+ * @solution Please check whether the pull stream address is valid.
458
+ */
459
+ NETWORK_TIMEOUT = 2101,
460
+ /** {zh}
461
+ * @brief 网络请求 403
462
+ * @solution 请检查拉流地址鉴权信息。
463
+ */
464
+ /** {en}
465
+ * @brief The player received a 403 response code.
466
+ * @solution Check the authentication information in the pull stream address.
467
+ */
468
+ NETWORK_FORBIDDEN = 2103,
469
+ /** {zh}
470
+ * @brief 网络请求 404
471
+ * @solution 请检查拉流地址是否合法。
472
+ */
473
+ /** {en}
474
+ * @brief The player received a 404 response code.
475
+ * @solution Check whether the pull stream address is valid.
476
+ */
477
+ NETWORK_NOTFOUND = 2104,
478
+ /** {zh}
479
+ * @brief 网络请求 206
480
+ * @solution 请检查拉流地址是否合法。
481
+ */
482
+ /** {en}
483
+ * @brief The player received a 206 response code.
484
+ * @solution Check whether the pull stream address is valid.
485
+ */
486
+ NETWORK_RANGE_NOT_SATISFIABLE = 2116,
487
+ /** {zh}
488
+ * @brief 视频解析错误
489
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
490
+ */
491
+ /** {en}
492
+ * @brief Video parsing error.
493
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
494
+ */
495
+ DEMUX_FLV_ERROR = 3100,
496
+ /** {zh}
497
+ * @brief 视频解析错误
498
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
499
+ */
500
+ /** {en}
501
+ * @brief Video parsing error.
502
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
503
+ */
504
+ DEMUX_HLS_ERROR = 3200,
505
+ /** {zh}
506
+ * @brief 视频解析错误
507
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
508
+ *
509
+ */
510
+ /** {en}
511
+ * @brief Video parsing error.
512
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
513
+ *
514
+ */
515
+ DEMUX_MP4_ERROR = 3300,
516
+ /** {zh}
517
+ * @brief 视频解析错误
518
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
519
+ *
520
+ */
521
+ /** {en}
522
+ * @brief Video parsing error.
523
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
524
+ *
525
+ */
526
+ DEMUX_FMP4_ERROR = 3400,
527
+ /** {zh}
528
+ * @brief 视频解析错误
529
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
530
+ *
531
+ */
532
+ /** {en}
533
+ * @brief Video parsing error.
534
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
535
+ *
536
+ */
537
+ DEMUX_SIDX_ERROR = 3410,
538
+ /** {zh}
539
+ * @brief 视频解析错误
540
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
541
+ *
542
+ */
543
+ /** {en}
544
+ * @brief Video parsing error.
545
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
546
+ *
547
+ */
548
+ REMUX_FMP4_ERROR = 4100,
549
+ /** {zh}
550
+ * @brief 视频解析错误
551
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
552
+ *
553
+ */
554
+ /** {en}
555
+ * @brief Video parsing error.
556
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
557
+ *
558
+ */
559
+ REMUX_MP4_ERROR = 4200,
560
+ /** {zh}
561
+ * @brief 获取数据过程被中止
562
+ * @solution 请检查浏览器网络请求是否正常,再尝试重新拉流。
563
+ */
564
+ /** {en}
565
+ * @brief The process of obtaining data was aborted.
566
+ * @solution Check whether the request is correct and then try to pull the stream again.
567
+ */
568
+ MEDIA_ERR_ABORTED = 5101,
569
+ /** {zh}
570
+ * @brief 网络发生错误,无法成功获取媒体文件
571
+ * @solution 请检查浏览器网络请求是否正常,再尝试重新拉流。
572
+ */
573
+ /** {en}
574
+ * @brief A network error occurred and the media file could not be successfully obtained.
575
+ * @solution Check whether the request is correct and then try to pull the stream again.
576
+ */
577
+ MEDIA_ERR_NETWORK = 5102,
578
+ /** {zh}
579
+ * @brief 浏览器在解码媒体资源时发生错误
580
+ * @solution
581
+ * 1. 请检查原始视频是否正常;
582
+ * 2. 重新进行转码和播放;
583
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
584
+ */
585
+ /** {en}
586
+ * @brief An error occurred to the browser while decoding the media resources.
587
+ * @solution
588
+ * 1. Check whether there is any issue with the original video.
589
+ * 2. Re-transcode the video and play it again.
590
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
591
+ */
592
+ MEDIA_ERR_DECODE = 5103,
593
+ /** {zh}
594
+ * @brief 因视频格式不支持、服务器或网络的问题造成视频无法加载
595
+ * @solution
596
+ * 1. 检查浏览器视频数据请求是否正常;
597
+ * 2. 检查浏览器和页面环境是否支持要播放的视频格式;
598
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
599
+ */
600
+ /** {en}
601
+ * @brief The video cannot be loaded due to unsupported video format or server or network issues.
602
+ * @solution
603
+ * 1. Check whether there is any issue with the browser's request.
604
+ * 2. Check whether the browser and the current page support the video format.
605
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
606
+ */
607
+ MEDIA_ERR_SRC_NOT_SUPPORTED = 5104,
608
+ /** {zh}
609
+ * @brief 当前浏览器不支持视频解码
610
+ * @solution
611
+ * 1. 检查浏览器视频数据请求是否正常;
612
+ * 2. 检查浏览器和页面环境是否支持要播放的视频格式;
613
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
614
+ */
615
+ /** {en}
616
+ * @brief The current browser does not support video decoding.
617
+ * @solution
618
+ * 1. Check whether there is any issue with the browser's request.
619
+ * 2. Check whether the browser and the current page support the video format.
620
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
621
+ */
622
+ MEDIA_ERR_CODEC_NOT_SUPPORTED = 5105,
623
+ /** {zh}
624
+ * @brief 当前播放地址为空
625
+ * @solution 请检查必要参数 `url` 或 `playlist` 是否传入。
626
+ */
627
+ /** {en}
628
+ * @brief The current pull stream address is empty.
629
+ * @solution Check whether 'url' or 'playlist' is specified.
630
+ */
631
+ MEDIA_ERR_URL_EMPTY = 5106,
632
+ /** {zh}
633
+ * @brief 播放异常
634
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
635
+ */
636
+ /** {en}
637
+ * @brief A playback issue occurred.
638
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
639
+ */
640
+ MEDIA_MSE_ADD_SB = 5200,
641
+ /** {zh}
642
+ * @brief 播放异常
643
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
644
+ */
645
+ /** {en}
646
+ * @brief A playback issue occurred.
647
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
648
+ */
649
+ MEDIA_MSE_APPEND_BUFFER = 5201,
650
+ /** {zh}
651
+ * @brief 播放异常
652
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
653
+ */
654
+ /** {en}
655
+ * @brief A playback issue occurred.
656
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
657
+ */
658
+ MEDIA_MSE_OTHER = 5202,
659
+ /** {zh}
660
+ * @brief 播放异常
661
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
662
+ */
663
+ /** {en}
664
+ * @brief A playback issue occurred.
665
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
666
+ */
667
+ MEDIA_MSE_FULL = 5203,
668
+ /** {zh}
669
+ * @brief 播放异常
670
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
671
+ */
672
+ /** {en}
673
+ * @brief A playback issue occurred.
674
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
675
+ */
676
+ MEDIA_MSE_HIJACK = 5204,
677
+ /** {zh}
678
+ * @brief 播放异常
679
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
680
+ */
681
+ /** {en}
682
+ * @brief A playback issue occurred.
683
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
684
+ */
685
+ MEDIA_EME_HIJACK = 5301,
686
+ /** {zh}
687
+ * @brief DRM 权限校验失败
688
+ * @hidden
689
+ */
690
+ /** {en}
691
+ * @brief DRM authentication failed.
692
+ * @hidden
693
+ */
694
+ DRM_LICENSE = 7100,
695
+ /** {zh}
696
+ * @brief DRM 权限校验失败
697
+ * @hidden
698
+ */
699
+ /** {en}
700
+ * @brief DRM authentication failed.
701
+ * @hidden
702
+ */
703
+ DRM_CUSTOM_LICENSE = 7200,
704
+ /** {zh}
705
+ * @brief 播放异常
706
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
707
+ */
708
+ /** {en}
709
+ * @brief A playback issue occurred.
710
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
711
+ */
712
+ OTHER = 8000,
713
+ /** {zh}
714
+ * @brief 播放异常
715
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
716
+ */
717
+ /** {en}
718
+ * @brief A playback issue occurred.
719
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
720
+ */
721
+ RUNTIME_NO_CANPLAY_ERROR = 9001,
722
+ /** {zh}
723
+ * @brief 播放异常
724
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
725
+ */
726
+ /** {en}
727
+ * @brief A playback issue occurred.
728
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
729
+ */
730
+ RUNTIME_BUFFERBREAK_ERROR = 9002,
731
+ /** {zh}
732
+ * @brief 播放异常
733
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
734
+ */
735
+ /** {en}
736
+ * @brief A playback issue occurred.
737
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
738
+ */
739
+ RUNTIME_BWAITING_TIMEOUT_ERROR = 9002,
740
+ // veplayer 报错
741
+ /** {zh}
742
+ * @brief CDN 异步获取失败
743
+ * @solution 请刷新重试或者检查网络环境。
744
+ *
745
+ */
746
+ /** {en}
747
+ * @brief CDN asynchronous fetch failed.
748
+ * @solution Refresh the page or check the network environment.
749
+ *
750
+ */
751
+ MODULE_LOAD_ERROR = 110,
752
+ /** {zh}
753
+ * @hidden
754
+ */
755
+ /** {en}
756
+ * @hidden
757
+ */
758
+ UNKNOWN = "UNKNOWN"
759
+ }
760
+ declare enum ErrorType {
761
+ MANIFEST = "manifest",
762
+ NETWORK = "network",
763
+ DEMUX = "demux",
764
+ REMUX = "remux",
765
+ MEDIA = "media",
766
+ DRM = "drm",
767
+ OTHER = "other",
768
+ RUNTIME = "runtime"
769
+ }
770
+ interface ErrorInfo<T = TextKey> {
771
+ errorCode?: ErrorCode;
772
+ message?: string;
773
+ messageTextKey?: T;
774
+ level?: Level;
775
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
776
+ ext?: any;
777
+ error?: Error;
778
+ }
779
+ /** {zh}
780
+ * @list error
781
+ * @detail error
782
+ * @brief 错误对象
783
+ * @name VeError
784
+ * @id VeError
785
+ */
786
+ /** {en}
787
+ * @list error
788
+ * @detail error
789
+ * @brief The error object.
790
+ * @name VeError
791
+ * @id VeError
792
+ */
793
+ declare class VeError<T extends string = TextKey> extends Error {
794
+ /**
795
+ * @brief 错误码。
796
+ */
797
+ /** {en}
798
+ * @brief The error code.
799
+ */
800
+ readonly errorCode: ErrorCode;
801
+ /** {zh}
802
+ * @brief 错误等级。
803
+ */
804
+ /** {en}
805
+ * @brief The error level.
806
+ */
807
+ readonly level?: Level;
808
+ /** {zh}
809
+ * @brief 错误信息。
810
+ */
811
+ /** {en}
812
+ * @brief The error message.
813
+ */
814
+ message: string;
815
+ /** {zh}
816
+ * @brief 其他错误信息。
817
+ */
818
+ /** {en}
819
+ * @brief Other error messages.
820
+ */
821
+ readonly ext?: any;
822
+ /** {zh}
823
+ * @hidden
824
+ * @param error
825
+ * @param i18n
826
+ */
827
+ /** {en}
828
+ * @hidden
829
+ * @param error
830
+ * @param i18n
831
+ */
832
+ constructor(error?: string | ErrorInfo<T>, i18n?: VeI18n<T>);
833
+ }
834
+ /** {zh}
835
+ * @list option
836
+ * @kind property
837
+ */
838
+ /** {en}
839
+ * @list option
840
+ * @kind property
841
+ */
842
+ type ErrorConfig = {
843
+ /** {zh}
844
+ * @brief 是否展示报错图片。
845
+ * @default true
846
+ */
847
+ /** {en}
848
+ * @brief Whether to display the error image.
849
+ * @default true
850
+ */
851
+ showErrorImg?: boolean;
852
+ /** {zh}
853
+ * @brief 是否展示报错提示。
854
+ * @default true
855
+ */
856
+ /** {en}
857
+ * @brief Whether to display the error message.
858
+ * @default true
859
+ */
860
+ showErrorTip?: boolean;
861
+ /** {zh}
862
+ * @brief 是否展示刷新按钮。
863
+ * @default true
864
+ */
865
+ /** {en}
866
+ * @brief Whether to display the refresh button.
867
+ * @default true
868
+ */
869
+ showRefresh?: boolean;
870
+ /** {zh}
871
+ * @brief 自定义报错显示。
872
+ * @default 无
873
+ */
874
+ /** {en}
875
+ * @brief Custom error message.
876
+ * @default None
877
+ */
878
+ errorTipsText?: string | Record<Lang, string>;
879
+ /** {zh}
880
+ * @brief 更多提示信息。
881
+ * @default 无
882
+ */
883
+ /** {en}
884
+ * @brief More tips.
885
+ * @default None
886
+ */
887
+ extraTips?: {
888
+ label: string | Record<Lang, string>;
889
+ value: string | Record<Lang, string>;
890
+ }[];
891
+ };
892
+ declare class Error extends Plugin {
893
+ player: Player$0;
894
+ icons: {
895
+ error: HTMLElement;
896
+ };
897
+ langText: {
898
+ refresh: string;
899
+ errorTip: string;
900
+ };
901
+ config: ErrorConfig;
902
+ private _error?;
903
+ static get pluginName(): string;
904
+ static get defaultConfig(): {
905
+ showErrorImg: boolean;
906
+ showErrorTip: boolean;
907
+ showRefresh: boolean;
908
+ errorTipsText: string;
909
+ extraTips: never[];
910
+ position: string;
911
+ };
912
+ get _errorTip(): string;
913
+ afterCreate(): void;
914
+ registerIcons(): {
915
+ error: {
916
+ icon: any;
917
+ class: string;
918
+ };
919
+ };
920
+ updateLang(): void;
921
+ showError(error: VeError | XGError): void;
922
+ hideError(): void;
923
+ destroy(): void;
924
+ render(): string;
925
+ private _focus;
926
+ private _initIcons;
927
+ private _initEvents;
928
+ private _renderText;
929
+ private _renderExtraTips;
930
+ private _handleRefresh;
931
+ private _renderRefresh;
932
+ }
933
+ /** {zh}
934
+ * @list option
935
+ * @kind property
936
+ */
937
+ /** {en}
938
+ * @list option
939
+ * @kind property
940
+ */
941
+ interface DefinitionConfig {
942
+ /** {zh}
943
+ * @brief 等待超时的时间阈值,单位为 ms。等待超过该值,会抛出 `DEFINITION_FALLBACK` 事件,如果 `needFallback` 为 `true` 则会提示清晰度降级。
944
+ * @default 5000
945
+ */
946
+ /** {en}
947
+ * @brief The maximum wait time before a fallback, in milliseconds. If the wait time exceeds this value, a `DEFINITION_FALLBACK` event will occur, and if `needFallback` is set to `true`, the player will fall back to a lower resolution.
948
+ * @default 5000
949
+ */
950
+ longWaitingTime?: number;
951
+ /** {zh}
952
+ * @brief 是否开启清晰度降级。
953
+ * @default false
954
+ */
955
+ /** {en}
956
+ * @brief Whether to enable resolution fallback.
957
+ * @default false
958
+ */
959
+ needFallback?: boolean;
960
+ /** {zh}
961
+ * @brief 降级顺序,按照数组顺序依次降级,数组中的元素与 playlist 中的 definition 相对应。
962
+ * @default ['uhd', 'hd', 'sd', 'ld', 'ao']
963
+ */
964
+ /** {en}
965
+ * @brief The order of fallback. The player will fall back to each resolution according to the order of the array element. The values of the array elements should correspond to the value of the `definition` in the playlist.
966
+ * @default "['uhd', 'hd ',' sd ',' ld ',' ao ']"
967
+ */
968
+ demotePriority?: string[];
969
+ }
970
+ interface VePlayerBaseOptions extends Omit<PlayerOptions, "autoplay" | "i18n"> {
971
+ /** {zh}
972
+ * @brief 指定播放器容器 ID,VePlayer 将被插入在该容器中。id 和 el 需至少传入 1 个。如果同时传入,则优先将播放器插入 id 容器中。
973
+ * @default 'veplayer'
974
+ */
975
+ /** {en}
976
+ * @brief The container ID of the player. You should specify either `id` or `el`, or both. If both are specified, the `VePlayer` object will be inserted in the container specified by `id`.
977
+ * @default 'veplayer'
978
+ */
979
+ id?: string;
980
+ /** {zh}
981
+ * @brief 指定播放器容器元素,VePlayer 将被插入在该容器中。id 和 el 需至少传入 1 个。如果同时传入,则优先将播放器插入 id 容器中。
982
+ * @default 无
983
+ */
984
+ /** {en}
985
+ * @brief The container element of the player. You should specify either `id` or `el`, or both. If both are specified, the `VePlayer` object will be inserted in the container specified by `id`.
986
+ */
987
+ el?: HTMLElement;
988
+ /** {zh}
989
+ * @brief 设置播放器宽度,传入 number 类型参数则播放器内部默认添加单位px,传入 string 类型参数则直接赋值给播放器容器 width 样式属性。
990
+ * @default '100%'
991
+ */
992
+ /** {en}
993
+ * @brief The width of the player. If you set it to a number, the player will attach the unit "pixel" to it. If you set it to a string, the parameter value will be directly assigned to the `width` property of the player container.
994
+ * @default '100%'
995
+ */
996
+ width?: number | string;
997
+ /** {zh}
998
+ * @brief 设置播放器高度,传入 number 类型参数则播放器内部默认添加单位px,传入 string 类型参数则直接赋值给播放器容器 height 样式属性。
999
+ * @default '100%'
1000
+ */
1001
+ /** {en}
1002
+ * @brief The height of the player. If you set it to a number, the player will attach the unit "pixel" to it. If you set it to a string, the parameter value will be directly assigned to the `height` property of the player container.
1003
+ * @default '100%'
1004
+ */
1005
+ height?: number | string;
1006
+ /** {zh}
1007
+ * @brief 为播放器配置直播拉流地址。您可手动拼接或使用地址生成器生成拉流地址,生成方法请参见[生成直播地址](https://www.volcengine.com/docs/6469/107759)。url 和 playList 需至少传入 1 个。
1008
+ * @default 无
1009
+ */
1010
+ /** {en}
1011
+ * @brief The pull stream address. You can manually construct the address or use the address generator to generate one. To see how to generate an address, refer to [Generate live-stream addresses](https://docs.byteplus.com/en/byteplus-media-live/docs/generating-live-stream-addresses). You should specify either `url` or `playList`, or both.
1012
+ */
1013
+ url?: string;
1014
+ /** {zh}
1015
+ * @brief 为播放器配置直播拉流地址列表。url 和 playlist 需至少传入 1 个。
1016
+ * @default 无
1017
+ */
1018
+ /** {en}
1019
+ * @brief A list of live stream sources for the player. You should specify either `url` or `playList`, or both.
1020
+ */
1021
+ playlist?: ExposedSource[];
1022
+ /** {zh}
1023
+ * @brief 当存在多个直播线路时,为播放器设置默认直播线路,不传则默认列表第一个。
1024
+ * @default 无
1025
+ */
1026
+ /** {en}
1027
+ * @brief The default pull stream address for the player when there are multiple addresses available. If this parameter is not specified, the first address in the playlist will become the default address.
1028
+ */
1029
+ defaultSource?: string;
1030
+ /** {zh}
1031
+ * @brief 为播放器设置默认直播清晰度,不传则默认列表第一个。
1032
+ * @default 无
1033
+ */
1034
+ /** {en}
1035
+ * @brief The default resolution for the player when there are multiple resolutions available. If this parameter is not specified, the first resolution in the list will become the default resolution.
1036
+ */
1037
+ defaultDefinition?: string;
1038
+ /** {zh}
1039
+ * @brief 为播放器设置备路拉流地址,支持设置多个备路拉流地址,在 `maxFallbackRound` 大于 `0` 时有效。当您使用配置的直播拉流地址拉流失败时,会在直播地址和备路直播地址之间循环拉流,直到拉流成功。
1040
+ * @default 无
1041
+ */
1042
+ /** {en}
1043
+ * @brief The backup pull stream address(es) for the player. You can enter multiple backup addresses. If `maxFallbackRound` is greater than `0`, when an error occurs in the main address, the player automatically switches to the backup address.
1044
+ */
1045
+ fallbackUrls?: string[];
1046
+ /** {zh}
1047
+ * @brief 为播放器设置拉流失败时循环拉流的最大次数。
1048
+ * @default 0
1049
+ */
1050
+ /** {en}
1051
+ * @brief The maximum number of retries the player can make if it fails to pull the stream with the default address.
1052
+ * @default 0
1053
+ */
1054
+ maxFallbackRound?: number;
1055
+ /** {zh}
1056
+ * @brief 为播放器设置解码方式。
1057
+ * @listtip
1058
+ * 开启软解后,播放器会使用浏览器的软件解码器来解码视频流。软解模式具有较高的兼容性,适用于各种设备和浏览器,但依赖设备 CPU,在高分辨率或高码率视频播放时会出现卡顿或延迟。建议在以下场景开启软解:
1059
+ * 1. 部分安卓浏览器中播放器被劫持,部分功能将不可见,可开启软解;
1060
+ * 2. 移动端浏览器不支持 flv 格式,如果需要播放该格式的视频,可开启软解;
1061
+ * 3. 部分浏览器不支持 H.265 编码格式,如果需要播放该编码格式的视频,请开启软解。
1062
+ * @default 'hardware'
1063
+ */
1064
+ /** {en}
1065
+ * @brief The decoding method for the player.
1066
+ * @listtip
1067
+ * When software decoding is enabled, the player uses the software decoder of the browser to decode the stream. Software decoding offers high compatibility and is suitable for various devices and browsers, but it relies on the device's CPU capacity and may have freezes or latencies when playing high-resolution or high-bitrate videos. We recommend enabling software decoding in the following scenarios:
1068
+ * 1. In certain Android browsers, the player can sometimes be hijacked, causing certain features to be unavailable. Enabling software decoding can address this issue.
1069
+ * 2. Browsers on mobile devices do not support the FLV format. To play videos in this format, you can enable software decoding.
1070
+ * 3. Some browsers do not support the H.265 codec. To play videos encoded with H.265, you can enable software decoding.
1071
+ * @default 'hardware'
1072
+ */
1073
+ decodeType?: DecodeType;
1074
+ /** {zh}
1075
+ * @brief 为播放器设置视频的实际编码格式。如果您在degradation 设置了 `soft-first` 属性(即硬解不支持时降级软解),建议您传入该参数,省去探测实际编码格式的操作。
1076
+ * @default 'h264'
1077
+ */
1078
+ /** {en}
1079
+ * @brief The actual codec of the live stream. If you specify `degradation` to `soft-first`, that is, the player should fall back to software decoding when hardware decoding is not supported, we recommend specifying the parameter so that the player does not need to detect the codec information.
1080
+ * @default 'h264'
1081
+ */
1082
+ codec?: Codec;
1083
+ /** {zh}
1084
+ * @brief 为播放器设置是否开启 H.265 兼容模式。在 H.265 兼容模式下,播放器会优先使用硬解来解码 H.265 直播流。如果设备或浏览器不支持 H.265 硬解,则自动降级为 H.265 软解。
1085
+ * @default 'soft-first'
1086
+ */
1087
+ /** {en}
1088
+ * @brief Whether to enable H.265 compatibility mode for the player. In the H.265 compatibility mode, the player will prioritize hardware decoding for decoding H.265 streams. If the device or browser does not support hardware decoding for H.265, it will automatically fall back to software decoding.
1089
+ * @default 'soft-first'
1090
+ */
1091
+ degradation?: Degradation | boolean;
1092
+ /** {zh}
1093
+ * @brief 为播放器设置封面图 URL。
1094
+ * @default 无
1095
+ */
1096
+ /** {en}
1097
+ * @brief The URL of the player's cover image.
1098
+ */
1099
+ poster?: string;
1100
+ /** {zh}
1101
+ * @brief 为播放器设置初始显示语言,语言包不存在的情况下默认显示 'en' 语言包 。默认值为 `document.documentElement.getAttribute('lang') || navigator.language || 'zh-cn'`
1102
+ * @default -
1103
+ */
1104
+ /** {en}
1105
+ * @brief The initial display language of the player. If the language pack does not exist, the 'en'language pack will be displayed by default. The default value is `document.documentElement.getAttribute('lang') || navigator.language || 'zh-cn'`.
1106
+ * @default -
1107
+ */
1108
+ lang?: Lang;
1109
+ /** {zh}
1110
+ * @brief 为播放器设置自定义的多语言词典,可设置每个语种的词典,格式为 { texts: { [key: string]: Object; } }。
1111
+ * 例如,{ texts: { 'zh-cn': { PIP: '画中画' }, en: { PIP: 'pip' } }} ,格式请参考[默认词典](https://www.volcengine.com/docs/6469/127529)。
1112
+ * @default 无
1113
+ */
1114
+ /** {en}
1115
+ * @brief Configures a custom multilingual dictionary for the player. You can set the dictionary for each language in the format { texts: { [key: string]: Object; } }. For example, { texts: { 'zh-cn': { PIP: '画中画' }, en: { PIP: 'pip' } }}.
1116
+ * You can use the [default dictionary](https://docs.byteplus.com/byteplus-media-live/docs/default-dictionary_1) as a reference.
1117
+ */
1118
+ i18n?: {
1119
+ texts: Record<Lang, Record<string, string>>;
1120
+ };
1121
+ /** {zh}
1122
+ * @brief 为播放器设置是否自动播放, `muted` 设置为 `true` 为静音自动播放。
1123
+ * @default { muted: true }
1124
+ * @type {{ muted: boolean } | boolean}
1125
+ */
1126
+ /** {en}
1127
+ * @brief Whether to enable autoplay for the player. If `muted` is set to `true`, the autoplay is muted.
1128
+ * @default { muted: true }
1129
+ * @type {{ muted: boolean } | boolean}
1130
+ */
1131
+ autoplay?: {
1132
+ muted?: boolean;
1133
+ } | boolean;
1134
+ /** {zh}
1135
+ * @brief 为播放器设置默认音量,取值范围 [0,1]。
1136
+ * @default 0.6
1137
+ */
1138
+ /** {en}
1139
+ * @brief The default volume for the player. Valid range: [0,1].
1140
+ * @default 0.6
1141
+ */
1142
+ volume?: number;
1143
+ /** {zh}
1144
+ * @brief 为播放器设置是否显示画中画功能按钮。
1145
+ * - `true`:显示;
1146
+ * - `false`:不显示。
1147
+ * @default false
1148
+ */
1149
+ /** {en}
1150
+ * @brief Whether to display the Picture-in-Picture (PiP) button.
1151
+ * - `true`: Display;
1152
+ * - `false`: Do not display.
1153
+ * @default false
1154
+ */
1155
+ pip?: boolean;
1156
+ /** {zh}
1157
+ * @brief 为播放器设置是否显示全屏功能按钮,并进行全屏功能设置。
1158
+ * - `true`:显示;
1159
+ * - `false`:不显示。
1160
+ */
1161
+ /** {en}
1162
+ * @brief Whether to display the full-screen button.
1163
+ * - `true`: Display;
1164
+ * - `false`: Do not display.
1165
+ * @default -
1166
+ */
1167
+ fullscreen?: boolean | Fullscreen;
1168
+ /** {zh}
1169
+ * @brief 为播放器设置报错信息,支持配置播放异常时,播放器显示的异常文案、图片,以及是否提供刷新按钮等。
1170
+ * @default -
1171
+ */
1172
+ /** {en}
1173
+ * @brief The error message of the player. When a playback error occurs, you can configure the error message and image displayed and whether to display the refresh button.
1174
+ * @default -
1175
+ */
1176
+ error?: ErrorConfig;
1177
+ /** {zh}
1178
+ * @brief 为播放器设置清晰度的相关配置。
1179
+ * @default -
1180
+ */
1181
+ /** {en}
1182
+ * @brief Resolution-related configurations.
1183
+ * @default -
1184
+ */
1185
+ definition?: DefinitionConfig;
1186
+ /** {zh}
1187
+ * @brief 为播放器设置是否显示控制栏。
1188
+ * - `true`: 显示;
1189
+ * - `false`: 不显示
1190
+ * @default true
1191
+ */
1192
+ /** {en}
1193
+ * @brief Whether to display the control bar for the player.
1194
+ * - `true`: Display;
1195
+ * - `false`: Do not display.
1196
+ * @default true
1197
+ */
1198
+ controls?: boolean | {
1199
+ [propName: string]: any;
1200
+ };
1201
+ /** {zh}
1202
+ * @brief 为播放器设置**清晰度选择**或**线路选择**时的**选择面板样式**,仅在移动端有效。
1203
+ * @default 'bottom'
1204
+ */
1205
+ /** {en}
1206
+ * @brief Select the panel style for resolution and line selection. This parameter takes effect on mobile devices only.
1207
+ * @default 'bottom'
1208
+ */
1209
+ listType?: ListType;
1210
+ /** {zh}
1211
+ * @brief 为播放器设置是否启用内联播放模式。playsinline 属性是 HTML5 视频标签的一个属性,用于指定视频是否应在页面文档内播放。
1212
+ * - `true`:启用,表示视频将在页面文档内播放;
1213
+ * - `false`:停用,默认浏览器播放行为。
1214
+ * 该配置项只在移动端生效,当取值为 true 的时候,会在初始化 video 或 audio 对象的时候,将 playsinline、webkit-playsinline、x5-playsinline 三个属性设置为 true,请参考 [New Policies for iOS](https://webkit.org/blog/6784/new-video-policies-for-ios/) 了解内联模式相关知识。
1215
+ * @listtip
1216
+ * - iOS 10 及以上系统 Safari 浏览器支持配置内联播放模式;
1217
+ * - iOS 10 以下系统 Safari 浏览器不支持配置内联播放模式 ,默认播放即进入系统全屏。
1218
+ * @default true
1219
+ */
1220
+ /** {en}
1221
+ * @brief Whether to enable inline playback for the player. The `playsinline` property is a property of the `video` element in HTML5. It specifies whether the video should be played inline.
1222
+ * - `true`: Enable inline playback.
1223
+ * - `false`: Disable. The default browser playback behavior will be used.
1224
+ * This option only takes effect on mobile devices. When it is set to `true`, the `playsinline`, `webkit-playsinline`, and `x5-playsinline` properties are set to `true` when the video or audio objects are initialized. You can refer to [New Policies for iOS](https://webkit.org/blog/6784/new-video-policies-for-ios/) for more information about the inline playback.
1225
+ * @listtip
1226
+ * - Safari on iOS 10 and above supports inline playback.
1227
+ * - Safari on iOS versions lower than 10 does not support inline playback. The player will automatically enter fullscreen mode when playback begins.
1228
+ * @default true
1229
+ */
1230
+ playsinline?: boolean;
1231
+ /** {zh}
1232
+ * @brief 为播放器设置 video 标签扩展属性,初始化时会设置在 videoElement 或 audioElement 对象上,请参考 [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#properties) 查看其支持的属性配置。
1233
+ * @default 无
1234
+ */
1235
+ /** {en}
1236
+ * @brief Additional properties for the `video` element that will be applied when the `videoElement` or `audioElement` objects are initialized. Refer to [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#properties) for supported properties.
1237
+ */
1238
+ videoAttributes?: {
1239
+ [propName: string]: any;
1240
+ };
1241
+ /** {zh}
1242
+ * @brief 为播放器设置是否启用流式布局,启用流式布局后播放器会根据屏幕的宽度进行调整,保持在不同屏幕尺寸上都有良好的显示效果。
1243
+ * - `true`:启用
1244
+ * - `false`:停用
1245
+ * @listtip
1246
+ * 启用流式布局时:
1247
+ * - 如果 `width` 和 `height` 是 `Number` 类型,则按照其数值计算播放器宽高比;
1248
+ * - 如果 `width` 和 `height` 不是 `Number` 类型,默认使用 16:9 比例。
1249
+ * @default false
1250
+ */
1251
+ /** {en}
1252
+ * @brief Whether to enable responsive layout for the player. If responsive layout is enabled, the player size will be auto-adjusted according to the width of the screen to ensure a proper display on different screen sizes.
1253
+ * - `true`: Enable
1254
+ * - `false`: Disable
1255
+ * @listtip
1256
+ * When responsive layout is enabled:
1257
+ * If `width` and `height` are of type number, the player's aspect ratio will be determined based on their values.
1258
+ * If `width` and `height` are not of type number, the player uses a 16:9 aspect ratio.
1259
+ * @default false
1260
+ */
1261
+ fluid?: boolean;
1262
+ /** {zh}
1263
+ * @brief 为播放器设置尺寸适配方式,在视频资源初始化之后,根据获取到的 videoWidth 和 videoHeight 值对播放器容器宽高比例进行调整,可选项有:
1264
+ * - `fixed`: 保持容器宽/高,不做适配;
1265
+ * - `fixWidth`: 保持容器宽度,适配高度;
1266
+ * - `fixHeight`: 保持容器高度,适配宽度。
1267
+ * @default 'fixed'
1268
+ */
1269
+ /** {en}
1270
+ * @brief The adaptation mode for the player size. After the video resource is initialized, the player container's aspect ratio is adjusted based on the obtained values of `videoWidth` and `videoHeight`. The available options include:
1271
+ * - `fixed`: Keep the container's width and height without adaptation;
1272
+ * - `fixWidth`: Keep the container's width and adjust the height;
1273
+ * - `fixHeight`: Keep the container's height and adjust the width.
1274
+ * @default 'fixed'
1275
+ */
1276
+ fitVideoSize?: "fixWidth" | "fixHeight" | "fixed";
1277
+ /** {zh}
1278
+ * @brief 为播放器设置视频画面填充模式,可选项有:
1279
+ * - `fillwidth`: 填充宽度,高度溢出则裁剪高度;
1280
+ * - `fillHeight`: 填充高度,宽度溢出则裁剪宽度;
1281
+ * - `fill`: 拉伸视频以填充容器;
1282
+ * - `cover`: 保持其宽高比的同时填充元素的整个内容框;
1283
+ * - `auto`: 使用浏览器默认的视频画面填充模式。
1284
+ * @default 'auto'
1285
+ */
1286
+ /** {en}
1287
+ * @brief The fill mode of the video. The available options include:
1288
+ * - `fillwidth`: Fill the width of the container and crop the height if necessary.
1289
+ * - `fillHeight`: Fill the height of the container and crop the width if necessary.
1290
+ * - `fill`: Stretch the video to fill the container;
1291
+ * - `cover`: Fill the entire container while keeping the original aspect ratio;
1292
+ * - `auto`: Use the default fill mode of the browser.
1293
+ * @default 'auto'
1294
+ */
1295
+ videoFillMode?: "auto" | "fillHeight" | "fillWidth" | "fill" | "cover";
1296
+ /** {zh}
1297
+ * @brief 是否开启画面和控制栏分离模式。设置为开启时,控制栏将会常驻,与视频画面不重叠。
1298
+ * - `true`:开启
1299
+ * - `false`:关闭
1300
+ * @default false
1301
+ */
1302
+ /** {en}
1303
+ * @brief Whether to enable the separation of the video and the control bar. When enabled, the control bar will remain visible without overlapping the video content.
1304
+ * - `true`: Enable
1305
+ * - `false`: Disable
1306
+ * @default false
1307
+ */
1308
+ marginControls?: boolean;
1309
+ /** {zh}
1310
+ * @brief 启用微信同层播放。
1311
+ * @default 无
1312
+ */
1313
+ /** {en}
1314
+ * @brief Enable playing the video on the same player as WeChat.
1315
+ */
1316
+ "x5-video-player-type"?: string;
1317
+ /** {zh}
1318
+ * @brief 是否启用微信全屏播放模式。
1319
+ * - `true`:启用
1320
+ * - `false`:停用
1321
+ * @default 无
1322
+ */
1323
+ /** {en}
1324
+ * @brief Whether to enable full-screen playback in WeChat.
1325
+ * - `true`: Enable
1326
+ * - `false`: Disable
1327
+ */
1328
+ "x5-video-player-fullscreen"?: boolean;
1329
+ /** {zh}
1330
+ * @brief 微信横竖屏控制,支持如下取值:
1331
+ * - `landscape`:横屏
1332
+ * - `portrait`:竖屏
1333
+ * - `landscape|portrait`:跟随手机自动旋转
1334
+ * @default 无
1335
+ */
1336
+ /** {en}
1337
+ * @brief The orientation of the video when played on WeChat. The following values are supported:
1338
+ * - `landscape`: Horizontal screen;
1339
+ * - `portrait`: Vertical screen;
1340
+ * - `landscape | portrait`: Rotate with the mobile.
1341
+ */
1342
+ "x5-video-orientation"?: "landscape" | "portrait" | "landscape|portrait";
1343
+ /** {zh}
1344
+ * @brief 为播放器配置关键点样式。
1345
+ * @default 无
1346
+ * @hidden 直播目前没用到
1347
+ */
1348
+ /** {en}
1349
+ * @brief Configures the keypoint style for the player.
1350
+ * @hidden
1351
+ */
1352
+ commonStyle?: CommonStyle;
1353
+ /** {zh}
1354
+ * @brief 自定义插件列表。
1355
+ * @default 无
1356
+ */
1357
+ /** {en}
1358
+ * @brief A list of custom plugins.
1359
+ */
1360
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1361
+ plugins?: any[];
1362
+ /** {zh}
1363
+ * @hidden
1364
+ */
1365
+ /** {en}
1366
+ * @hidden
1367
+ */
1368
+ preparePlugins?: PreparePlugins;
1369
+ }
1370
+ /** {zh}
1371
+ * @list option
1372
+ * @kind property
1373
+ */
1374
+ /** {en}
1375
+ * @list option
1376
+ * @kind property
1377
+ */
1378
+ interface Fullscreen {
1379
+ /** {zh}
1380
+ * @brief 切换全屏时,是否旋转为横屏播放,通常在移动端使用。如果开启横屏播放,切换全屏时,将在竖屏状态下把播放器旋转 90 度,实现横屏效果。该配置优先级高于 useCssFullscreen。
1381
+ * - `true`:使用旋转横屏;
1382
+ * - `false`:不使用旋转横屏。
1383
+ * @default false
1384
+ */
1385
+ /** {en}
1386
+ * @brief Whether to play the video in landscape mode when the video enters full-screen mode. This feature is usually used on mobile devices. Once enabled, when the video enters fullscreen mode, the player will be rotated from portrait mode by 90 degrees to landscape mode. This property has a higher priority over `useCssFullscreen`.
1387
+ * - `true`: Enable.
1388
+ * - `false`: Disable.
1389
+ * @default false
1390
+ */
1391
+ rotateFullscreen?: boolean;
1392
+ /** {zh}
1393
+ * @brief 是否使用页面全屏代替系统全屏功能。
1394
+ * - `true`:页面全屏;
1395
+ * - `false`:系统全屏。
1396
+ * @default false
1397
+ */
1398
+ /** {en}
1399
+ * @brief Whether to use full-window.
1400
+ * - `true`: Use full-window mode, in which the player covers the browser window.
1401
+ * - `false`: Use full-screen mode, in which the player covers the entire desktop.
1402
+ * @default false
1403
+ */
1404
+ useCssFullscreen?: boolean;
1405
+ /** {zh}
1406
+ * 全屏的时候是否显示右上角返回按钮,通常在移动端开启。
1407
+ * - `true`:显示;
1408
+ * - `false`:不显示。
1409
+ * @default false
1410
+ */
1411
+ /** {en}
1412
+ * Whether to display a return button at the top-right corner when the player is in full-screen mode. This feature is usually turned on on mobile devices.
1413
+ * `true`: Display;
1414
+ * `false`: Do not display.
1415
+ * @default false
1416
+ * @brief
1417
+ * Whether to display a return button at the top-right corner when the player is in full-screen mode. This feature is usually turned on on mobile devices.
1418
+ * - `true`: Display;
1419
+ * - `false`: Do not display.
1420
+ */
1421
+ needBackIcon?: boolean;
1422
+ }
1423
+ /** {zh}
1424
+ * @list option
1425
+ * @kind property
1426
+ * @hidden
1427
+ */
1428
+ /** {en}
1429
+ * @list option
1430
+ * @kind property
1431
+ * @hidden
1432
+ */
1433
+ interface CommonStyle {
1434
+ /** {zh}
1435
+ * @brief 进度条底色
1436
+ * @default 无
1437
+ */
1438
+ /** {en}
1439
+ * @brief The background color of the progress bar.
1440
+ */
1441
+ progressColor?: string;
1442
+ /** {zh}
1443
+ * @brief 播放完成部分进度条底色
1444
+ * @default 无
1445
+ */
1446
+ /** {en}
1447
+ * @brief The background color of the progress bar for the completed portion of video playback.
1448
+ */
1449
+ playedColor?: string;
1450
+ /** {zh}
1451
+ * @brief 缓存部分进度条底色
1452
+ * @default 无
1453
+ */
1454
+ /** {en}
1455
+ * @brief
1456
+ * @brief The background color of the progress bar for the cached portion of video playback.
1457
+ */
1458
+ cachedColor?: string;
1459
+ /** {zh}
1460
+ * @brief 进度条滑块样式
1461
+ * @default 无
1462
+ */
1463
+ /** {en}
1464
+ * @brief The style of the progress bar slider.
1465
+ */
1466
+ sliderBtnStyle?: {
1467
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1468
+ [propName: string]: any;
1469
+ };
1470
+ /** {zh}
1471
+ * @brief 音量颜色
1472
+ * @default 无
1473
+ */
1474
+ /** {en}
1475
+ * @brief The color of the volume slider.
1476
+ */
1477
+ volumeColor?: string;
1478
+ }
1479
+ type PrepareResult = {
1480
+ options?: Partial<VePlayerBaseOptions>;
1481
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1482
+ plugins?: any[];
1483
+ };
1484
+ type PreparePlugins = (url: string) => Promise<PrepareResult> | undefined;
1485
+ /** {zh}
1486
+ * @detail option
1487
+ * @brief 视频的实际编码格式。如果您在degradation 设置了 SoftFirst 属性(即硬解不支持降级软解),建议您传入该参数,省去探测实际编码格式的操作。
1488
+ */
1489
+ /** {en}
1490
+ * @detail option
1491
+ * @brief The actual codec of the video.
1492
+ */
1493
+ declare enum Codec {
1494
+ /** {zh}
1495
+ * @brief H.265 编码格式
1496
+ */
1497
+ /** {en}
1498
+ * @brief H.265.
1499
+ */
1500
+ H265 = "h265",
1501
+ /** {zh}
1502
+ * @brief H.264 编码格式
1503
+ */
1504
+ /** {en}
1505
+ * @brief H.264.
1506
+ */
1507
+ H264 = "h264"
1508
+ }
1509
+ /** {zh}
1510
+ * @detail option
1511
+ * @brief 是否开启 H.265 兼容模式。在 H.265 兼容模式下,播放器会优先使用硬解来解码 H.265 直播流。如果设备或浏览器不支持 H.265 硬解,则自动降级为 H.265 软解。
1512
+ */
1513
+ /** {en}
1514
+ * @detail option
1515
+ * @brief Whether to use H.265 compatibility mode. In H.265 compatibility mode, the player will prioritize hardware decoding to decode H.265 video. If the device or browser does not support H.265 hardware decoding, it will automatically fall back to H.265 software decoding.
1516
+ */
1517
+ declare enum Degradation {
1518
+ /** {zh}
1519
+ * @brief 硬解不支持降级到软解
1520
+ */
1521
+ /** {en}
1522
+ * @brief The player does not support falling back to software decoding.
1523
+ */
1524
+ SoftFirst = "soft-first",
1525
+ /** {zh}
1526
+ * @brief 硬解不支持降级到h264
1527
+ * @hidden
1528
+ */
1529
+ /** {en}
1530
+ * @brief The player does not support falling back to H.264.
1531
+ * @hidden
1532
+ */
1533
+ H264First = "h264-first"
1534
+ }
1535
+ /** {zh}
1536
+ * @detail option
1537
+ * @brief 解码方式。
1538
+ * @example
1539
+ */
1540
+ /** {en}
1541
+ * @detail option
1542
+ * @brief Decoding method.
1543
+ * @example
1544
+ */
1545
+ declare enum DecodeType {
1546
+ /** {zh}
1547
+ * @brief 软解
1548
+ */
1549
+ /** {en}
1550
+ * @brief Software decoding.
1551
+ */
1552
+ Software = "software",
1553
+ /** {zh}
1554
+ * @brief 硬解
1555
+ */
1556
+ /** {en}
1557
+ * @brief Hardware decoding.
1558
+ */
1559
+ Hardware = "hardware"
1560
+ }
1561
+ type Constructor<T> = new (...args: any[]) => T;
1562
+ declare class VePlayerBase {
1563
+ protected readonly _player: XGPlayer;
1564
+ private readonly _sourceManager;
1565
+ private readonly _preparePlugins?;
1566
+ private _previousPrepareResult?;
1567
+ private _i18nManager;
1568
+ private _events;
1569
+ private _errorCallback;
1570
+ /** {zh}
1571
+ * @hidden
1572
+ */
1573
+ /** {en}
1574
+ * @hidden
1575
+ */
1576
+ constructor(options?: VePlayerBaseOptions);
1577
+ /** {zh}
1578
+ * @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
1579
+ * - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
1580
+ * - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
1581
+ * - `2`:HAVE_CURRENT_DATA,当前播放位置的数据可用,但不足以播放下一帧
1582
+ * - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
1583
+ * - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
1584
+ */
1585
+ /** {en}
1586
+ * @brief Gets the readiness of the video.
1587
+ * - `0`: HAVE_NOTHING, which means there is no information about the media resources.
1588
+ * - `1`: HAVE_METADATA, which means enough media resources have been retrieved to initialize the metadata and fast-forward/rewind will not raise an exception.
1589
+ * - `2`: HAVE_CURRENT_DATA, which means the data for the current playback position is available, but there is not enough data to play the next frame.
1590
+ * - `3`: HAVE_FUTURE_DATA, which means there is enough data for the current playback position and at least a short period in the future (at least two following frames).
1591
+ * - `4`: HAVE_ENOUGH_DATA, which means there is enough data and the download rate is sufficient for the video to be played without interruption until the end.
1592
+ */
1593
+ get readyState(): 0 | 2 | 1 | 4 | 3;
1594
+ /** {zh}
1595
+ * @brief 获取当前已缓冲的时间范围。
1596
+ */
1597
+ /** {en}
1598
+ * @brief Gets the currently buffered time range.
1599
+ */
1600
+ get buffered(): TimeRanges;
1601
+ /** {zh}
1602
+ * @brief 获取已经播放的音频/视频的时间范围。
1603
+ */
1604
+ /** {en}
1605
+ * @brief Gets the time range of the audio/video that has been played.
1606
+ */
1607
+ get played(): TimeRanges;
1608
+ /** {zh}
1609
+ * @brief 设置/获取视频当前的播放时间, 单位为 s。
1610
+ */
1611
+ /** {en}
1612
+ * @brief Sets or gets the current playback position of the video, in seconds.
1613
+ */
1614
+ get cumulateTime(): number;
1615
+ /** {zh}
1616
+ * @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
1617
+ */
1618
+ /** {en}
1619
+ * @brief Gets whether the player has focus. The control bar is displayed when the player has focus.
1620
+ */
1621
+ get isFocused(): boolean;
1622
+ /** {zh}
1623
+ * @brief 获取播放器是否处于全屏状态。
1624
+ */
1625
+ /** {en}
1626
+ * @brief Gets whether the player is in full-screen mode, in which the player covers the entire desktop.
1627
+ */
1628
+ get isFullscreen(): boolean;
1629
+ /** {zh}
1630
+ * @brief 获取播放器是否处于网页全屏状态。
1631
+ */
1632
+ /** {en}
1633
+ * @brief Gets whether the player is in full-window mode, in which the player covers the entire browser window.
1634
+ */
1635
+ get isCssFullscreen(): boolean;
1636
+ /** {zh}
1637
+ * @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
1638
+ * - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
1639
+ * - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
1640
+ * - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
1641
+ * - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
1642
+ */
1643
+ /** {en}
1644
+ * @brief Gets the network condition of the video.
1645
+ * - `0`: NETWORK_EMPTY, which means there is no data yet, and `readyState` is `HAVE_NOTHING`.
1646
+ * - `1`: NETWORK_IDLE, which means the `HTMLMediaElement` element is active and the resources have been selected, but the network is not in use.
1647
+ * - `2`: NETWORK_LOADING, which means the browser is downloading the data of the `HTMLMediaElement` element.
1648
+ * - `3`: NETWORK_NO_SOURCE, the media source is not found according to the `src` property of the `HTMLMediaElement` element.
1649
+ */
1650
+ get networkState(): 0 | 2 | 1 | 3;
1651
+ /** {zh}
1652
+ * @brief 获取当前视频是否处于暂停状态。
1653
+ */
1654
+ /** {en}
1655
+ * @brief Gets whether the current video is suspended.
1656
+ */
1657
+ get paused(): boolean;
1658
+ /** {zh}
1659
+ * @brief 获取当前视频是否播放结束。
1660
+ */
1661
+ /** {en}
1662
+ * @brief Gets whether the current video has finished playing.
1663
+ */
1664
+ get ended(): boolean;
1665
+ /** {zh}
1666
+ * @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
1667
+ * - `0`:ERROR,播放出现错误
1668
+ * - `1`:INITIAL,初始化
1669
+ * - `2`:READY,配置/事件/插件等均已经初始化/绑定/实例化完成
1670
+ * - `3`:ATTACHING,进入媒体对象挂载阶段
1671
+ * - `4`:ATTACHED,媒体对象已经挂载到了 DOM 中
1672
+ * - `5`:NOTALLOW,播放被阻止
1673
+ * - `6`:RUNNING,已经成功起播进入播放流程
1674
+ * - `7`:ENDED,播放结束
1675
+ * - `8`:DESTROYED,播放器实例处于已被销毁
1676
+ */
1677
+ /** {en}
1678
+ * @brief Gets the current state of the player.
1679
+ * - `0`: ERROR, which means a playback error occurred
1680
+ * - `1`: INITIAL, which means initialization
1681
+ * - `2`: READY, which means the configuration/event/plug-in has been initialized/bound/instantiated
1682
+ * - `3`: ATTACHING, which means the media object is being mounted.
1683
+ * - `4`: ATTACHED, which means the media object has been mounted in the DOM
1684
+ * - `5`: NOTALLOW, which means the playback is blocked
1685
+ * - `6`: RUNNING, which means the playback has started successfully
1686
+ * - `7`: ENDED, which means the playback has ended
1687
+ * - `8`: DESTROYED, which means the player instance is destroyed
1688
+ */
1689
+ get state(): number;
1690
+ /** {zh}
1691
+ * 获取当前播放视频的拉流地址。
1692
+ */
1693
+ /** {en}
1694
+ * Gets the current pull stream address.
1695
+ */
1696
+ get url(): string | undefined;
1697
+ /** {zh}
1698
+ * @brief 获取当前播放视频的线路名称唯一标识(name)。
1699
+ */
1700
+ /** {en}
1701
+ * @brief Gets the current playback source ID.
1702
+ */
1703
+ get source(): string | undefined;
1704
+ /** {zh}
1705
+ * @brief 获取当前播放视频的清晰度唯一标识(definition)。
1706
+ */
1707
+ /** {en}
1708
+ * @brief Gets the current resolution ID.
1709
+ */
1710
+ get definition(): string;
1711
+ /** {zh}
1712
+ * @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
1713
+ */
1714
+ /** {en}
1715
+ * @brief Gets the player's cross-domain configurations. For more information, refer to [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
1716
+ */
1717
+ get crossOrigin(): string;
1718
+ /** {zh}
1719
+ * @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
1720
+ */
1721
+ /** {en}
1722
+ * @brief Sets the player's cross-domain configurations. For more information, refer to the [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
1723
+ */
1724
+ set crossOrigin(crossOrigin: string);
1725
+ /** {zh}
1726
+ * @brief 获取和设置视频的音量,取值范围为 [0,1]。
1727
+ */
1728
+ /** {en}
1729
+ * @brief Gets the volume of the video. The value range is [0,1].
1730
+ */
1731
+ // eslint-disable-next-line @typescript-eslint/member-ordering
1732
+ get volume(): number;
1733
+ /** {zh}
1734
+ * @brief 获取和设置视频的音量,取值范围为 [0,1]。
1735
+ */
1736
+ /** {en}
1737
+ * @brief Sets the volume of the video. Valid range: [0,1].
1738
+ */
1739
+ set volume(volume: number);
1740
+ /** {zh}
1741
+ * @brief 获取和设置视频静音状态。
1742
+ * - `true`:静音
1743
+ * - `false`:非静音
1744
+ */
1745
+ /** {en}
1746
+ * @brief Gets whether the video is muted.
1747
+ * - `true`: Muted.
1748
+ * - `false`: Not muted.
1749
+ */
1750
+ // eslint-disable-next-line @typescript-eslint/member-ordering
1751
+ get muted(): boolean;
1752
+ /** {zh}
1753
+ * @brief 获取和设置视频静音状态。
1754
+ * - `true`:静音
1755
+ * - `false`:非静音
1756
+ */
1757
+ /** {en}
1758
+ * @brief Mute or unmute the video.
1759
+ * - `true`: Mute the video.
1760
+ * - `false`: Unmute the video.
1761
+ */
1762
+ set muted(isMuted: boolean);
1763
+ /** {zh}
1764
+ * @brief 获取和设置当前语言。
1765
+ */
1766
+ /** {en}
1767
+ * @brief Gets the current language.
1768
+ */
1769
+ // eslint-disable-next-line @typescript-eslint/member-ordering
1770
+ get lang(): "zh-cn" | "en" | string;
1771
+ /** {zh}
1772
+ * @brief 获取和设置当前语言。
1773
+ */
1774
+ /** {en}
1775
+ * @brief Sets the current language.
1776
+ */
1777
+ set lang(lang: "zh-cn" | "en" | string);
1778
+ // eslint-disable-next-line @typescript-eslint/member-ordering
1779
+ protected get _src(): string;
1780
+ /** {zh}
1781
+ * @hidden
1782
+ */
1783
+ /** {en}
1784
+ * @hidden
1785
+ */
1786
+ static create<T extends VePlayerBase>(options?: VePlayerBaseOptions, Constructor?: Constructor<T>): Promise<T>;
1787
+ /** {zh}
1788
+ * @brief 调用此方法切换拉流地址、线路、清晰度。
1789
+ * @param target 目标地址,可以是播放地址,也可以是线路和清晰度
1790
+ * @param options 更多配置信息
1791
+ */
1792
+ /** {en}
1793
+ * @brief Switches the pull stream address, playback source, or resolution.
1794
+ * @param target The target pull stream address, playback source, or resolution.
1795
+ * @param options More configurations.
1796
+ */
1797
+ switch(target: string | {
1798
+ /** {zh}
1799
+ * @brief 清晰度的唯一标识。
1800
+ * @default 无
1801
+ */
1802
+ /** {en}
1803
+ * @brief The resolution ID.
1804
+ */
1805
+ definition?: string;
1806
+ /** {zh}
1807
+ * @brief 线路的唯一标识。
1808
+ * @default 无
1809
+ */
1810
+ /** {en}
1811
+ * @brief The playback source ID.
1812
+ */
1813
+ source?: string;
1814
+ }, options?: {
1815
+ /** {zh}
1816
+ * @brief 清晰度 definition 配置无效时,是否降级到播放列表第一个清晰度地址。
1817
+ * @default false
1818
+ *
1819
+ */
1820
+ /** {en}
1821
+ * @brief Whether to downgrade to the first resolution in the playlist when the player cannot play with the specified resolution.
1822
+ * @default false
1823
+ *
1824
+ */
1825
+ fallbackToFirstDefinition?: boolean;
1826
+ }): Promise<ExposedDefinition>;
1827
+ /** {zh}
1828
+ * @brief 调用此方法更新拉流地址列表。
1829
+ * @param playlist 要更新的播放列表。
1830
+ * @param target 更新后默认播放的资源。
1831
+ */
1832
+ /** {en}
1833
+ * @brief Updates the list of pull stream addresses.
1834
+ * @param Playlist The updated list.
1835
+ * @param Target The default playback resource after the update.
1836
+ */
1837
+ updatePlaylist(playlist: ExposedSource[] | string, target?: string | {
1838
+ /** {zh}
1839
+ * @brief 清晰度唯一标识。
1840
+ * @default 无
1841
+ *
1842
+ */
1843
+ /** {en}
1844
+ * @brief The resolution ID.
1845
+ *
1846
+ */
1847
+ definition?: string;
1848
+ /** {zh}
1849
+ * @brief 线路的唯一标识。
1850
+ * @default 无
1851
+ *
1852
+ */
1853
+ /** {en}
1854
+ * @brief The playback resource ID.
1855
+ *
1856
+ */
1857
+ source?: string;
1858
+ }): Promise<void>;
1859
+ // TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
1860
+ /**
1861
+ /** {zh}
1862
+ * @brief 调用此方法监听指定事件,事件处理函数只执行一次。
1863
+ * @param event 表示事件的名称。
1864
+ * @param callback 表示事件的回调函数。
1865
+ */
1866
+ /** {en}
1867
+ * @brief Listens for a specified event. The event handler is executed only once.
1868
+ * @param event The event name.
1869
+ * @param callback The callback function for the event.
1870
+ */
1871
+ once(event: string, callback: (data?: any) => any): void;
1872
+ /** {zh}
1873
+ * @brief 调用此方法解绑或移除指定事件的事件监听。
1874
+ * @param event 表示事件的名称。
1875
+ * @param callback 表示事件的回调函数。
1876
+ */
1877
+ /** {en}
1878
+ * @brief Stops listening for a specified event.
1879
+ * @param event The event name.
1880
+ * @param callback The callback function for the event.
1881
+ */
1882
+ off(event: string, callback: (data?: any) => any): void;
1883
+ /** {zh}
1884
+ * @brief 调用此方法触发指定事件。
1885
+ * @param event 表示事件的名称。
1886
+ * @param data 事件信息。
1887
+ */
1888
+ /** {en}
1889
+ * @brief Triggers a specified event.
1890
+ * @param event The event name.
1891
+ * @param data The event information.
1892
+ */
1893
+ emit(event: string, data?: any): void;
1894
+ /** {zh}
1895
+ * @brief 调用此方法解绑或移除指定事件的所有事件监听。
1896
+ */
1897
+ /** {en}
1898
+ * @brief Stops listening to any player event.
1899
+ */
1900
+ offAll(): void;
1901
+ /** {zh}
1902
+ * @brief 调用此方法监听指定事件。
1903
+ * @param event 表示事件名称。
1904
+ * @param callback 表示事件的回调函数。
1905
+ */
1906
+ /** {en}
1907
+ * @brief Listens for a specified event.
1908
+ * @param event The event name.
1909
+ * @param callback The callback function for the event.
1910
+ */
1911
+ on(event: string, callback: (data?: any) => any): void;
1912
+ /** {zh}
1913
+ * @brief 调用此方法开始播放 。
1914
+ */
1915
+ /** {en}
1916
+ * @brief Starts playback.
1917
+ */
1918
+ play(): any;
1919
+ /** {zh}
1920
+ * @brief 调用此方法暂停播放。
1921
+ */
1922
+ /** {en}
1923
+ * @brief Pauses playback.
1924
+ */
1925
+ pause(): void;
1926
+ /** {zh}
1927
+ * @brief 调用此方法打开画中画。
1928
+ */
1929
+ /** {en}
1930
+ * @brief Turns on Picture-in-Picture (PIP).
1931
+ */
1932
+ requestPIP(): void;
1933
+ /** {zh}
1934
+ * @brief 调用此方法关闭画中画。
1935
+ */
1936
+ /** {en}
1937
+ * @brief Turns off Picture-in-Picture (PIP).
1938
+ */
1939
+ exitPIP(): void;
1940
+ /** {zh}
1941
+ * @brief 调用此方法重新拉流。
1942
+ */
1943
+ /** {en}
1944
+ * @brief Retries stream-pulling.
1945
+ */
1946
+ retry(): void;
1947
+ /** {zh}
1948
+ * @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
1949
+ * @param data 播放器获取焦点配置信息。
1950
+ */
1951
+ /** {en}
1952
+ * @brief The player gets focus. When the method is called, `veplayer.isFocused` will become `true` and the `PLAYER_FOCUS` event will be triggered.
1953
+ * @param data Related configurations.
1954
+ */
1955
+ focus(data?: {
1956
+ /** {zh}
1957
+ * @brief 是否需要自动失焦,默认为 true,即经过 delay 时长之后,会自动调用 blur() 进行失焦。
1958
+ * @default true
1959
+ */
1960
+ /** {en}
1961
+ * @brief Whether to turn on automatic hide, that is, after the duration specified by `delay`, the `blur` method will be automatically called so that the player loses focus. The default is `true`.
1962
+ * @default true
1963
+ */
1964
+ autoHide?: boolean;
1965
+ /** {zh}
1966
+ * @brief 自动失焦延迟时长,单位ms,autoHide 为 true 时生效。
1967
+ * @default 3000
1968
+ */
1969
+ /** {en}
1970
+ * @brief The duration after which the player automatically loses focus, in milliseconds. This parameter takes effect when `autoHide` is `true`.
1971
+ * @default 3000
1972
+ */
1973
+ delay?: number;
1974
+ }): void;
1975
+ /** {zh}
1976
+ * @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
1977
+ * @param data 播放器失去焦点配置信息。
1978
+ */
1979
+ /** {en}
1980
+ * @brief The player loses focus. When the method is called, `veplayer.isFocused` will become `false` and the `PLAYER_BLUR` event will be triggered.
1981
+ * @param data The related configurations.
1982
+ */
1983
+ blur(data?: {
1984
+ /** {zh}
1985
+ * @brief 播放器失焦是否忽略暂停状态,默认值是 true,即默认暂停的时候不取消播放器焦点状态。
1986
+ * @default false
1987
+ */
1988
+ /** {en}
1989
+ * @brief Whether to ignore the pause state. The default value is `true`, which means the player will not lose focus when the playback is paused.
1990
+ * @default false
1991
+ */
1992
+ ignorePaused?: boolean;
1993
+ }): void;
1994
+ /** {zh}
1995
+ * @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
1996
+ * @param el 全屏作用的 DOM 节点。
1997
+ */
1998
+ /** {en}
1999
+ * @brief Turns the player into full-screen mode, in which the player covers the entire desktop. If the player is in full-window mode when the method is called, it will automatically exit full-window mode, and the `Events.FULLSCREEN_CHANGE` event will be triggered.
2000
+ * @param el The DOM node in which the player is displayed in full-screen mode.
2001
+ */
2002
+ requestFullscreen(el?: HTMLElement): Promise<void>;
2003
+ /** {zh}
2004
+ * @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
2005
+ * @param el 全屏作用的 DOM 节点。
2006
+ */
2007
+ /** {en}
2008
+ * @brief Exits full-screen mode. After the method is called, `veplayer.isFullscreen` will become `false` and the `Events.FULLSCREEN_CHANGE` event will be triggered.
2009
+ * @param el The DOM node of the full screen effect.
2010
+ */
2011
+ exitFullscreen(el?: HTMLElement): Promise<void>;
2012
+ /** {zh}
2013
+ * @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
2014
+ * @param el 全屏作用的 DOM 节点。
2015
+ */
2016
+ /** {en}
2017
+ * @brief Turns the player into full-window mode, in which the player covers the entire browser window. If the player is in full-screen mode when the method is called, it will automatically exit full-screen mode, and the `Events.CSS_FULLSCREEN_CHANGE` event will be triggered.
2018
+ * @param el The DOM node in which the player is displayed in full-window mode.
2019
+ */
2020
+ requestCssFullscreen(el?: HTMLElement): void;
2021
+ /** {zh}
2022
+ * @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
2023
+ */
2024
+ /** {en}
2025
+ * @brief Exits the full-window mode. When the method is called, `veplayer.isFullscreen` will become `false` and the `Events.CSS_FULLSCREEN_CHANGE` event will be triggered.
2026
+ */
2027
+ exitCssFullscreen(): void;
2028
+ /** {zh}
2029
+ * @brief 调用此方法在当前播放器上注册指定插件。
2030
+ * @param plugin 插件构造函数。
2031
+ * @param config 插件的配置列表。
2032
+ */
2033
+ /** {en}
2034
+ * @brief Registers a specified plug-in to the current player.
2035
+ * @param Plugin The plugin constructor.
2036
+ * @param config The plugin configurations.
2037
+ */
2038
+ registerPlugin(plugin:
2039
+ // eslint-disable-next-line @typescript-eslint/ban-types
2040
+ Function | {
2041
+ /** {zh}
2042
+ * @brief 插件构造函数。
2043
+ * @default 无
2044
+ */
2045
+ /** {en}
2046
+ * @brief The plugin constructor.
2047
+ */
2048
+ // eslint-disable-next-line @typescript-eslint/ban-types
2049
+ plugin: Function;
2050
+ /** {zh}
2051
+ * @brief 插件配置参数。
2052
+ * @default 无
2053
+ */
2054
+ /** {en}
2055
+ * @brief The plugin configurations.
2056
+ */
2057
+ options: object;
2058
+ }, config?: {
2059
+ [propName: string]: any;
2060
+ }): any;
2061
+ /** {zh}
2062
+ * @brief 调用此方法在当前播放器上销毁/注销指定插件。
2063
+ * @param plugin 插件实例或者插件名称。
2064
+ */
2065
+ /** {en}
2066
+ * @brief Destroys or unregisters a specified plugin from the player.
2067
+ * @param Plugin The plugin instance or name.
2068
+ */
2069
+ unRegisterPlugin(plugin: any): void;
2070
+ /** {zh}
2071
+ * @brief 调用此接口显示指定插件图标。
2072
+ * @param pluginNames 插件名称
2073
+ */
2074
+ /** {en}
2075
+ * @brief Displays the icon of a specified plugin.
2076
+ * @param PluginNames The plugin name.
2077
+ */
2078
+ showIcon(pluginNames: string[]): void;
2079
+ /** {zh}
2080
+ * @brief 调用此接口隐藏指定插件图标。
2081
+ * @param pluginNames 插件名称
2082
+ */
2083
+ /** {en}
2084
+ * @brief Hides the icon of a specified plugin.
2085
+ * @param PluginNames The plugin name.
2086
+ */
2087
+ hideIcon(pluginNames: string[]): void;
2088
+ /** {zh}
2089
+ * @brief 调用此方法销毁播放器实例。
2090
+ */
2091
+ /** {en}
2092
+ * @brief Destroys the player instance.
2093
+ */
2094
+ destroy(): void;
2095
+ /** {zh}
2096
+ * @hidden
2097
+ */
2098
+ /** {en}
2099
+ * @hidden
2100
+ */
2101
+ prepare(url: string): Promise<{
2102
+ plugins: any[];
2103
+ options: Partial<VePlayerBaseOptions> | undefined;
2104
+ }>;
2105
+ private _handleFallback;
2106
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2107
+ private _transformEvent;
2108
+ private _switch;
2109
+ private _switchUrl;
2110
+ // 获取需要卸载和需要注册的播放插件
2111
+ private _diffPlugins;
2112
+ private _callBeforePlayerInitForUrl;
2113
+ }
2114
+ declare const enum State {
2115
+ Fetching = 0,
2116
+ Ready = 1,
2117
+ Error = 2
2118
+ }
2119
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2120
+ type Exports = Record<string, any>;
2121
+ interface Module {
2122
+ src: string;
2123
+ state: State;
2124
+ name: string;
2125
+ exports: Exports;
2126
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2127
+ error?: any;
2128
+ }
2129
+ type ModuleSystem = "esm" | "umd";
2130
+ interface LoaderOptions {
2131
+ baseUrl: string;
2132
+ }
2133
+ declare enum DynamicModule {
2134
+ BizVod = "biz:vod",
2135
+ BizLive = "biz:live",
2136
+ PluginFlv = "plugin:flv",
2137
+ PluginMp4 = "plugin:mp4",
2138
+ PluginHls = "plugin:hls",
2139
+ PluginShaka = "plugin:shaka",
2140
+ PluginRtm = "plugin:rtm",
2141
+ PluginXgvideo = "plugin:xgvideo",
2142
+ PluginDrm = "plugin:drm"
2143
+ }
2144
+ type ModulesMap = {
2145
+ [DynamicModule.BizVod]: Exports;
2146
+ [DynamicModule.BizLive]: Exports;
2147
+ [DynamicModule.PluginFlv]: Exports;
2148
+ [DynamicModule.PluginMp4]: Exports;
2149
+ [DynamicModule.PluginHls]: Exports;
2150
+ [DynamicModule.PluginShaka]: Exports;
2151
+ [DynamicModule.PluginRtm]: Exports;
2152
+ [DynamicModule.PluginXgvideo]: Exports;
2153
+ [DynamicModule.PluginDrm]: Exports;
2154
+ };
2155
+ declare const register: (exports: {
2156
+ [x: string]: any;
2157
+ }[]) => {
2158
+ [x: string]: any;
2159
+ }[];
2160
+ declare function load<T extends DynamicModule>(name: T, src?: string): Promise<ModulesMap[T]>;
2161
+ declare module MobilePlayerPanelWrapper {
2162
+ export { MobilePlayerPanel };
2163
+ }
2164
+ declare namespace strategy {
2165
+ const EN: {
2166
+ DEFINITION_FALLBACK_TOAST: string;
2167
+ DEFINITION_SWITCHING: string;
2168
+ ERROR_REFRESH: string;
2169
+ UNMUTE: string;
2170
+ MANIFEST: string;
2171
+ NETWORK: string;
2172
+ NETWORK_TIMEOUT: string;
2173
+ NETWORK_FORBIDDEN: string;
2174
+ NETWORK_NOTFOUND: string;
2175
+ DEMUX: string;
2176
+ REMUX: string;
2177
+ MEDIA: string;
2178
+ MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
2179
+ MEDIA_ERR_URL_EMPTY: string;
2180
+ DRM: string;
2181
+ DRM_LICENSE: string;
2182
+ OTHER: string;
2183
+ RUNTIME: string;
2184
+ MODULE_LOAD_ERROR: string;
2185
+ UNKNOWN: string;
2186
+ ERROR_TYPES: typeof XG_EN.TEXT.ERROR_TYPES;
2187
+ HAVE_NOTHING: string;
2188
+ HAVE_METADATA: string;
2189
+ HAVE_CURRENT_DATA: string;
2190
+ HAVE_FUTURE_DATA: string;
2191
+ HAVE_ENOUGH_DATA: string;
2192
+ NETWORK_EMPTY: string;
2193
+ NETWORK_IDLE: string;
2194
+ NETWORK_LOADING: string;
2195
+ NETWORK_NO_SOURCE: string;
2196
+ MEDIA_ERR_ABORTED: string;
2197
+ MEDIA_ERR_NETWORK: string;
2198
+ MEDIA_ERR_DECODE: string;
2199
+ MEDIA_ERR_SRC_NOT_SUPPORTED: string;
2200
+ REPLAY: string;
2201
+ ERROR: string;
2202
+ PLAY_TIPS: string;
2203
+ PAUSE_TIPS: string;
2204
+ PLAYNEXT_TIPS: string;
2205
+ DOWNLOAD_TIPS: string;
2206
+ ROTATE_TIPS: string;
2207
+ RELOAD_TIPS: string;
2208
+ FULLSCREEN_TIPS: string;
2209
+ EXITFULLSCREEN_TIPS: string;
2210
+ CSSFULLSCREEN_TIPS: string;
2211
+ EXITCSSFULLSCREEN_TIPS: string;
2212
+ TEXTTRACK: string;
2213
+ PIP: string;
2214
+ SCREENSHOT: string;
2215
+ LIVE: string;
2216
+ OFF: string;
2217
+ OPEN: string;
2218
+ MINI_DRAG: string;
2219
+ MINISCREEN: string;
2220
+ REFRESH_TIPS: string;
2221
+ REFRESH: string;
2222
+ FORWARD: string;
2223
+ LIVE_TIP: string;
2224
+ };
2225
+ const ZH_CN: {
2226
+ DEFINITION_FALLBACK_TOAST: string;
2227
+ DEFINITION_SWITCHING: string;
2228
+ ERROR_REFRESH: string;
2229
+ UNMUTE: string;
2230
+ MANIFEST: string;
2231
+ NETWORK: string;
2232
+ NETWORK_TIMEOUT: string;
2233
+ NETWORK_FORBIDDEN: string;
2234
+ NETWORK_NOTFOUND: string;
2235
+ DEMUX: string;
2236
+ REMUX: string;
2237
+ MEDIA: string;
2238
+ MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
2239
+ MEDIA_ERR_URL_EMPTY: string;
2240
+ DRM: string;
2241
+ DRM_LICENSE: string;
2242
+ OTHER: string;
2243
+ RUNTIME: string;
2244
+ MODULE_LOAD_ERROR: string;
2245
+ UNKNOWN: string;
2246
+ ERROR_TYPES: typeof XG_ZH_CN.TEXT.ERROR_TYPES;
2247
+ HAVE_NOTHING: string;
2248
+ HAVE_METADATA: string;
2249
+ HAVE_CURRENT_DATA: string;
2250
+ HAVE_FUTURE_DATA: string;
2251
+ HAVE_ENOUGH_DATA: string;
2252
+ NETWORK_EMPTY: string;
2253
+ NETWORK_IDLE: string;
2254
+ NETWORK_LOADING: string;
2255
+ NETWORK_NO_SOURCE: string;
2256
+ MEDIA_ERR_ABORTED: string;
2257
+ MEDIA_ERR_NETWORK: string;
2258
+ MEDIA_ERR_DECODE: string;
2259
+ MEDIA_ERR_SRC_NOT_SUPPORTED: string;
2260
+ REPLAY: string;
2261
+ ERROR: string;
2262
+ PLAY_TIPS: string;
2263
+ PAUSE_TIPS: string;
2264
+ PLAYNEXT_TIPS: string;
2265
+ DOWNLOAD_TIPS: string;
2266
+ ROTATE_TIPS: string;
2267
+ RELOAD_TIPS: string;
2268
+ FULLSCREEN_TIPS: string;
2269
+ EXITFULLSCREEN_TIPS: string;
2270
+ CSSFULLSCREEN_TIPS: string;
2271
+ EXITCSSFULLSCREEN_TIPS: string;
2272
+ TEXTTRACK: string;
2273
+ PIP: string;
2274
+ SCREENSHOT: string;
2275
+ LIVE: string;
2276
+ OFF: string;
2277
+ OPEN: string;
2278
+ MINI_DRAG: string;
2279
+ MINISCREEN: string;
2280
+ REFRESH_TIPS: string;
2281
+ REFRESH: string;
2282
+ FORWARD: string;
2283
+ LIVE_TIP: string;
2284
+ };
2285
+ type TextKey = keyof typeof EN;
2286
+ type Lang = "zh-cn" | "zh-hk" | "en" | "jp" | string;
2287
+ class VeI18n<T extends string = TextKey> {
2288
+ private _lang;
2289
+ constructor(config?: {
2290
+ lang?: Lang;
2291
+ i18n?: {
2292
+ texts?: Record<Lang, Record<string, string>>;
2293
+ };
2294
+ });
2295
+ static get langKeys(): string[];
2296
+ static isLangValid(lang: Lang): boolean;
2297
+ static extend(i18nTextList: Array<IXGI18nText>, i18nLangs?: IXGI18n): void;
2298
+ setLang(lang: string): void;
2299
+ getLang(): string;
2300
+ normalize(text?: string | Record<Lang, string>): string;
2301
+ getText(textKey?: T | string): Record<string | T, string>[string | T] | undefined;
2302
+ }
2303
+ interface DefinitionUrl {
2304
+ url: string;
2305
+ next: DefinitionUrl | null;
2306
+ }
2307
+ function arrayToList(urls?: string[]): DefinitionUrl;
2308
+ class Definition implements XGDefinition {
2309
+ readonly definition: string;
2310
+ readonly source: Source;
2311
+ readonly text?: Record<Lang, string> | string;
2312
+ readonly fallbackUrl: DefinitionUrl;
2313
+ readonly urls: string[];
2314
+ private _currentUrlRef;
2315
+ constructor(definitionSetting: {
2316
+ url: string;
2317
+ definition: string;
2318
+ source: Source;
2319
+ text?: Record<Lang, string> | string;
2320
+ fallbackUrls?: string[];
2321
+ });
2322
+ get url(): string;
2323
+ set url(url: string);
2324
+ next(): DefinitionUrl;
2325
+ }
2326
+ /** {zh}
2327
+ * @list option
2328
+ * @kind property
2329
+ * @id Definition
2330
+ * @name Definition
2331
+ *
2332
+ */
2333
+ /** {en}
2334
+ * @list option
2335
+ * @kind property
2336
+ * @id Definition
2337
+ * @alias Definition
2338
+ *
2339
+ */
2340
+ interface ExposedDefinition {
2341
+ /** {zh}
2342
+ * @brief 播放地址。
2343
+ * @default 无
2344
+ */
2345
+ /** {en}
2346
+ * @brief The playback address.
2347
+ */
2348
+ url: string;
2349
+ /** {zh}
2350
+ * @brief 清晰度标识(唯一值)。
2351
+ * @default 无
2352
+ *
2353
+ */
2354
+ /** {en}
2355
+ * @brief The resolution ID. This value must be unique.
2356
+ *
2357
+ */
2358
+ definition: string;
2359
+ /** {zh}
2360
+ * @brief 清晰度展示名称。可设置多语言 `{text: {'zh-cn': '高清', 'en': 'HD'}}`。
2361
+ * @default 无
2362
+ */
2363
+ /** {en}
2364
+ * @brief The display name of the resolution. Multiple languages are supported, such as `{text: {'zh-cn': '高清', 'en': 'HD'}}`.
2365
+ */
2366
+ text?: Record<Lang, string> | string;
2367
+ /** {zh}
2368
+ * @brief 为当前清晰度地址设置备路拉流地址,支持设置多个备路拉流地址。当前清晰度地址拉流失败时,会在当前清晰度地址和备路直播地址之间循环拉流,直到拉流成功。
2369
+ * @default 无
2370
+ *
2371
+ */
2372
+ /** {en}
2373
+ * @brief The backup pull stream address for the current resolution. You can set multiple backup addresses. When the player fails to pull a stream from the current address, it will loop between the current and the backup addresses until it successfully pulls a stream.
2374
+ *
2375
+ */
2376
+ fallbackUrls?: string[];
2377
+ }
2378
+ /** {zh}
2379
+ * @list option
2380
+ * @kind property
2381
+ * @id Source
2382
+ * @alias Source
2383
+ */
2384
+ /** {en}
2385
+ * @list option
2386
+ * @kind property
2387
+ * @id Source
2388
+ * @alias Source
2389
+ */
2390
+ interface ExposedSource {
2391
+ /** {zh}
2392
+ * @brief 线路标识(唯一值)。
2393
+ * @default 无
2394
+ */
2395
+ /** {en}
2396
+ * @brief The playback source ID. This value must be unique.
2397
+ */
2398
+ name?: string;
2399
+ /** {zh}
2400
+ * @brief 线路展示名称。可设置多语言 `{text: {'zh-cn': '线路一', 'en': 'LineOne'}}`。
2401
+ * @default 无
2402
+ *
2403
+ */
2404
+ /** {en}
2405
+ * @brief The display name of the live stream source. Multiple languages are supported. For example, you set it to `{text: {'zh-cn': '线路一', 'en': 'LineOne'}}`.
2406
+ *
2407
+ */
2408
+ text?: Record<Lang, string> | string;
2409
+ /** {zh}
2410
+ * @brief 该线路下清晰度列表。
2411
+ * @default 无
2412
+ *
2413
+ */
2414
+ /** {en}
2415
+ * @brief A list of resolutions of the current source.
2416
+ *
2417
+ */
2418
+ definitions: Array<ExposedDefinition | string>;
2419
+ }
2420
+ interface CompoundSources {
2421
+ sources?: ExposedSource[];
2422
+ url?: string;
2423
+ fallbackUrls?: string[];
2424
+ }
2425
+ class Source {
2426
+ readonly name?: string;
2427
+ readonly text?: Record<Lang, string> | string;
2428
+ readonly definitions: Array<Definition & {
2429
+ source: Source;
2430
+ }>;
2431
+ private constructor();
2432
+ get defaultDefinition(): Definition & {
2433
+ source: Source;
2434
+ };
2435
+ static normalize(input: CompoundSources | ExposedSource[] | string): Source[];
2436
+ private static normalizeUrl;
2437
+ add(definition: Definition): void;
2438
+ }
2439
+ interface Config {
2440
+ listType: ListType;
2441
+ isAutoChange?: boolean;
2442
+ onItemClick?: (e: Event, data: CallbackData) => void;
2443
+ onOptionClick?: (e: Event, data: CallbackData) => void;
2444
+ hide?: () => void;
2445
+ list?: ListItem[];
2446
+ panel?: {
2447
+ className?: string;
2448
+ title?: string | Record<Lang, string>;
2449
+ };
2450
+ }
2451
+ interface Options {
2452
+ config: Config;
2453
+ root: HTMLElement | null;
2454
+ player: Player$0;
2455
+ }
2456
+ class MobilePlayerPanel {
2457
+ private _root?;
2458
+ private _config;
2459
+ private _parent;
2460
+ private _listDom?;
2461
+ private _container?;
2462
+ private _titleDom?;
2463
+ private _player;
2464
+ private _delegates?;
2465
+ private _listType?;
2466
+ constructor(args: Options);
2467
+ changeMode(listType: ListType): void;
2468
+ // 渲染选择列表
2469
+ renderItemList(data?: ListItem[]): HTMLElement;
2470
+ // 渲染panel的标题
2471
+ renderTitle(): HTMLElement | undefined;
2472
+ updatePanel(listType: ListType): void;
2473
+ // 渲染panel
2474
+ renderPanel(): void;
2475
+ show(): void;
2476
+ hide(): void;
2477
+ destroy(): void;
2478
+ private _bind;
2479
+ private _unbind;
2480
+ private _initEvents;
2481
+ private _unbindEvents;
2482
+ private _handleOrientationChange;
2483
+ private _bindDomEvent;
2484
+ private _unbindDomEvent;
2485
+ private _stopPropagation;
2486
+ private _onItemClick;
2487
+ private _handleHide;
2488
+ }
2489
+ import MobilePanel = MobilePlayerPanelWrapper.MobilePlayerPanel;
2490
+ /** {zh}
2491
+ * @detail option
2492
+ * @brief **清晰度选择**或**线路选择**时的**选择面板样式**,仅在移动端有效。
2493
+ */
2494
+ /** {en}
2495
+ * @detail option
2496
+ * @brief The panel style for resolution and live stream source selection. This setting is effective on mobile devices only.
2497
+ */
2498
+ enum ListType {
2499
+ /** {zh}
2500
+ * @brief 全屏布局
2501
+ * @hidden
2502
+ */
2503
+ /** {en}
2504
+ * @brief Fullscreen layout.
2505
+ * @hidden
2506
+ */
2507
+ Middle = "middle",
2508
+ /** {zh}
2509
+ * @brief 底部抽屉
2510
+ */
2511
+ /** {en}
2512
+ * @brief Bottom navigation drawer.
2513
+ */
2514
+ Bottom = "bottom",
2515
+ /** {zh}
2516
+ * @brief 右侧抽屉,常用于全屏时展示
2517
+ */
2518
+ /** {en}
2519
+ * @brief Right navigation drawer. This is often used for fullscreen display.
2520
+ */
2521
+ Fullscreen = "fullscreen",
2522
+ /** {zh}
2523
+ * @brief 窗口蒙层展示
2524
+ */
2525
+ /** {en}
2526
+ * @brief Overlay.
2527
+ */
2528
+ Inner = "inner"
2529
+ }
2530
+ interface ListItem {
2531
+ [key: string]: any;
2532
+ selected?: boolean;
2533
+ className?: string;
2534
+ showText?: string | HTMLElement;
2535
+ text?: string | Record<Lang, string>;
2536
+ iconText?: string | Record<Lang, string>;
2537
+ }
2538
+ type CallbackData = {
2539
+ to?: ListItem;
2540
+ from?: ListItem;
2541
+ };
2542
+ const enum RenderType {
2543
+ Icon = "Icon",
2544
+ Text = "Text"
2545
+ }
2546
+ type Config$0<T> = {
2547
+ [key: string]: any;
2548
+ // 【xg】顺序
2549
+ index?: number;
2550
+ // 【xg】展示的选择列表
2551
+ list?: Array<T>;
2552
+ // 【xg】竖屏
2553
+ hidePortrait?: boolean;
2554
+ // 【xg】列表点击之后是否隐藏列表
2555
+ isItemClickHide?: boolean;
2556
+ className?: string;
2557
+ // 【xg】是否展示已选择的
2558
+ isShowIcon?: boolean;
2559
+ // 【xg 扩展】列表渲染样式类型
2560
+ listType?: ListType;
2561
+ // 已选择的展示类型(文案 or icon)
2562
+ renderType?: RenderType;
2563
+ // 列表数据只有一个是否展示
2564
+ hideOnSingleOption?: boolean;
2565
+ // 横屏的时候是否切换mode
2566
+ isAutoChange?: boolean;
2567
+ // 自定义组件 mobilePanel的配置
2568
+ panel?: {
2569
+ className?: string;
2570
+ // panel 的标题
2571
+ title?: string | Record<Lang, string>;
2572
+ };
2573
+ };
2574
+ // 源自packages/xgplayer/src/plugins/common/optionsIcon.js
2575
+ // 自定义了几种选择类型
2576
+ class OptionsIcon extends Plugin {
2577
+ icons: Record<string, any>;
2578
+ config: Config$0<ListItem>;
2579
+ optionsList?: MobilePanel | OptionList;
2580
+ private _isIcon?;
2581
+ private _isActive?;
2582
+ private _curIndex;
2583
+ private activeEvent?;
2584
+ constructor(args: IPluginOptions);
2585
+ static get pluginName(): string;
2586
+ static get defaultConfig(): Config$0<ListItem>;
2587
+ updateLang(): void;
2588
+ afterCreate(): void;
2589
+ initIcons(): void;
2590
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2591
+ // @ts-ignore
2592
+ show(): void;
2593
+ hide(): void;
2594
+ onEnter: (e: Event) => void;
2595
+ onLeave: (e: Event) => void;
2596
+ // 状态切换
2597
+ toggle(isActive: boolean): void;
2598
+ // 列表选择回调
2599
+ onItemClick(e: Event, data: CallbackData): void;
2600
+ // 列表点击回调
2601
+ onOptionClick(e: Event, _data: CallbackData): void;
2602
+ // 已选择 option 的文案
2603
+ changeCurrentText(): void;
2604
+ renderItemList(itemList: ListItem[], curIndex?: number): void;
2605
+ destroy(): void;
2606
+ render(): string;
2607
+ private _getListType;
2608
+ }
2609
+ /** {zh}
2610
+ * @detail error
2611
+ */
2612
+ /** {en}
2613
+ * @detail error
2614
+ */
2615
+ enum Level {
2616
+ /** {zh}
2617
+ * @brief 严重
2618
+ *
2619
+ */
2620
+ /** {en}
2621
+ * @brief Fatal.
2622
+ *
2623
+ */
2624
+ Fatal = "Fatal",
2625
+ /** {zh}
2626
+ * @brief 报错
2627
+ */
2628
+ /** {en}
2629
+ * @brief Error.
2630
+ */
2631
+ Error = "Error"
2632
+ }
2633
+ enum ErrorCode {
2634
+ /** {zh}
2635
+ * @brief 视频解析错误
2636
+ * @solution 请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2637
+ */
2638
+ /** {en}
2639
+ * @brief Video parsing error.
2640
+ * @solution Please contact your [technical support](https://www.byteplus.com/en/support).
2641
+ */
2642
+ MANIFEST_HLS_ERROR = 1100,
2643
+ /** {zh}
2644
+ * @brief 视频解析错误
2645
+ * @solution 请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2646
+ */
2647
+ /** {en}
2648
+ * @brief Video parsing error.
2649
+ * @solution Please contact your [technical support](https://www.byteplus.com/en/support).
2650
+ */
2651
+ MANIFEST_DASH_ERROR = 1200,
2652
+ /** {zh}
2653
+ * @brief 网络错误
2654
+ * @solution 请检查当前网络环境或播放地址是否合法。
2655
+ */
2656
+ /** {en}
2657
+ * @brief Network error.
2658
+ * @solution Please check the current network environment and ensure the pull stream address is valid.
2659
+ */
2660
+ NETWORK = 2100,
2661
+ /** {zh}
2662
+ * @brief 网络请求超时
2663
+ * @solution 请检查拉流地址是否合法。
2664
+ */
2665
+ /** {en}
2666
+ * @brief Network request timed out
2667
+ * @solution Please check whether the pull stream address is valid.
2668
+ */
2669
+ NETWORK_TIMEOUT = 2101,
2670
+ /** {zh}
2671
+ * @brief 网络请求 403
2672
+ * @solution 请检查拉流地址鉴权信息。
2673
+ */
2674
+ /** {en}
2675
+ * @brief The player received a 403 response code.
2676
+ * @solution Check the authentication information in the pull stream address.
2677
+ */
2678
+ NETWORK_FORBIDDEN = 2103,
2679
+ /** {zh}
2680
+ * @brief 网络请求 404
2681
+ * @solution 请检查拉流地址是否合法。
2682
+ */
2683
+ /** {en}
2684
+ * @brief The player received a 404 response code.
2685
+ * @solution Check whether the pull stream address is valid.
2686
+ */
2687
+ NETWORK_NOTFOUND = 2104,
2688
+ /** {zh}
2689
+ * @brief 网络请求 206
2690
+ * @solution 请检查拉流地址是否合法。
2691
+ */
2692
+ /** {en}
2693
+ * @brief The player received a 206 response code.
2694
+ * @solution Check whether the pull stream address is valid.
2695
+ */
2696
+ NETWORK_RANGE_NOT_SATISFIABLE = 2116,
2697
+ /** {zh}
2698
+ * @brief 视频解析错误
2699
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2700
+ */
2701
+ /** {en}
2702
+ * @brief Video parsing error.
2703
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
2704
+ */
2705
+ DEMUX_FLV_ERROR = 3100,
2706
+ /** {zh}
2707
+ * @brief 视频解析错误
2708
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2709
+ */
2710
+ /** {en}
2711
+ * @brief Video parsing error.
2712
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
2713
+ */
2714
+ DEMUX_HLS_ERROR = 3200,
2715
+ /** {zh}
2716
+ * @brief 视频解析错误
2717
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2718
+ *
2719
+ */
2720
+ /** {en}
2721
+ * @brief Video parsing error.
2722
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
2723
+ *
2724
+ */
2725
+ DEMUX_MP4_ERROR = 3300,
2726
+ /** {zh}
2727
+ * @brief 视频解析错误
2728
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2729
+ *
2730
+ */
2731
+ /** {en}
2732
+ * @brief Video parsing error.
2733
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
2734
+ *
2735
+ */
2736
+ DEMUX_FMP4_ERROR = 3400,
2737
+ /** {zh}
2738
+ * @brief 视频解析错误
2739
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2740
+ *
2741
+ */
2742
+ /** {en}
2743
+ * @brief Video parsing error.
2744
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
2745
+ *
2746
+ */
2747
+ DEMUX_SIDX_ERROR = 3410,
2748
+ /** {zh}
2749
+ * @brief 视频解析错误
2750
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2751
+ *
2752
+ */
2753
+ /** {en}
2754
+ * @brief Video parsing error.
2755
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
2756
+ *
2757
+ */
2758
+ REMUX_FMP4_ERROR = 4100,
2759
+ /** {zh}
2760
+ * @brief 视频解析错误
2761
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2762
+ *
2763
+ */
2764
+ /** {en}
2765
+ * @brief Video parsing error.
2766
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
2767
+ *
2768
+ */
2769
+ REMUX_MP4_ERROR = 4200,
2770
+ /** {zh}
2771
+ * @brief 获取数据过程被中止
2772
+ * @solution 请检查浏览器网络请求是否正常,再尝试重新拉流。
2773
+ */
2774
+ /** {en}
2775
+ * @brief The process of obtaining data was aborted.
2776
+ * @solution Check whether the request is correct and then try to pull the stream again.
2777
+ */
2778
+ MEDIA_ERR_ABORTED = 5101,
2779
+ /** {zh}
2780
+ * @brief 网络发生错误,无法成功获取媒体文件
2781
+ * @solution 请检查浏览器网络请求是否正常,再尝试重新拉流。
2782
+ */
2783
+ /** {en}
2784
+ * @brief A network error occurred and the media file could not be successfully obtained.
2785
+ * @solution Check whether the request is correct and then try to pull the stream again.
2786
+ */
2787
+ MEDIA_ERR_NETWORK = 5102,
2788
+ /** {zh}
2789
+ * @brief 浏览器在解码媒体资源时发生错误
2790
+ * @solution
2791
+ * 1. 请检查原始视频是否正常;
2792
+ * 2. 重新进行转码和播放;
2793
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2794
+ */
2795
+ /** {en}
2796
+ * @brief An error occurred to the browser while decoding the media resources.
2797
+ * @solution
2798
+ * 1. Check whether there is any issue with the original video.
2799
+ * 2. Re-transcode the video and play it again.
2800
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
2801
+ */
2802
+ MEDIA_ERR_DECODE = 5103,
2803
+ /** {zh}
2804
+ * @brief 因视频格式不支持、服务器或网络的问题造成视频无法加载
2805
+ * @solution
2806
+ * 1. 检查浏览器视频数据请求是否正常;
2807
+ * 2. 检查浏览器和页面环境是否支持要播放的视频格式;
2808
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2809
+ */
2810
+ /** {en}
2811
+ * @brief The video cannot be loaded due to unsupported video format or server or network issues.
2812
+ * @solution
2813
+ * 1. Check whether there is any issue with the browser's request.
2814
+ * 2. Check whether the browser and the current page support the video format.
2815
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
2816
+ */
2817
+ MEDIA_ERR_SRC_NOT_SUPPORTED = 5104,
2818
+ /** {zh}
2819
+ * @brief 当前浏览器不支持视频解码
2820
+ * @solution
2821
+ * 1. 检查浏览器视频数据请求是否正常;
2822
+ * 2. 检查浏览器和页面环境是否支持要播放的视频格式;
2823
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2824
+ */
2825
+ /** {en}
2826
+ * @brief The current browser does not support video decoding.
2827
+ * @solution
2828
+ * 1. Check whether there is any issue with the browser's request.
2829
+ * 2. Check whether the browser and the current page support the video format.
2830
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
2831
+ */
2832
+ MEDIA_ERR_CODEC_NOT_SUPPORTED = 5105,
2833
+ /** {zh}
2834
+ * @brief 当前播放地址为空
2835
+ * @solution 请检查必要参数 `url` 或 `playlist` 是否传入。
2836
+ */
2837
+ /** {en}
2838
+ * @brief The current pull stream address is empty.
2839
+ * @solution Check whether 'url' or 'playlist' is specified.
2840
+ */
2841
+ MEDIA_ERR_URL_EMPTY = 5106,
2842
+ /** {zh}
2843
+ * @brief 播放异常
2844
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2845
+ */
2846
+ /** {en}
2847
+ * @brief A playback issue occurred.
2848
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2849
+ */
2850
+ MEDIA_MSE_ADD_SB = 5200,
2851
+ /** {zh}
2852
+ * @brief 播放异常
2853
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2854
+ */
2855
+ /** {en}
2856
+ * @brief A playback issue occurred.
2857
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2858
+ */
2859
+ MEDIA_MSE_APPEND_BUFFER = 5201,
2860
+ /** {zh}
2861
+ * @brief 播放异常
2862
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2863
+ */
2864
+ /** {en}
2865
+ * @brief A playback issue occurred.
2866
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2867
+ */
2868
+ MEDIA_MSE_OTHER = 5202,
2869
+ /** {zh}
2870
+ * @brief 播放异常
2871
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2872
+ */
2873
+ /** {en}
2874
+ * @brief A playback issue occurred.
2875
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2876
+ */
2877
+ MEDIA_MSE_FULL = 5203,
2878
+ /** {zh}
2879
+ * @brief 播放异常
2880
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2881
+ */
2882
+ /** {en}
2883
+ * @brief A playback issue occurred.
2884
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2885
+ */
2886
+ MEDIA_MSE_HIJACK = 5204,
2887
+ /** {zh}
2888
+ * @brief 播放异常
2889
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2890
+ */
2891
+ /** {en}
2892
+ * @brief A playback issue occurred.
2893
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2894
+ */
2895
+ MEDIA_EME_HIJACK = 5301,
2896
+ /** {zh}
2897
+ * @brief DRM 权限校验失败
2898
+ * @hidden
2899
+ */
2900
+ /** {en}
2901
+ * @brief DRM authentication failed.
2902
+ * @hidden
2903
+ */
2904
+ DRM_LICENSE = 7100,
2905
+ /** {zh}
2906
+ * @brief DRM 权限校验失败
2907
+ * @hidden
2908
+ */
2909
+ /** {en}
2910
+ * @brief DRM authentication failed.
2911
+ * @hidden
2912
+ */
2913
+ DRM_CUSTOM_LICENSE = 7200,
2914
+ /** {zh}
2915
+ * @brief 播放异常
2916
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2917
+ */
2918
+ /** {en}
2919
+ * @brief A playback issue occurred.
2920
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2921
+ */
2922
+ OTHER = 8000,
2923
+ /** {zh}
2924
+ * @brief 播放异常
2925
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2926
+ */
2927
+ /** {en}
2928
+ * @brief A playback issue occurred.
2929
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2930
+ */
2931
+ RUNTIME_NO_CANPLAY_ERROR = 9001,
2932
+ /** {zh}
2933
+ * @brief 播放异常
2934
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2935
+ */
2936
+ /** {en}
2937
+ * @brief A playback issue occurred.
2938
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2939
+ */
2940
+ RUNTIME_BUFFERBREAK_ERROR = 9002,
2941
+ /** {zh}
2942
+ * @brief 播放异常
2943
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
2944
+ */
2945
+ /** {en}
2946
+ * @brief A playback issue occurred.
2947
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
2948
+ */
2949
+ RUNTIME_BWAITING_TIMEOUT_ERROR = 9002,
2950
+ // veplayer 报错
2951
+ /** {zh}
2952
+ * @brief CDN 异步获取失败
2953
+ * @solution 请刷新重试或者检查网络环境。
2954
+ *
2955
+ */
2956
+ /** {en}
2957
+ * @brief CDN asynchronous fetch failed.
2958
+ * @solution Refresh the page or check the network environment.
2959
+ *
2960
+ */
2961
+ MODULE_LOAD_ERROR = 110,
2962
+ /** {zh}
2963
+ * @hidden
2964
+ */
2965
+ /** {en}
2966
+ * @hidden
2967
+ */
2968
+ UNKNOWN = "UNKNOWN"
2969
+ }
2970
+ enum ErrorType {
2971
+ MANIFEST = "manifest",
2972
+ NETWORK = "network",
2973
+ DEMUX = "demux",
2974
+ REMUX = "remux",
2975
+ MEDIA = "media",
2976
+ DRM = "drm",
2977
+ OTHER = "other",
2978
+ RUNTIME = "runtime"
2979
+ }
2980
+ interface ErrorInfo<T = TextKey> {
2981
+ errorCode?: ErrorCode;
2982
+ message?: string;
2983
+ messageTextKey?: T;
2984
+ level?: Level;
2985
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2986
+ ext?: any;
2987
+ error?: Error;
2988
+ }
2989
+ const ERROR_INFO: Partial<Record<ErrorCode, ErrorInfo>>;
2990
+ const ERROR_TYPE_INFO: Record<ErrorType, ErrorInfo>;
2991
+ /** {zh}
2992
+ * @list error
2993
+ * @detail error
2994
+ * @brief 错误对象
2995
+ * @name VeError
2996
+ * @id VeError
2997
+ */
2998
+ /** {en}
2999
+ * @list error
3000
+ * @detail error
3001
+ * @brief The error object.
3002
+ * @name VeError
3003
+ * @id VeError
3004
+ */
3005
+ class VeError<T extends string = TextKey> extends Error {
3006
+ /**
3007
+ * @brief 错误码。
3008
+ */
3009
+ /** {en}
3010
+ * @brief The error code.
3011
+ */
3012
+ readonly errorCode: ErrorCode;
3013
+ /** {zh}
3014
+ * @brief 错误等级。
3015
+ */
3016
+ /** {en}
3017
+ * @brief The error level.
3018
+ */
3019
+ readonly level?: Level;
3020
+ /** {zh}
3021
+ * @brief 错误信息。
3022
+ */
3023
+ /** {en}
3024
+ * @brief The error message.
3025
+ */
3026
+ message: string;
3027
+ /** {zh}
3028
+ * @brief 其他错误信息。
3029
+ */
3030
+ /** {en}
3031
+ * @brief Other error messages.
3032
+ */
3033
+ readonly ext?: any;
3034
+ /** {zh}
3035
+ * @hidden
3036
+ * @param error
3037
+ * @param i18n
3038
+ */
3039
+ /** {en}
3040
+ * @hidden
3041
+ * @param error
3042
+ * @param i18n
3043
+ */
3044
+ constructor(error?: string | ErrorInfo<T>, i18n?: VeI18n<T>);
3045
+ }
3046
+ function create(errorCode: ErrorCode, info?: ErrorInfo, i18n?: VeI18n): VeError<"DEFINITION_FALLBACK_TOAST" | "DEFINITION_SWITCHING" | "ERROR_REFRESH" | "UNMUTE" | "MANIFEST" | "NETWORK" | "NETWORK_TIMEOUT" | "NETWORK_FORBIDDEN" | "NETWORK_NOTFOUND" | "DEMUX" | "REMUX" | "MEDIA" | "MEDIA_ERR_CODEC_NOT_SUPPORTED" | "MEDIA_ERR_URL_EMPTY" | "DRM" | "DRM_LICENSE" | "OTHER" | "RUNTIME" | "MODULE_LOAD_ERROR" | "UNKNOWN" | "ERROR_TYPES" | "HAVE_NOTHING" | "HAVE_METADATA" | "HAVE_CURRENT_DATA" | "HAVE_FUTURE_DATA" | "HAVE_ENOUGH_DATA" | "NETWORK_EMPTY" | "NETWORK_IDLE" | "NETWORK_LOADING" | "NETWORK_NO_SOURCE" | "MEDIA_ERR_ABORTED" | "MEDIA_ERR_NETWORK" | "MEDIA_ERR_DECODE" | "MEDIA_ERR_SRC_NOT_SUPPORTED" | "REPLAY" | "ERROR" | "PLAY_TIPS" | "PAUSE_TIPS" | "PLAYNEXT_TIPS" | "DOWNLOAD_TIPS" | "ROTATE_TIPS" | "RELOAD_TIPS" | "FULLSCREEN_TIPS" | "EXITFULLSCREEN_TIPS" | "CSSFULLSCREEN_TIPS" | "EXITCSSFULLSCREEN_TIPS" | "TEXTTRACK" | "PIP" | "SCREENSHOT" | "LIVE" | "OFF" | "OPEN" | "MINI_DRAG" | "MINISCREEN" | "REFRESH_TIPS" | "REFRESH" | "FORWARD" | "LIVE_TIP">;
3047
+ function transform(xgErr: XGError, i18n?: VeI18n): VeError<"DEFINITION_FALLBACK_TOAST" | "DEFINITION_SWITCHING" | "ERROR_REFRESH" | "UNMUTE" | "MANIFEST" | "NETWORK" | "NETWORK_TIMEOUT" | "NETWORK_FORBIDDEN" | "NETWORK_NOTFOUND" | "DEMUX" | "REMUX" | "MEDIA" | "MEDIA_ERR_CODEC_NOT_SUPPORTED" | "MEDIA_ERR_URL_EMPTY" | "DRM" | "DRM_LICENSE" | "OTHER" | "RUNTIME" | "MODULE_LOAD_ERROR" | "UNKNOWN" | "ERROR_TYPES" | "HAVE_NOTHING" | "HAVE_METADATA" | "HAVE_CURRENT_DATA" | "HAVE_FUTURE_DATA" | "HAVE_ENOUGH_DATA" | "NETWORK_EMPTY" | "NETWORK_IDLE" | "NETWORK_LOADING" | "NETWORK_NO_SOURCE" | "MEDIA_ERR_ABORTED" | "MEDIA_ERR_NETWORK" | "MEDIA_ERR_DECODE" | "MEDIA_ERR_SRC_NOT_SUPPORTED" | "REPLAY" | "ERROR" | "PLAY_TIPS" | "PAUSE_TIPS" | "PLAYNEXT_TIPS" | "DOWNLOAD_TIPS" | "ROTATE_TIPS" | "RELOAD_TIPS" | "FULLSCREEN_TIPS" | "EXITFULLSCREEN_TIPS" | "CSSFULLSCREEN_TIPS" | "EXITCSSFULLSCREEN_TIPS" | "TEXTTRACK" | "PIP" | "SCREENSHOT" | "LIVE" | "OFF" | "OPEN" | "MINI_DRAG" | "MINISCREEN" | "REFRESH_TIPS" | "REFRESH" | "FORWARD" | "LIVE_TIP">;
3048
+ /** {zh}
3049
+ * @list option
3050
+ * @kind property
3051
+ */
3052
+ /** {en}
3053
+ * @list option
3054
+ * @kind property
3055
+ */
3056
+ type ErrorConfig = {
3057
+ /** {zh}
3058
+ * @brief 是否展示报错图片。
3059
+ * @default true
3060
+ */
3061
+ /** {en}
3062
+ * @brief Whether to display the error image.
3063
+ * @default true
3064
+ */
3065
+ showErrorImg?: boolean;
3066
+ /** {zh}
3067
+ * @brief 是否展示报错提示。
3068
+ * @default true
3069
+ */
3070
+ /** {en}
3071
+ * @brief Whether to display the error message.
3072
+ * @default true
3073
+ */
3074
+ showErrorTip?: boolean;
3075
+ /** {zh}
3076
+ * @brief 是否展示刷新按钮。
3077
+ * @default true
3078
+ */
3079
+ /** {en}
3080
+ * @brief Whether to display the refresh button.
3081
+ * @default true
3082
+ */
3083
+ showRefresh?: boolean;
3084
+ /** {zh}
3085
+ * @brief 自定义报错显示。
3086
+ * @default 无
3087
+ */
3088
+ /** {en}
3089
+ * @brief Custom error message.
3090
+ * @default None
3091
+ */
3092
+ errorTipsText?: string | Record<Lang, string>;
3093
+ /** {zh}
3094
+ * @brief 更多提示信息。
3095
+ * @default 无
3096
+ */
3097
+ /** {en}
3098
+ * @brief More tips.
3099
+ * @default None
3100
+ */
3101
+ extraTips?: {
3102
+ label: string | Record<Lang, string>;
3103
+ value: string | Record<Lang, string>;
3104
+ }[];
3105
+ };
3106
+ class Error extends Plugin {
3107
+ player: Player$0;
3108
+ icons: {
3109
+ error: HTMLElement;
3110
+ };
3111
+ langText: {
3112
+ refresh: string;
3113
+ errorTip: string;
3114
+ };
3115
+ config: ErrorConfig;
3116
+ private _error?;
3117
+ static get pluginName(): string;
3118
+ static get defaultConfig(): {
3119
+ showErrorImg: boolean;
3120
+ showErrorTip: boolean;
3121
+ showRefresh: boolean;
3122
+ errorTipsText: string;
3123
+ extraTips: never[];
3124
+ position: string;
3125
+ };
3126
+ get _errorTip(): string;
3127
+ afterCreate(): void;
3128
+ registerIcons(): {
3129
+ error: {
3130
+ icon: any;
3131
+ class: string;
3132
+ };
3133
+ };
3134
+ updateLang(): void;
3135
+ showError(error: VeError | XGError): void;
3136
+ hideError(): void;
3137
+ destroy(): void;
3138
+ render(): string;
3139
+ private _focus;
3140
+ private _initIcons;
3141
+ private _initEvents;
3142
+ private _renderText;
3143
+ private _renderExtraTips;
3144
+ private _handleRefresh;
3145
+ private _renderRefresh;
3146
+ }
3147
+ /** {zh}
3148
+ * @list option
3149
+ * @kind property
3150
+ */
3151
+ /** {en}
3152
+ * @list option
3153
+ * @kind property
3154
+ */
3155
+ interface DefinitionConfig {
3156
+ /** {zh}
3157
+ * @brief 等待超时的时间阈值,单位为 ms。等待超过该值,会抛出 `DEFINITION_FALLBACK` 事件,如果 `needFallback` 为 `true` 则会提示清晰度降级。
3158
+ * @default 5000
3159
+ */
3160
+ /** {en}
3161
+ * @brief The maximum wait time before a fallback, in milliseconds. If the wait time exceeds this value, a `DEFINITION_FALLBACK` event will occur, and if `needFallback` is set to `true`, the player will fall back to a lower resolution.
3162
+ * @default 5000
3163
+ */
3164
+ longWaitingTime?: number;
3165
+ /** {zh}
3166
+ * @brief 是否开启清晰度降级。
3167
+ * @default false
3168
+ */
3169
+ /** {en}
3170
+ * @brief Whether to enable resolution fallback.
3171
+ * @default false
3172
+ */
3173
+ needFallback?: boolean;
3174
+ /** {zh}
3175
+ * @brief 降级顺序,按照数组顺序依次降级,数组中的元素与 playlist 中的 definition 相对应。
3176
+ * @default ['uhd', 'hd', 'sd', 'ld', 'ao']
3177
+ */
3178
+ /** {en}
3179
+ * @brief The order of fallback. The player will fall back to each resolution according to the order of the array element. The values of the array elements should correspond to the value of the `definition` in the playlist.
3180
+ * @default "['uhd', 'hd ',' sd ',' ld ',' ao ']"
3181
+ */
3182
+ demotePriority?: string[];
3183
+ }
3184
+ class DefinitionPlugin extends OptionsIcon {
3185
+ langText: Record<string, string>;
3186
+ private _waitingStartTime;
3187
+ private _timer?;
3188
+ private _toastId?;
3189
+ static get pluginName(): string;
3190
+ static get defaultConfig(): {
3191
+ index: number;
3192
+ list: never[];
3193
+ panel: {
3194
+ title: {
3195
+ jp: string;
3196
+ en: string;
3197
+ "zh-cn": string;
3198
+ "zh-hk": string;
3199
+ };
3200
+ };
3201
+ className: string;
3202
+ hidePortrait: boolean;
3203
+ isShowIcon: boolean;
3204
+ longWaitingTime: number;
3205
+ needFallback: boolean;
3206
+ demotePriority: string[];
3207
+ isItemClickHide?: boolean | undefined;
3208
+ listType?: ListType | undefined;
3209
+ renderType?: RenderType | undefined;
3210
+ hideOnSingleOption?: boolean | undefined;
3211
+ isAutoChange?: boolean | undefined;
3212
+ };
3213
+ static get textTips(): {
3214
+ jp: string;
3215
+ en: string;
3216
+ "zh-cn": string;
3217
+ "zh-hk": string;
3218
+ };
3219
+ updateLang(): void;
3220
+ beforeCreate(args: XGPluginOptions): void;
3221
+ afterCreate(): void;
3222
+ registerIcons(): {
3223
+ source: {
3224
+ icon: any;
3225
+ };
3226
+ };
3227
+ renderItemList(): void;
3228
+ onItemClick(_: never, data: {
3229
+ to: Definition & {
3230
+ showText: string;
3231
+ };
3232
+ }): void;
3233
+ fallback(options?: {
3234
+ toast: boolean;
3235
+ }): Promise<void>;
3236
+ private _waiting;
3237
+ private _clearTimer;
3238
+ private _toast;
3239
+ private _getNextDefinition;
3240
+ private _initTimeUpdateEvent;
3241
+ private _showToast;
3242
+ }
3243
+ interface VePlayerBaseOptions extends Omit<PlayerOptions, "autoplay" | "i18n"> {
3244
+ /** {zh}
3245
+ * @brief 指定播放器容器 ID,VePlayer 将被插入在该容器中。id 和 el 需至少传入 1 个。如果同时传入,则优先将播放器插入 id 容器中。
3246
+ * @default 'veplayer'
3247
+ */
3248
+ /** {en}
3249
+ * @brief The container ID of the player. You should specify either `id` or `el`, or both. If both are specified, the `VePlayer` object will be inserted in the container specified by `id`.
3250
+ * @default 'veplayer'
3251
+ */
3252
+ id?: string;
3253
+ /** {zh}
3254
+ * @brief 指定播放器容器元素,VePlayer 将被插入在该容器中。id 和 el 需至少传入 1 个。如果同时传入,则优先将播放器插入 id 容器中。
3255
+ * @default 无
3256
+ */
3257
+ /** {en}
3258
+ * @brief The container element of the player. You should specify either `id` or `el`, or both. If both are specified, the `VePlayer` object will be inserted in the container specified by `id`.
3259
+ */
3260
+ el?: HTMLElement;
3261
+ /** {zh}
3262
+ * @brief 设置播放器宽度,传入 number 类型参数则播放器内部默认添加单位px,传入 string 类型参数则直接赋值给播放器容器 width 样式属性。
3263
+ * @default '100%'
3264
+ */
3265
+ /** {en}
3266
+ * @brief The width of the player. If you set it to a number, the player will attach the unit "pixel" to it. If you set it to a string, the parameter value will be directly assigned to the `width` property of the player container.
3267
+ * @default '100%'
3268
+ */
3269
+ width?: number | string;
3270
+ /** {zh}
3271
+ * @brief 设置播放器高度,传入 number 类型参数则播放器内部默认添加单位px,传入 string 类型参数则直接赋值给播放器容器 height 样式属性。
3272
+ * @default '100%'
3273
+ */
3274
+ /** {en}
3275
+ * @brief The height of the player. If you set it to a number, the player will attach the unit "pixel" to it. If you set it to a string, the parameter value will be directly assigned to the `height` property of the player container.
3276
+ * @default '100%'
3277
+ */
3278
+ height?: number | string;
3279
+ /** {zh}
3280
+ * @brief 为播放器配置直播拉流地址。您可手动拼接或使用地址生成器生成拉流地址,生成方法请参见[生成直播地址](https://www.volcengine.com/docs/6469/107759)。url 和 playList 需至少传入 1 个。
3281
+ * @default 无
3282
+ */
3283
+ /** {en}
3284
+ * @brief The pull stream address. You can manually construct the address or use the address generator to generate one. To see how to generate an address, refer to [Generate live-stream addresses](https://docs.byteplus.com/en/byteplus-media-live/docs/generating-live-stream-addresses). You should specify either `url` or `playList`, or both.
3285
+ */
3286
+ url?: string;
3287
+ /** {zh}
3288
+ * @brief 为播放器配置直播拉流地址列表。url 和 playlist 需至少传入 1 个。
3289
+ * @default 无
3290
+ */
3291
+ /** {en}
3292
+ * @brief A list of live stream sources for the player. You should specify either `url` or `playList`, or both.
3293
+ */
3294
+ playlist?: ExposedSource[];
3295
+ /** {zh}
3296
+ * @brief 当存在多个直播线路时,为播放器设置默认直播线路,不传则默认列表第一个。
3297
+ * @default 无
3298
+ */
3299
+ /** {en}
3300
+ * @brief The default pull stream address for the player when there are multiple addresses available. If this parameter is not specified, the first address in the playlist will become the default address.
3301
+ */
3302
+ defaultSource?: string;
3303
+ /** {zh}
3304
+ * @brief 为播放器设置默认直播清晰度,不传则默认列表第一个。
3305
+ * @default 无
3306
+ */
3307
+ /** {en}
3308
+ * @brief The default resolution for the player when there are multiple resolutions available. If this parameter is not specified, the first resolution in the list will become the default resolution.
3309
+ */
3310
+ defaultDefinition?: string;
3311
+ /** {zh}
3312
+ * @brief 为播放器设置备路拉流地址,支持设置多个备路拉流地址,在 `maxFallbackRound` 大于 `0` 时有效。当您使用配置的直播拉流地址拉流失败时,会在直播地址和备路直播地址之间循环拉流,直到拉流成功。
3313
+ * @default 无
3314
+ */
3315
+ /** {en}
3316
+ * @brief The backup pull stream address(es) for the player. You can enter multiple backup addresses. If `maxFallbackRound` is greater than `0`, when an error occurs in the main address, the player automatically switches to the backup address.
3317
+ */
3318
+ fallbackUrls?: string[];
3319
+ /** {zh}
3320
+ * @brief 为播放器设置拉流失败时循环拉流的最大次数。
3321
+ * @default 0
3322
+ */
3323
+ /** {en}
3324
+ * @brief The maximum number of retries the player can make if it fails to pull the stream with the default address.
3325
+ * @default 0
3326
+ */
3327
+ maxFallbackRound?: number;
3328
+ /** {zh}
3329
+ * @brief 为播放器设置解码方式。
3330
+ * @listtip
3331
+ * 开启软解后,播放器会使用浏览器的软件解码器来解码视频流。软解模式具有较高的兼容性,适用于各种设备和浏览器,但依赖设备 CPU,在高分辨率或高码率视频播放时会出现卡顿或延迟。建议在以下场景开启软解:
3332
+ * 1. 部分安卓浏览器中播放器被劫持,部分功能将不可见,可开启软解;
3333
+ * 2. 移动端浏览器不支持 flv 格式,如果需要播放该格式的视频,可开启软解;
3334
+ * 3. 部分浏览器不支持 H.265 编码格式,如果需要播放该编码格式的视频,请开启软解。
3335
+ * @default 'hardware'
3336
+ */
3337
+ /** {en}
3338
+ * @brief The decoding method for the player.
3339
+ * @listtip
3340
+ * When software decoding is enabled, the player uses the software decoder of the browser to decode the stream. Software decoding offers high compatibility and is suitable for various devices and browsers, but it relies on the device's CPU capacity and may have freezes or latencies when playing high-resolution or high-bitrate videos. We recommend enabling software decoding in the following scenarios:
3341
+ * 1. In certain Android browsers, the player can sometimes be hijacked, causing certain features to be unavailable. Enabling software decoding can address this issue.
3342
+ * 2. Browsers on mobile devices do not support the FLV format. To play videos in this format, you can enable software decoding.
3343
+ * 3. Some browsers do not support the H.265 codec. To play videos encoded with H.265, you can enable software decoding.
3344
+ * @default 'hardware'
3345
+ */
3346
+ decodeType?: DecodeType;
3347
+ /** {zh}
3348
+ * @brief 为播放器设置视频的实际编码格式。如果您在degradation 设置了 `soft-first` 属性(即硬解不支持时降级软解),建议您传入该参数,省去探测实际编码格式的操作。
3349
+ * @default 'h264'
3350
+ */
3351
+ /** {en}
3352
+ * @brief The actual codec of the live stream. If you specify `degradation` to `soft-first`, that is, the player should fall back to software decoding when hardware decoding is not supported, we recommend specifying the parameter so that the player does not need to detect the codec information.
3353
+ * @default 'h264'
3354
+ */
3355
+ codec?: Codec;
3356
+ /** {zh}
3357
+ * @brief 为播放器设置是否开启 H.265 兼容模式。在 H.265 兼容模式下,播放器会优先使用硬解来解码 H.265 直播流。如果设备或浏览器不支持 H.265 硬解,则自动降级为 H.265 软解。
3358
+ * @default 'soft-first'
3359
+ */
3360
+ /** {en}
3361
+ * @brief Whether to enable H.265 compatibility mode for the player. In the H.265 compatibility mode, the player will prioritize hardware decoding for decoding H.265 streams. If the device or browser does not support hardware decoding for H.265, it will automatically fall back to software decoding.
3362
+ * @default 'soft-first'
3363
+ */
3364
+ degradation?: Degradation | boolean;
3365
+ /** {zh}
3366
+ * @brief 为播放器设置封面图 URL。
3367
+ * @default 无
3368
+ */
3369
+ /** {en}
3370
+ * @brief The URL of the player's cover image.
3371
+ */
3372
+ poster?: string;
3373
+ /** {zh}
3374
+ * @brief 为播放器设置初始显示语言,语言包不存在的情况下默认显示 'en' 语言包 。默认值为 `document.documentElement.getAttribute('lang') || navigator.language || 'zh-cn'`
3375
+ * @default -
3376
+ */
3377
+ /** {en}
3378
+ * @brief The initial display language of the player. If the language pack does not exist, the 'en'language pack will be displayed by default. The default value is `document.documentElement.getAttribute('lang') || navigator.language || 'zh-cn'`.
3379
+ * @default -
3380
+ */
3381
+ lang?: Lang;
3382
+ /** {zh}
3383
+ * @brief 为播放器设置自定义的多语言词典,可设置每个语种的词典,格式为 { texts: { [key: string]: Object; } }。
3384
+ * 例如,{ texts: { 'zh-cn': { PIP: '画中画' }, en: { PIP: 'pip' } }} ,格式请参考[默认词典](https://www.volcengine.com/docs/6469/127529)。
3385
+ * @default 无
3386
+ */
3387
+ /** {en}
3388
+ * @brief Configures a custom multilingual dictionary for the player. You can set the dictionary for each language in the format { texts: { [key: string]: Object; } }. For example, { texts: { 'zh-cn': { PIP: '画中画' }, en: { PIP: 'pip' } }}.
3389
+ * You can use the [default dictionary](https://docs.byteplus.com/byteplus-media-live/docs/default-dictionary_1) as a reference.
3390
+ */
3391
+ i18n?: {
3392
+ texts: Record<Lang, Record<string, string>>;
3393
+ };
3394
+ /** {zh}
3395
+ * @brief 为播放器设置是否自动播放, `muted` 设置为 `true` 为静音自动播放。
3396
+ * @default { muted: true }
3397
+ * @type {{ muted: boolean } | boolean}
3398
+ */
3399
+ /** {en}
3400
+ * @brief Whether to enable autoplay for the player. If `muted` is set to `true`, the autoplay is muted.
3401
+ * @default { muted: true }
3402
+ * @type {{ muted: boolean } | boolean}
3403
+ */
3404
+ autoplay?: {
3405
+ muted?: boolean;
3406
+ } | boolean;
3407
+ /** {zh}
3408
+ * @brief 为播放器设置默认音量,取值范围 [0,1]。
3409
+ * @default 0.6
3410
+ */
3411
+ /** {en}
3412
+ * @brief The default volume for the player. Valid range: [0,1].
3413
+ * @default 0.6
3414
+ */
3415
+ volume?: number;
3416
+ /** {zh}
3417
+ * @brief 为播放器设置是否显示画中画功能按钮。
3418
+ * - `true`:显示;
3419
+ * - `false`:不显示。
3420
+ * @default false
3421
+ */
3422
+ /** {en}
3423
+ * @brief Whether to display the Picture-in-Picture (PiP) button.
3424
+ * - `true`: Display;
3425
+ * - `false`: Do not display.
3426
+ * @default false
3427
+ */
3428
+ pip?: boolean;
3429
+ /** {zh}
3430
+ * @brief 为播放器设置是否显示全屏功能按钮,并进行全屏功能设置。
3431
+ * - `true`:显示;
3432
+ * - `false`:不显示。
3433
+ */
3434
+ /** {en}
3435
+ * @brief Whether to display the full-screen button.
3436
+ * - `true`: Display;
3437
+ * - `false`: Do not display.
3438
+ * @default -
3439
+ */
3440
+ fullscreen?: boolean | Fullscreen;
3441
+ /** {zh}
3442
+ * @brief 为播放器设置报错信息,支持配置播放异常时,播放器显示的异常文案、图片,以及是否提供刷新按钮等。
3443
+ * @default -
3444
+ */
3445
+ /** {en}
3446
+ * @brief The error message of the player. When a playback error occurs, you can configure the error message and image displayed and whether to display the refresh button.
3447
+ * @default -
3448
+ */
3449
+ error?: ErrorConfig;
3450
+ /** {zh}
3451
+ * @brief 为播放器设置清晰度的相关配置。
3452
+ * @default -
3453
+ */
3454
+ /** {en}
3455
+ * @brief Resolution-related configurations.
3456
+ * @default -
3457
+ */
3458
+ definition?: DefinitionConfig;
3459
+ /** {zh}
3460
+ * @brief 为播放器设置是否显示控制栏。
3461
+ * - `true`: 显示;
3462
+ * - `false`: 不显示
3463
+ * @default true
3464
+ */
3465
+ /** {en}
3466
+ * @brief Whether to display the control bar for the player.
3467
+ * - `true`: Display;
3468
+ * - `false`: Do not display.
3469
+ * @default true
3470
+ */
3471
+ controls?: boolean | {
3472
+ [propName: string]: any;
3473
+ };
3474
+ /** {zh}
3475
+ * @brief 为播放器设置**清晰度选择**或**线路选择**时的**选择面板样式**,仅在移动端有效。
3476
+ * @default 'bottom'
3477
+ */
3478
+ /** {en}
3479
+ * @brief Select the panel style for resolution and line selection. This parameter takes effect on mobile devices only.
3480
+ * @default 'bottom'
3481
+ */
3482
+ listType?: ListType;
3483
+ /** {zh}
3484
+ * @brief 为播放器设置是否启用内联播放模式。playsinline 属性是 HTML5 视频标签的一个属性,用于指定视频是否应在页面文档内播放。
3485
+ * - `true`:启用,表示视频将在页面文档内播放;
3486
+ * - `false`:停用,默认浏览器播放行为。
3487
+ * 该配置项只在移动端生效,当取值为 true 的时候,会在初始化 video 或 audio 对象的时候,将 playsinline、webkit-playsinline、x5-playsinline 三个属性设置为 true,请参考 [New Policies for iOS](https://webkit.org/blog/6784/new-video-policies-for-ios/) 了解内联模式相关知识。
3488
+ * @listtip
3489
+ * - iOS 10 及以上系统 Safari 浏览器支持配置内联播放模式;
3490
+ * - iOS 10 以下系统 Safari 浏览器不支持配置内联播放模式 ,默认播放即进入系统全屏。
3491
+ * @default true
3492
+ */
3493
+ /** {en}
3494
+ * @brief Whether to enable inline playback for the player. The `playsinline` property is a property of the `video` element in HTML5. It specifies whether the video should be played inline.
3495
+ * - `true`: Enable inline playback.
3496
+ * - `false`: Disable. The default browser playback behavior will be used.
3497
+ * This option only takes effect on mobile devices. When it is set to `true`, the `playsinline`, `webkit-playsinline`, and `x5-playsinline` properties are set to `true` when the video or audio objects are initialized. You can refer to [New Policies for iOS](https://webkit.org/blog/6784/new-video-policies-for-ios/) for more information about the inline playback.
3498
+ * @listtip
3499
+ * - Safari on iOS 10 and above supports inline playback.
3500
+ * - Safari on iOS versions lower than 10 does not support inline playback. The player will automatically enter fullscreen mode when playback begins.
3501
+ * @default true
3502
+ */
3503
+ playsinline?: boolean;
3504
+ /** {zh}
3505
+ * @brief 为播放器设置 video 标签扩展属性,初始化时会设置在 videoElement 或 audioElement 对象上,请参考 [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#properties) 查看其支持的属性配置。
3506
+ * @default 无
3507
+ */
3508
+ /** {en}
3509
+ * @brief Additional properties for the `video` element that will be applied when the `videoElement` or `audioElement` objects are initialized. Refer to [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#properties) for supported properties.
3510
+ */
3511
+ videoAttributes?: {
3512
+ [propName: string]: any;
3513
+ };
3514
+ /** {zh}
3515
+ * @brief 为播放器设置是否启用流式布局,启用流式布局后播放器会根据屏幕的宽度进行调整,保持在不同屏幕尺寸上都有良好的显示效果。
3516
+ * - `true`:启用
3517
+ * - `false`:停用
3518
+ * @listtip
3519
+ * 启用流式布局时:
3520
+ * - 如果 `width` 和 `height` 是 `Number` 类型,则按照其数值计算播放器宽高比;
3521
+ * - 如果 `width` 和 `height` 不是 `Number` 类型,默认使用 16:9 比例。
3522
+ * @default false
3523
+ */
3524
+ /** {en}
3525
+ * @brief Whether to enable responsive layout for the player. If responsive layout is enabled, the player size will be auto-adjusted according to the width of the screen to ensure a proper display on different screen sizes.
3526
+ * - `true`: Enable
3527
+ * - `false`: Disable
3528
+ * @listtip
3529
+ * When responsive layout is enabled:
3530
+ * If `width` and `height` are of type number, the player's aspect ratio will be determined based on their values.
3531
+ * If `width` and `height` are not of type number, the player uses a 16:9 aspect ratio.
3532
+ * @default false
3533
+ */
3534
+ fluid?: boolean;
3535
+ /** {zh}
3536
+ * @brief 为播放器设置尺寸适配方式,在视频资源初始化之后,根据获取到的 videoWidth 和 videoHeight 值对播放器容器宽高比例进行调整,可选项有:
3537
+ * - `fixed`: 保持容器宽/高,不做适配;
3538
+ * - `fixWidth`: 保持容器宽度,适配高度;
3539
+ * - `fixHeight`: 保持容器高度,适配宽度。
3540
+ * @default 'fixed'
3541
+ */
3542
+ /** {en}
3543
+ * @brief The adaptation mode for the player size. After the video resource is initialized, the player container's aspect ratio is adjusted based on the obtained values of `videoWidth` and `videoHeight`. The available options include:
3544
+ * - `fixed`: Keep the container's width and height without adaptation;
3545
+ * - `fixWidth`: Keep the container's width and adjust the height;
3546
+ * - `fixHeight`: Keep the container's height and adjust the width.
3547
+ * @default 'fixed'
3548
+ */
3549
+ fitVideoSize?: "fixWidth" | "fixHeight" | "fixed";
3550
+ /** {zh}
3551
+ * @brief 为播放器设置视频画面填充模式,可选项有:
3552
+ * - `fillwidth`: 填充宽度,高度溢出则裁剪高度;
3553
+ * - `fillHeight`: 填充高度,宽度溢出则裁剪宽度;
3554
+ * - `fill`: 拉伸视频以填充容器;
3555
+ * - `cover`: 保持其宽高比的同时填充元素的整个内容框;
3556
+ * - `auto`: 使用浏览器默认的视频画面填充模式。
3557
+ * @default 'auto'
3558
+ */
3559
+ /** {en}
3560
+ * @brief The fill mode of the video. The available options include:
3561
+ * - `fillwidth`: Fill the width of the container and crop the height if necessary.
3562
+ * - `fillHeight`: Fill the height of the container and crop the width if necessary.
3563
+ * - `fill`: Stretch the video to fill the container;
3564
+ * - `cover`: Fill the entire container while keeping the original aspect ratio;
3565
+ * - `auto`: Use the default fill mode of the browser.
3566
+ * @default 'auto'
3567
+ */
3568
+ videoFillMode?: "auto" | "fillHeight" | "fillWidth" | "fill" | "cover";
3569
+ /** {zh}
3570
+ * @brief 是否开启画面和控制栏分离模式。设置为开启时,控制栏将会常驻,与视频画面不重叠。
3571
+ * - `true`:开启
3572
+ * - `false`:关闭
3573
+ * @default false
3574
+ */
3575
+ /** {en}
3576
+ * @brief Whether to enable the separation of the video and the control bar. When enabled, the control bar will remain visible without overlapping the video content.
3577
+ * - `true`: Enable
3578
+ * - `false`: Disable
3579
+ * @default false
3580
+ */
3581
+ marginControls?: boolean;
3582
+ /** {zh}
3583
+ * @brief 启用微信同层播放。
3584
+ * @default 无
3585
+ */
3586
+ /** {en}
3587
+ * @brief Enable playing the video on the same player as WeChat.
3588
+ */
3589
+ "x5-video-player-type"?: string;
3590
+ /** {zh}
3591
+ * @brief 是否启用微信全屏播放模式。
3592
+ * - `true`:启用
3593
+ * - `false`:停用
3594
+ * @default 无
3595
+ */
3596
+ /** {en}
3597
+ * @brief Whether to enable full-screen playback in WeChat.
3598
+ * - `true`: Enable
3599
+ * - `false`: Disable
3600
+ */
3601
+ "x5-video-player-fullscreen"?: boolean;
3602
+ /** {zh}
3603
+ * @brief 微信横竖屏控制,支持如下取值:
3604
+ * - `landscape`:横屏
3605
+ * - `portrait`:竖屏
3606
+ * - `landscape|portrait`:跟随手机自动旋转
3607
+ * @default 无
3608
+ */
3609
+ /** {en}
3610
+ * @brief The orientation of the video when played on WeChat. The following values are supported:
3611
+ * - `landscape`: Horizontal screen;
3612
+ * - `portrait`: Vertical screen;
3613
+ * - `landscape | portrait`: Rotate with the mobile.
3614
+ */
3615
+ "x5-video-orientation"?: "landscape" | "portrait" | "landscape|portrait";
3616
+ /** {zh}
3617
+ * @brief 为播放器配置关键点样式。
3618
+ * @default 无
3619
+ * @hidden 直播目前没用到
3620
+ */
3621
+ /** {en}
3622
+ * @brief Configures the keypoint style for the player.
3623
+ * @hidden
3624
+ */
3625
+ commonStyle?: CommonStyle;
3626
+ /** {zh}
3627
+ * @brief 自定义插件列表。
3628
+ * @default 无
3629
+ */
3630
+ /** {en}
3631
+ * @brief A list of custom plugins.
3632
+ */
3633
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3634
+ plugins?: any[];
3635
+ /** {zh}
3636
+ * @hidden
3637
+ */
3638
+ /** {en}
3639
+ * @hidden
3640
+ */
3641
+ preparePlugins?: PreparePlugins;
3642
+ }
3643
+ /** {zh}
3644
+ * @list option
3645
+ * @kind property
3646
+ */
3647
+ /** {en}
3648
+ * @list option
3649
+ * @kind property
3650
+ */
3651
+ interface Fullscreen {
3652
+ /** {zh}
3653
+ * @brief 切换全屏时,是否旋转为横屏播放,通常在移动端使用。如果开启横屏播放,切换全屏时,将在竖屏状态下把播放器旋转 90 度,实现横屏效果。该配置优先级高于 useCssFullscreen。
3654
+ * - `true`:使用旋转横屏;
3655
+ * - `false`:不使用旋转横屏。
3656
+ * @default false
3657
+ */
3658
+ /** {en}
3659
+ * @brief Whether to play the video in landscape mode when the video enters full-screen mode. This feature is usually used on mobile devices. Once enabled, when the video enters fullscreen mode, the player will be rotated from portrait mode by 90 degrees to landscape mode. This property has a higher priority over `useCssFullscreen`.
3660
+ * - `true`: Enable.
3661
+ * - `false`: Disable.
3662
+ * @default false
3663
+ */
3664
+ rotateFullscreen?: boolean;
3665
+ /** {zh}
3666
+ * @brief 是否使用页面全屏代替系统全屏功能。
3667
+ * - `true`:页面全屏;
3668
+ * - `false`:系统全屏。
3669
+ * @default false
3670
+ */
3671
+ /** {en}
3672
+ * @brief Whether to use full-window.
3673
+ * - `true`: Use full-window mode, in which the player covers the browser window.
3674
+ * - `false`: Use full-screen mode, in which the player covers the entire desktop.
3675
+ * @default false
3676
+ */
3677
+ useCssFullscreen?: boolean;
3678
+ /** {zh}
3679
+ * 全屏的时候是否显示右上角返回按钮,通常在移动端开启。
3680
+ * - `true`:显示;
3681
+ * - `false`:不显示。
3682
+ * @default false
3683
+ */
3684
+ /** {en}
3685
+ * Whether to display a return button at the top-right corner when the player is in full-screen mode. This feature is usually turned on on mobile devices.
3686
+ * `true`: Display;
3687
+ * `false`: Do not display.
3688
+ * @default false
3689
+ * @brief
3690
+ * Whether to display a return button at the top-right corner when the player is in full-screen mode. This feature is usually turned on on mobile devices.
3691
+ * - `true`: Display;
3692
+ * - `false`: Do not display.
3693
+ */
3694
+ needBackIcon?: boolean;
3695
+ }
3696
+ /** {zh}
3697
+ * @list option
3698
+ * @kind property
3699
+ * @hidden
3700
+ */
3701
+ /** {en}
3702
+ * @list option
3703
+ * @kind property
3704
+ * @hidden
3705
+ */
3706
+ interface CommonStyle {
3707
+ /** {zh}
3708
+ * @brief 进度条底色
3709
+ * @default 无
3710
+ */
3711
+ /** {en}
3712
+ * @brief The background color of the progress bar.
3713
+ */
3714
+ progressColor?: string;
3715
+ /** {zh}
3716
+ * @brief 播放完成部分进度条底色
3717
+ * @default 无
3718
+ */
3719
+ /** {en}
3720
+ * @brief The background color of the progress bar for the completed portion of video playback.
3721
+ */
3722
+ playedColor?: string;
3723
+ /** {zh}
3724
+ * @brief 缓存部分进度条底色
3725
+ * @default 无
3726
+ */
3727
+ /** {en}
3728
+ * @brief
3729
+ * @brief The background color of the progress bar for the cached portion of video playback.
3730
+ */
3731
+ cachedColor?: string;
3732
+ /** {zh}
3733
+ * @brief 进度条滑块样式
3734
+ * @default 无
3735
+ */
3736
+ /** {en}
3737
+ * @brief The style of the progress bar slider.
3738
+ */
3739
+ sliderBtnStyle?: {
3740
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3741
+ [propName: string]: any;
3742
+ };
3743
+ /** {zh}
3744
+ * @brief 音量颜色
3745
+ * @default 无
3746
+ */
3747
+ /** {en}
3748
+ * @brief The color of the volume slider.
3749
+ */
3750
+ volumeColor?: string;
3751
+ }
3752
+ type PrepareResult = {
3753
+ options?: Partial<VePlayerBaseOptions>;
3754
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3755
+ plugins?: any[];
3756
+ };
3757
+ type PreparePlugins = (url: string) => Promise<PrepareResult> | undefined;
3758
+ /** {zh}
3759
+ * @detail option
3760
+ * @brief 视频的实际编码格式。如果您在degradation 设置了 SoftFirst 属性(即硬解不支持降级软解),建议您传入该参数,省去探测实际编码格式的操作。
3761
+ */
3762
+ /** {en}
3763
+ * @detail option
3764
+ * @brief The actual codec of the video.
3765
+ */
3766
+ enum Codec {
3767
+ /** {zh}
3768
+ * @brief H.265 编码格式
3769
+ */
3770
+ /** {en}
3771
+ * @brief H.265.
3772
+ */
3773
+ H265 = "h265",
3774
+ /** {zh}
3775
+ * @brief H.264 编码格式
3776
+ */
3777
+ /** {en}
3778
+ * @brief H.264.
3779
+ */
3780
+ H264 = "h264"
3781
+ }
3782
+ /** {zh}
3783
+ * @detail option
3784
+ * @brief 是否开启 H.265 兼容模式。在 H.265 兼容模式下,播放器会优先使用硬解来解码 H.265 直播流。如果设备或浏览器不支持 H.265 硬解,则自动降级为 H.265 软解。
3785
+ */
3786
+ /** {en}
3787
+ * @detail option
3788
+ * @brief Whether to use H.265 compatibility mode. In H.265 compatibility mode, the player will prioritize hardware decoding to decode H.265 video. If the device or browser does not support H.265 hardware decoding, it will automatically fall back to H.265 software decoding.
3789
+ */
3790
+ enum Degradation {
3791
+ /** {zh}
3792
+ * @brief 硬解不支持降级到软解
3793
+ */
3794
+ /** {en}
3795
+ * @brief The player does not support falling back to software decoding.
3796
+ */
3797
+ SoftFirst = "soft-first",
3798
+ /** {zh}
3799
+ * @brief 硬解不支持降级到h264
3800
+ * @hidden
3801
+ */
3802
+ /** {en}
3803
+ * @brief The player does not support falling back to H.264.
3804
+ * @hidden
3805
+ */
3806
+ H264First = "h264-first"
3807
+ }
3808
+ /** {zh}
3809
+ * @detail option
3810
+ * @brief 解码方式。
3811
+ * @example
3812
+ */
3813
+ /** {en}
3814
+ * @detail option
3815
+ * @brief Decoding method.
3816
+ * @example
3817
+ */
3818
+ enum DecodeType {
3819
+ /** {zh}
3820
+ * @brief 软解
3821
+ */
3822
+ /** {en}
3823
+ * @brief Software decoding.
3824
+ */
3825
+ Software = "software",
3826
+ /** {zh}
3827
+ * @brief 硬解
3828
+ */
3829
+ /** {en}
3830
+ * @brief Hardware decoding.
3831
+ */
3832
+ Hardware = "hardware"
3833
+ }
3834
+ /// <reference types="./loader" />
3835
+ const NAME_MAP: {
3836
+ readonly "biz:vod": "veplayer.biz.vod.[env].[ext]";
3837
+ readonly "biz:live": "veplayer.biz.live.[env].[ext]";
3838
+ readonly "plugin:flv": "veplayer.plugin.flv.[env].[ext]";
3839
+ readonly "plugin:mp4": "veplayer.plugin.mp4.[env].[ext]";
3840
+ readonly "plugin:hls": "veplayer.plugin.hls.[env].[ext]";
3841
+ readonly "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]";
3842
+ readonly "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]";
3843
+ readonly "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]";
3844
+ readonly "plugin:drm": "veplayer.plugin.drm.[env].[ext]";
3845
+ };
3846
+ const enum State {
3847
+ Fetching = 0,
3848
+ Ready = 1,
3849
+ Error = 2
3850
+ }
3851
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3852
+ type Exports = Record<string, any>;
3853
+ interface Module {
3854
+ src: string;
3855
+ state: State;
3856
+ name: string;
3857
+ exports: Exports;
3858
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3859
+ error?: any;
3860
+ }
3861
+ type ModuleSystem = "esm" | "umd";
3862
+ interface LoaderOptions {
3863
+ baseUrl: string;
3864
+ }
3865
+ enum DynamicModule {
3866
+ BizVod = "biz:vod",
3867
+ BizLive = "biz:live",
3868
+ PluginFlv = "plugin:flv",
3869
+ PluginMp4 = "plugin:mp4",
3870
+ PluginHls = "plugin:hls",
3871
+ PluginShaka = "plugin:shaka",
3872
+ PluginRtm = "plugin:rtm",
3873
+ PluginXgvideo = "plugin:xgvideo",
3874
+ PluginDrm = "plugin:drm"
3875
+ }
3876
+ type ModulesMap = {
3877
+ [DynamicModule.BizVod]: Exports;
3878
+ [DynamicModule.BizLive]: Exports;
3879
+ [DynamicModule.PluginFlv]: Exports;
3880
+ [DynamicModule.PluginMp4]: Exports;
3881
+ [DynamicModule.PluginHls]: Exports;
3882
+ [DynamicModule.PluginShaka]: Exports;
3883
+ [DynamicModule.PluginRtm]: Exports;
3884
+ [DynamicModule.PluginXgvideo]: Exports;
3885
+ [DynamicModule.PluginDrm]: Exports;
3886
+ };
3887
+ class Loader {
3888
+ readonly modules: Record<string, Module>;
3889
+ readonly mountPromiseMap: Record<string, Promise<Exports>>;
3890
+ private _baseUrl;
3891
+ private _moduleSystem?;
3892
+ constructor(options: LoaderOptions);
3893
+ get baseUrl(): string;
3894
+ get moduleSystem(): ModuleSystem | undefined;
3895
+ setModuleSystem(moduleSystem: ModuleSystem): void;
3896
+ setBaseUrl(url: string): void;
3897
+ load: <T extends DynamicModule>(name: T, src?: string) => Promise<ModulesMap[T]>;
3898
+ registerPlugin: (name: string, exports: Exports) => Exports;
3899
+ register: (exports: Exports[]) => Exports[];
3900
+ private _mount;
3901
+ }
3902
+ const registerPlugin: (name: string, exports: {
3903
+ [x: string]: any;
3904
+ }) => {
3905
+ [x: string]: any;
3906
+ };
3907
+ const register: (exports: {
3908
+ [x: string]: any;
3909
+ }[]) => {
3910
+ [x: string]: any;
3911
+ }[];
3912
+ function setModuleSystem(moduleSystem: ModuleSystem): void;
3913
+ function setBaseUrl(url: string): void;
3914
+ function getBaseUrl(): string;
3915
+ function load<T extends DynamicModule>(name: T, src?: string): Promise<ModulesMap[T]>;
3916
+ interface Strategy<T = VePlayerBaseOptions, R extends keyof ModulesMap = any> {
3917
+ options: Partial<T>;
3918
+ module: R;
3919
+ afterLoad?: (module: ModulesMap[R]) => void;
3920
+ }
3921
+ type StrategyCreator<T, R extends keyof ModulesMap = any> = (options?: T) => Strategy<T, R>;
3922
+ const createFlvMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginFlv>;
3923
+ const createHlsMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginHls>;
3924
+ const createSoftDecodeH264Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
3925
+ const createSoftDecodeH265Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
3926
+ function getCodec(options: VePlayerBaseOptions): Promise<"unknown" | Codec>;
3927
+ function detectCodec(url: string): Promise<"unknown" | Codec>;
3928
+ function isSoftDecode(options: VePlayerBaseOptions, currentCodec?: Codec | "unknown"): Promise<boolean>;
3929
+ function combineOptions<T = VePlayerBaseOptions>(strategyList: (Strategy<T> | undefined)[]): Partial<T>;
3930
+ const getFlvStrategy: (options: VePlayerBaseOptions) => Promise<{
3931
+ options?: undefined;
3932
+ plugins?: undefined;
3933
+ } | {
3934
+ options: Partial<VePlayerBaseOptions>;
3935
+ plugins: any[];
3936
+ }>;
3937
+ const getHlsStrategy: (options: VePlayerBaseOptions) => Promise<{
3938
+ options?: undefined;
3939
+ plugins?: undefined;
3940
+ } | {
3941
+ options: Partial<VePlayerBaseOptions>;
3942
+ plugins: any[];
3943
+ }>;
3944
+ }
3945
+ declare namespace error {
3946
+ const EN: {
3947
+ DEFINITION_FALLBACK_TOAST: string;
3948
+ DEFINITION_SWITCHING: string;
3949
+ ERROR_REFRESH: string;
3950
+ UNMUTE: string;
3951
+ MANIFEST: string;
3952
+ NETWORK: string;
3953
+ NETWORK_TIMEOUT: string;
3954
+ NETWORK_FORBIDDEN: string;
3955
+ NETWORK_NOTFOUND: string;
3956
+ DEMUX: string;
3957
+ REMUX: string;
3958
+ MEDIA: string;
3959
+ MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
3960
+ MEDIA_ERR_URL_EMPTY: string;
3961
+ DRM: string;
3962
+ DRM_LICENSE: string;
3963
+ OTHER: string;
3964
+ RUNTIME: string;
3965
+ MODULE_LOAD_ERROR: string;
3966
+ UNKNOWN: string;
3967
+ ERROR_TYPES: typeof XG_EN.TEXT.ERROR_TYPES;
3968
+ HAVE_NOTHING: string;
3969
+ HAVE_METADATA: string;
3970
+ HAVE_CURRENT_DATA: string;
3971
+ HAVE_FUTURE_DATA: string;
3972
+ HAVE_ENOUGH_DATA: string;
3973
+ NETWORK_EMPTY: string;
3974
+ NETWORK_IDLE: string;
3975
+ NETWORK_LOADING: string;
3976
+ NETWORK_NO_SOURCE: string;
3977
+ MEDIA_ERR_ABORTED: string;
3978
+ MEDIA_ERR_NETWORK: string;
3979
+ MEDIA_ERR_DECODE: string;
3980
+ MEDIA_ERR_SRC_NOT_SUPPORTED: string;
3981
+ REPLAY: string;
3982
+ ERROR: string;
3983
+ PLAY_TIPS: string;
3984
+ PAUSE_TIPS: string;
3985
+ PLAYNEXT_TIPS: string;
3986
+ DOWNLOAD_TIPS: string;
3987
+ ROTATE_TIPS: string;
3988
+ RELOAD_TIPS: string;
3989
+ FULLSCREEN_TIPS: string;
3990
+ EXITFULLSCREEN_TIPS: string;
3991
+ CSSFULLSCREEN_TIPS: string;
3992
+ EXITCSSFULLSCREEN_TIPS: string;
3993
+ TEXTTRACK: string;
3994
+ PIP: string;
3995
+ SCREENSHOT: string;
3996
+ LIVE: string;
3997
+ OFF: string;
3998
+ OPEN: string;
3999
+ MINI_DRAG: string;
4000
+ MINISCREEN: string;
4001
+ REFRESH_TIPS: string;
4002
+ REFRESH: string;
4003
+ FORWARD: string;
4004
+ LIVE_TIP: string;
4005
+ };
4006
+ const ZH_CN: {
4007
+ DEFINITION_FALLBACK_TOAST: string;
4008
+ DEFINITION_SWITCHING: string;
4009
+ ERROR_REFRESH: string;
4010
+ UNMUTE: string;
4011
+ MANIFEST: string;
4012
+ NETWORK: string;
4013
+ NETWORK_TIMEOUT: string;
4014
+ NETWORK_FORBIDDEN: string;
4015
+ NETWORK_NOTFOUND: string;
4016
+ DEMUX: string;
4017
+ REMUX: string;
4018
+ MEDIA: string;
4019
+ MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
4020
+ MEDIA_ERR_URL_EMPTY: string;
4021
+ DRM: string;
4022
+ DRM_LICENSE: string;
4023
+ OTHER: string;
4024
+ RUNTIME: string;
4025
+ MODULE_LOAD_ERROR: string;
4026
+ UNKNOWN: string;
4027
+ ERROR_TYPES: typeof XG_ZH_CN.TEXT.ERROR_TYPES;
4028
+ HAVE_NOTHING: string;
4029
+ HAVE_METADATA: string;
4030
+ HAVE_CURRENT_DATA: string;
4031
+ HAVE_FUTURE_DATA: string;
4032
+ HAVE_ENOUGH_DATA: string;
4033
+ NETWORK_EMPTY: string;
4034
+ NETWORK_IDLE: string;
4035
+ NETWORK_LOADING: string;
4036
+ NETWORK_NO_SOURCE: string;
4037
+ MEDIA_ERR_ABORTED: string;
4038
+ MEDIA_ERR_NETWORK: string;
4039
+ MEDIA_ERR_DECODE: string;
4040
+ MEDIA_ERR_SRC_NOT_SUPPORTED: string;
4041
+ REPLAY: string;
4042
+ ERROR: string;
4043
+ PLAY_TIPS: string;
4044
+ PAUSE_TIPS: string;
4045
+ PLAYNEXT_TIPS: string;
4046
+ DOWNLOAD_TIPS: string;
4047
+ ROTATE_TIPS: string;
4048
+ RELOAD_TIPS: string;
4049
+ FULLSCREEN_TIPS: string;
4050
+ EXITFULLSCREEN_TIPS: string;
4051
+ CSSFULLSCREEN_TIPS: string;
4052
+ EXITCSSFULLSCREEN_TIPS: string;
4053
+ TEXTTRACK: string;
4054
+ PIP: string;
4055
+ SCREENSHOT: string;
4056
+ LIVE: string;
4057
+ OFF: string;
4058
+ OPEN: string;
4059
+ MINI_DRAG: string;
4060
+ MINISCREEN: string;
4061
+ REFRESH_TIPS: string;
4062
+ REFRESH: string;
4063
+ FORWARD: string;
4064
+ LIVE_TIP: string;
4065
+ };
4066
+ type TextKey = keyof typeof EN;
4067
+ type Lang = "zh-cn" | "zh-hk" | "en" | "jp" | string;
4068
+ class VeI18n<T extends string = TextKey> {
4069
+ private _lang;
4070
+ constructor(config?: {
4071
+ lang?: Lang;
4072
+ i18n?: {
4073
+ texts?: Record<Lang, Record<string, string>>;
4074
+ };
4075
+ });
4076
+ static get langKeys(): string[];
4077
+ static isLangValid(lang: Lang): boolean;
4078
+ static extend(i18nTextList: Array<IXGI18nText>, i18nLangs?: IXGI18n): void;
4079
+ setLang(lang: string): void;
4080
+ getLang(): string;
4081
+ normalize(text?: string | Record<Lang, string>): string;
4082
+ getText(textKey?: T | string): Record<string | T, string>[string | T] | undefined;
4083
+ }
4084
+ /** {zh}
4085
+ * @detail error
4086
+ */
4087
+ /** {en}
4088
+ * @detail error
4089
+ */
4090
+ enum Level {
4091
+ /** {zh}
4092
+ * @brief 严重
4093
+ *
4094
+ */
4095
+ /** {en}
4096
+ * @brief Fatal.
4097
+ *
4098
+ */
4099
+ Fatal = "Fatal",
4100
+ /** {zh}
4101
+ * @brief 报错
4102
+ */
4103
+ /** {en}
4104
+ * @brief Error.
4105
+ */
4106
+ Error = "Error"
4107
+ }
4108
+ enum ErrorCode {
4109
+ /** {zh}
4110
+ * @brief 视频解析错误
4111
+ * @solution 请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4112
+ */
4113
+ /** {en}
4114
+ * @brief Video parsing error.
4115
+ * @solution Please contact your [technical support](https://www.byteplus.com/en/support).
4116
+ */
4117
+ MANIFEST_HLS_ERROR = 1100,
4118
+ /** {zh}
4119
+ * @brief 视频解析错误
4120
+ * @solution 请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4121
+ */
4122
+ /** {en}
4123
+ * @brief Video parsing error.
4124
+ * @solution Please contact your [technical support](https://www.byteplus.com/en/support).
4125
+ */
4126
+ MANIFEST_DASH_ERROR = 1200,
4127
+ /** {zh}
4128
+ * @brief 网络错误
4129
+ * @solution 请检查当前网络环境或播放地址是否合法。
4130
+ */
4131
+ /** {en}
4132
+ * @brief Network error.
4133
+ * @solution Please check the current network environment and ensure the pull stream address is valid.
4134
+ */
4135
+ NETWORK = 2100,
4136
+ /** {zh}
4137
+ * @brief 网络请求超时
4138
+ * @solution 请检查拉流地址是否合法。
4139
+ */
4140
+ /** {en}
4141
+ * @brief Network request timed out
4142
+ * @solution Please check whether the pull stream address is valid.
4143
+ */
4144
+ NETWORK_TIMEOUT = 2101,
4145
+ /** {zh}
4146
+ * @brief 网络请求 403
4147
+ * @solution 请检查拉流地址鉴权信息。
4148
+ */
4149
+ /** {en}
4150
+ * @brief The player received a 403 response code.
4151
+ * @solution Check the authentication information in the pull stream address.
4152
+ */
4153
+ NETWORK_FORBIDDEN = 2103,
4154
+ /** {zh}
4155
+ * @brief 网络请求 404
4156
+ * @solution 请检查拉流地址是否合法。
4157
+ */
4158
+ /** {en}
4159
+ * @brief The player received a 404 response code.
4160
+ * @solution Check whether the pull stream address is valid.
4161
+ */
4162
+ NETWORK_NOTFOUND = 2104,
4163
+ /** {zh}
4164
+ * @brief 网络请求 206
4165
+ * @solution 请检查拉流地址是否合法。
4166
+ */
4167
+ /** {en}
4168
+ * @brief The player received a 206 response code.
4169
+ * @solution Check whether the pull stream address is valid.
4170
+ */
4171
+ NETWORK_RANGE_NOT_SATISFIABLE = 2116,
4172
+ /** {zh}
4173
+ * @brief 视频解析错误
4174
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4175
+ */
4176
+ /** {en}
4177
+ * @brief Video parsing error.
4178
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
4179
+ */
4180
+ DEMUX_FLV_ERROR = 3100,
4181
+ /** {zh}
4182
+ * @brief 视频解析错误
4183
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4184
+ */
4185
+ /** {en}
4186
+ * @brief Video parsing error.
4187
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
4188
+ */
4189
+ DEMUX_HLS_ERROR = 3200,
4190
+ /** {zh}
4191
+ * @brief 视频解析错误
4192
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4193
+ *
4194
+ */
4195
+ /** {en}
4196
+ * @brief Video parsing error.
4197
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
4198
+ *
4199
+ */
4200
+ DEMUX_MP4_ERROR = 3300,
4201
+ /** {zh}
4202
+ * @brief 视频解析错误
4203
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4204
+ *
4205
+ */
4206
+ /** {en}
4207
+ * @brief Video parsing error.
4208
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
4209
+ *
4210
+ */
4211
+ DEMUX_FMP4_ERROR = 3400,
4212
+ /** {zh}
4213
+ * @brief 视频解析错误
4214
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4215
+ *
4216
+ */
4217
+ /** {en}
4218
+ * @brief Video parsing error.
4219
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
4220
+ *
4221
+ */
4222
+ DEMUX_SIDX_ERROR = 3410,
4223
+ /** {zh}
4224
+ * @brief 视频解析错误
4225
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4226
+ *
4227
+ */
4228
+ /** {en}
4229
+ * @brief Video parsing error.
4230
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
4231
+ *
4232
+ */
4233
+ REMUX_FMP4_ERROR = 4100,
4234
+ /** {zh}
4235
+ * @brief 视频解析错误
4236
+ * @solution 请检查拉流地址是否合法或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4237
+ *
4238
+ */
4239
+ /** {en}
4240
+ * @brief Video parsing error.
4241
+ * @solution Check whether the pull stream address is valid, or contact [technical support](https://www.byteplus.com/en/support).
4242
+ *
4243
+ */
4244
+ REMUX_MP4_ERROR = 4200,
4245
+ /** {zh}
4246
+ * @brief 获取数据过程被中止
4247
+ * @solution 请检查浏览器网络请求是否正常,再尝试重新拉流。
4248
+ */
4249
+ /** {en}
4250
+ * @brief The process of obtaining data was aborted.
4251
+ * @solution Check whether the request is correct and then try to pull the stream again.
4252
+ */
4253
+ MEDIA_ERR_ABORTED = 5101,
4254
+ /** {zh}
4255
+ * @brief 网络发生错误,无法成功获取媒体文件
4256
+ * @solution 请检查浏览器网络请求是否正常,再尝试重新拉流。
4257
+ */
4258
+ /** {en}
4259
+ * @brief A network error occurred and the media file could not be successfully obtained.
4260
+ * @solution Check whether the request is correct and then try to pull the stream again.
4261
+ */
4262
+ MEDIA_ERR_NETWORK = 5102,
4263
+ /** {zh}
4264
+ * @brief 浏览器在解码媒体资源时发生错误
4265
+ * @solution
4266
+ * 1. 请检查原始视频是否正常;
4267
+ * 2. 重新进行转码和播放;
4268
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4269
+ */
4270
+ /** {en}
4271
+ * @brief An error occurred to the browser while decoding the media resources.
4272
+ * @solution
4273
+ * 1. Check whether there is any issue with the original video.
4274
+ * 2. Re-transcode the video and play it again.
4275
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
4276
+ */
4277
+ MEDIA_ERR_DECODE = 5103,
4278
+ /** {zh}
4279
+ * @brief 因视频格式不支持、服务器或网络的问题造成视频无法加载
4280
+ * @solution
4281
+ * 1. 检查浏览器视频数据请求是否正常;
4282
+ * 2. 检查浏览器和页面环境是否支持要播放的视频格式;
4283
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4284
+ */
4285
+ /** {en}
4286
+ * @brief The video cannot be loaded due to unsupported video format or server or network issues.
4287
+ * @solution
4288
+ * 1. Check whether there is any issue with the browser's request.
4289
+ * 2. Check whether the browser and the current page support the video format.
4290
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
4291
+ */
4292
+ MEDIA_ERR_SRC_NOT_SUPPORTED = 5104,
4293
+ /** {zh}
4294
+ * @brief 当前浏览器不支持视频解码
4295
+ * @solution
4296
+ * 1. 检查浏览器视频数据请求是否正常;
4297
+ * 2. 检查浏览器和页面环境是否支持要播放的视频格式;
4298
+ * 3. 如仍未解决请联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4299
+ */
4300
+ /** {en}
4301
+ * @brief The current browser does not support video decoding.
4302
+ * @solution
4303
+ * 1. Check whether there is any issue with the browser's request.
4304
+ * 2. Check whether the browser and the current page support the video format.
4305
+ * 3. If the error persists, please contact your [technical support](https://www.byteplus.com/en/support).
4306
+ */
4307
+ MEDIA_ERR_CODEC_NOT_SUPPORTED = 5105,
4308
+ /** {zh}
4309
+ * @brief 当前播放地址为空
4310
+ * @solution 请检查必要参数 `url` 或 `playlist` 是否传入。
4311
+ */
4312
+ /** {en}
4313
+ * @brief The current pull stream address is empty.
4314
+ * @solution Check whether 'url' or 'playlist' is specified.
4315
+ */
4316
+ MEDIA_ERR_URL_EMPTY = 5106,
4317
+ /** {zh}
4318
+ * @brief 播放异常
4319
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4320
+ */
4321
+ /** {en}
4322
+ * @brief A playback issue occurred.
4323
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4324
+ */
4325
+ MEDIA_MSE_ADD_SB = 5200,
4326
+ /** {zh}
4327
+ * @brief 播放异常
4328
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4329
+ */
4330
+ /** {en}
4331
+ * @brief A playback issue occurred.
4332
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4333
+ */
4334
+ MEDIA_MSE_APPEND_BUFFER = 5201,
4335
+ /** {zh}
4336
+ * @brief 播放异常
4337
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4338
+ */
4339
+ /** {en}
4340
+ * @brief A playback issue occurred.
4341
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4342
+ */
4343
+ MEDIA_MSE_OTHER = 5202,
4344
+ /** {zh}
4345
+ * @brief 播放异常
4346
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4347
+ */
4348
+ /** {en}
4349
+ * @brief A playback issue occurred.
4350
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4351
+ */
4352
+ MEDIA_MSE_FULL = 5203,
4353
+ /** {zh}
4354
+ * @brief 播放异常
4355
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4356
+ */
4357
+ /** {en}
4358
+ * @brief A playback issue occurred.
4359
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4360
+ */
4361
+ MEDIA_MSE_HIJACK = 5204,
4362
+ /** {zh}
4363
+ * @brief 播放异常
4364
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4365
+ */
4366
+ /** {en}
4367
+ * @brief A playback issue occurred.
4368
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4369
+ */
4370
+ MEDIA_EME_HIJACK = 5301,
4371
+ /** {zh}
4372
+ * @brief DRM 权限校验失败
4373
+ * @hidden
4374
+ */
4375
+ /** {en}
4376
+ * @brief DRM authentication failed.
4377
+ * @hidden
4378
+ */
4379
+ DRM_LICENSE = 7100,
4380
+ /** {zh}
4381
+ * @brief DRM 权限校验失败
4382
+ * @hidden
4383
+ */
4384
+ /** {en}
4385
+ * @brief DRM authentication failed.
4386
+ * @hidden
4387
+ */
4388
+ DRM_CUSTOM_LICENSE = 7200,
4389
+ /** {zh}
4390
+ * @brief 播放异常
4391
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4392
+ */
4393
+ /** {en}
4394
+ * @brief A playback issue occurred.
4395
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4396
+ */
4397
+ OTHER = 8000,
4398
+ /** {zh}
4399
+ * @brief 播放异常
4400
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4401
+ */
4402
+ /** {en}
4403
+ * @brief A playback issue occurred.
4404
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4405
+ */
4406
+ RUNTIME_NO_CANPLAY_ERROR = 9001,
4407
+ /** {zh}
4408
+ * @brief 播放异常
4409
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4410
+ */
4411
+ /** {en}
4412
+ * @brief A playback issue occurred.
4413
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4414
+ */
4415
+ RUNTIME_BUFFERBREAK_ERROR = 9002,
4416
+ /** {zh}
4417
+ * @brief 播放异常
4418
+ * @solution 请检查播放源或联系[技术支持](https://console.volcengine.com/workorder/create?step=2&SubProductID=P00000076)。
4419
+ */
4420
+ /** {en}
4421
+ * @brief A playback issue occurred.
4422
+ * @solution Check the live stream source or contact your [technical support](https://www.byteplus.com/en/support).
4423
+ */
4424
+ RUNTIME_BWAITING_TIMEOUT_ERROR = 9002,
4425
+ // veplayer 报错
4426
+ /** {zh}
4427
+ * @brief CDN 异步获取失败
4428
+ * @solution 请刷新重试或者检查网络环境。
4429
+ *
4430
+ */
4431
+ /** {en}
4432
+ * @brief CDN asynchronous fetch failed.
4433
+ * @solution Refresh the page or check the network environment.
4434
+ *
4435
+ */
4436
+ MODULE_LOAD_ERROR = 110,
4437
+ /** {zh}
4438
+ * @hidden
4439
+ */
4440
+ /** {en}
4441
+ * @hidden
4442
+ */
4443
+ UNKNOWN = "UNKNOWN"
4444
+ }
4445
+ enum ErrorType {
4446
+ MANIFEST = "manifest",
4447
+ NETWORK = "network",
4448
+ DEMUX = "demux",
4449
+ REMUX = "remux",
4450
+ MEDIA = "media",
4451
+ DRM = "drm",
4452
+ OTHER = "other",
4453
+ RUNTIME = "runtime"
4454
+ }
4455
+ interface ErrorInfo<T = TextKey> {
4456
+ errorCode?: ErrorCode;
4457
+ message?: string;
4458
+ messageTextKey?: T;
4459
+ level?: Level;
4460
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4461
+ ext?: any;
4462
+ error?: Error;
4463
+ }
4464
+ const ERROR_INFO: Partial<Record<ErrorCode, ErrorInfo>>;
4465
+ const ERROR_TYPE_INFO: Record<ErrorType, ErrorInfo>;
4466
+ /** {zh}
4467
+ * @list error
4468
+ * @detail error
4469
+ * @brief 错误对象
4470
+ * @name VeError
4471
+ * @id VeError
4472
+ */
4473
+ /** {en}
4474
+ * @list error
4475
+ * @detail error
4476
+ * @brief The error object.
4477
+ * @name VeError
4478
+ * @id VeError
4479
+ */
4480
+ class VeError<T extends string = TextKey> extends Error {
4481
+ /**
4482
+ * @brief 错误码。
4483
+ */
4484
+ /** {en}
4485
+ * @brief The error code.
4486
+ */
4487
+ readonly errorCode: ErrorCode;
4488
+ /** {zh}
4489
+ * @brief 错误等级。
4490
+ */
4491
+ /** {en}
4492
+ * @brief The error level.
4493
+ */
4494
+ readonly level?: Level;
4495
+ /** {zh}
4496
+ * @brief 错误信息。
4497
+ */
4498
+ /** {en}
4499
+ * @brief The error message.
4500
+ */
4501
+ message: string;
4502
+ /** {zh}
4503
+ * @brief 其他错误信息。
4504
+ */
4505
+ /** {en}
4506
+ * @brief Other error messages.
4507
+ */
4508
+ readonly ext?: any;
4509
+ /** {zh}
4510
+ * @hidden
4511
+ * @param error
4512
+ * @param i18n
4513
+ */
4514
+ /** {en}
4515
+ * @hidden
4516
+ * @param error
4517
+ * @param i18n
4518
+ */
4519
+ constructor(error?: string | ErrorInfo<T>, i18n?: VeI18n<T>);
4520
+ }
4521
+ function create(errorCode: ErrorCode, info?: ErrorInfo, i18n?: VeI18n): VeError<"DEFINITION_FALLBACK_TOAST" | "DEFINITION_SWITCHING" | "ERROR_REFRESH" | "UNMUTE" | "MANIFEST" | "NETWORK" | "NETWORK_TIMEOUT" | "NETWORK_FORBIDDEN" | "NETWORK_NOTFOUND" | "DEMUX" | "REMUX" | "MEDIA" | "MEDIA_ERR_CODEC_NOT_SUPPORTED" | "MEDIA_ERR_URL_EMPTY" | "DRM" | "DRM_LICENSE" | "OTHER" | "RUNTIME" | "MODULE_LOAD_ERROR" | "UNKNOWN" | "ERROR_TYPES" | "HAVE_NOTHING" | "HAVE_METADATA" | "HAVE_CURRENT_DATA" | "HAVE_FUTURE_DATA" | "HAVE_ENOUGH_DATA" | "NETWORK_EMPTY" | "NETWORK_IDLE" | "NETWORK_LOADING" | "NETWORK_NO_SOURCE" | "MEDIA_ERR_ABORTED" | "MEDIA_ERR_NETWORK" | "MEDIA_ERR_DECODE" | "MEDIA_ERR_SRC_NOT_SUPPORTED" | "REPLAY" | "ERROR" | "PLAY_TIPS" | "PAUSE_TIPS" | "PLAYNEXT_TIPS" | "DOWNLOAD_TIPS" | "ROTATE_TIPS" | "RELOAD_TIPS" | "FULLSCREEN_TIPS" | "EXITFULLSCREEN_TIPS" | "CSSFULLSCREEN_TIPS" | "EXITCSSFULLSCREEN_TIPS" | "TEXTTRACK" | "PIP" | "SCREENSHOT" | "LIVE" | "OFF" | "OPEN" | "MINI_DRAG" | "MINISCREEN" | "REFRESH_TIPS" | "REFRESH" | "FORWARD" | "LIVE_TIP">;
4522
+ function transform(xgErr: XGError, i18n?: VeI18n): VeError<"DEFINITION_FALLBACK_TOAST" | "DEFINITION_SWITCHING" | "ERROR_REFRESH" | "UNMUTE" | "MANIFEST" | "NETWORK" | "NETWORK_TIMEOUT" | "NETWORK_FORBIDDEN" | "NETWORK_NOTFOUND" | "DEMUX" | "REMUX" | "MEDIA" | "MEDIA_ERR_CODEC_NOT_SUPPORTED" | "MEDIA_ERR_URL_EMPTY" | "DRM" | "DRM_LICENSE" | "OTHER" | "RUNTIME" | "MODULE_LOAD_ERROR" | "UNKNOWN" | "ERROR_TYPES" | "HAVE_NOTHING" | "HAVE_METADATA" | "HAVE_CURRENT_DATA" | "HAVE_FUTURE_DATA" | "HAVE_ENOUGH_DATA" | "NETWORK_EMPTY" | "NETWORK_IDLE" | "NETWORK_LOADING" | "NETWORK_NO_SOURCE" | "MEDIA_ERR_ABORTED" | "MEDIA_ERR_NETWORK" | "MEDIA_ERR_DECODE" | "MEDIA_ERR_SRC_NOT_SUPPORTED" | "REPLAY" | "ERROR" | "PLAY_TIPS" | "PAUSE_TIPS" | "PLAYNEXT_TIPS" | "DOWNLOAD_TIPS" | "ROTATE_TIPS" | "RELOAD_TIPS" | "FULLSCREEN_TIPS" | "EXITFULLSCREEN_TIPS" | "CSSFULLSCREEN_TIPS" | "EXITCSSFULLSCREEN_TIPS" | "TEXTTRACK" | "PIP" | "SCREENSHOT" | "LIVE" | "OFF" | "OPEN" | "MINI_DRAG" | "MINISCREEN" | "REFRESH_TIPS" | "REFRESH" | "FORWARD" | "LIVE_TIP">;
4523
+ }
4524
+ declare namespace event {
4525
+ const BaseEvents: {
4526
+ SEI: string;
4527
+ PLAYER_CREATE_FINISH: string;
4528
+ FALLBACK_ERROR: string;
4529
+ FALLBACK: string;
4530
+ AUTOPLAY_STARTED: string;
4531
+ AUTOPLAY_PREVENTED: string;
4532
+ DOWNLOAD_SPEED_CHANGE: string;
4533
+ FULLSCREEN_CHANGE: string;
4534
+ CSS_FULLSCREEN_CHANGE: string;
4535
+ MINI_STATE_CHANGE: string;
4536
+ DEFINITION_CHANGE: string;
4537
+ BEFORE_DEFINITION_CHANGE: string;
4538
+ AFTER_DEFINITION_CHANGE: string;
4539
+ VIDEO_RESIZE: string;
4540
+ PIP_CHANGE: string;
4541
+ USER_ACTION: string;
4542
+ AUTOPLAY_UNMUTE: string;
4543
+ LONG_WAITING: string;
4544
+ DEFINITION_FALLBACK: string;
4545
+ AUTOPLAY_FAIL: string;
4546
+ AUTOPLAY_SUCCESS: string;
4547
+ ERROR_REFRESH_CLICK: string;
4548
+ SOURCE_CHANGE: string;
4549
+ };
4550
+ const Events: {
4551
+ SEI: string;
4552
+ PLAYER_CREATE_FINISH: string;
4553
+ FALLBACK_ERROR: string;
4554
+ FALLBACK: string;
4555
+ AUTOPLAY_STARTED: string;
4556
+ AUTOPLAY_PREVENTED: string;
4557
+ DOWNLOAD_SPEED_CHANGE: string;
4558
+ FULLSCREEN_CHANGE: string;
4559
+ CSS_FULLSCREEN_CHANGE: string;
4560
+ MINI_STATE_CHANGE: string;
4561
+ DEFINITION_CHANGE: string;
4562
+ BEFORE_DEFINITION_CHANGE: string;
4563
+ AFTER_DEFINITION_CHANGE: string;
4564
+ VIDEO_RESIZE: string;
4565
+ PIP_CHANGE: string;
4566
+ USER_ACTION: string;
4567
+ AUTOPLAY_UNMUTE: string;
4568
+ LONG_WAITING: string;
4569
+ DEFINITION_FALLBACK: string;
4570
+ AUTOPLAY_FAIL: string;
4571
+ AUTOPLAY_SUCCESS: string;
4572
+ ERROR_REFRESH_CLICK: string;
4573
+ SOURCE_CHANGE: string;
4574
+ REPLAY: string;
4575
+ ERROR: string;
4576
+ PLAY: string;
4577
+ PLAYING: string;
4578
+ ENDED: string;
4579
+ PAUSE: string;
4580
+ SEEKING: string;
4581
+ SEEKED: string;
4582
+ TIME_UPDATE: string;
4583
+ WAITING: string;
4584
+ CANPLAY: string;
4585
+ CANPLAY_THROUGH: string;
4586
+ DURATION_CHANGE: string;
4587
+ VOLUME_CHANGE: string;
4588
+ LOADED_DATA: string;
4589
+ LOADED_METADATA: string;
4590
+ RATE_CHANGE: string;
4591
+ PROGRESS: string;
4592
+ LOAD_START: string;
4593
+ EMPTIED: string;
4594
+ STALLED: string;
4595
+ SUSPEND: string;
4596
+ ABORT: string;
4597
+ BUFFER_CHANGE: string;
4598
+ PLAYER_FOCUS: string;
4599
+ PLAYER_BLUR: string;
4600
+ READY: string;
4601
+ URL_NULL: string;
4602
+ COMPLETE: string;
4603
+ DESTROY: string;
4604
+ URL_CHANGE: string;
4605
+ SEI_PARSED: string;
4606
+ RETRY: string;
4607
+ ROTATE: string;
4608
+ SCREEN_SHOT: string;
4609
+ PLAYNEXT: string;
4610
+ SHORTCUT: string;
4611
+ XGLOG: string;
4612
+ RESET: string;
4613
+ SOURCE_ERROR: string;
4614
+ SOURCE_SUCCESS: string;
4615
+ SWITCH_SUBTITLE: string;
4616
+ VIDEO_EVENTS: string;
4617
+ STATS_EVENTS: string;
4618
+ FPS_STUCK: string;
4619
+ };
4620
+ function transform(event: string, callback?: (data?: any) => void): {
4621
+ xgEventName: string;
4622
+ xgCallback: ((...args: any) => void) | undefined;
4623
+ };
4624
+ }
4625
+ interface VodVePlayerOptions {
4626
+ plugins: any[];
4627
+ }
4628
+ declare function createVodPlayer(options?: VodVePlayerOptions): Promise<VePlayerBase>;
4629
+ export { load, register, createVodPlayer };