@volcengine/veplayer 1.6.5-rc.0 → 2.0.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.
- package/README.md +3 -45
- package/esm/index.d.ts +1405 -0
- package/esm/veplayer.biz.live.development.css +41 -0
- package/esm/veplayer.biz.live.development.js +3157 -0
- package/esm/veplayer.biz.live.production.css +1 -0
- package/esm/veplayer.biz.live.production.js +2 -0
- package/esm/veplayer.biz.vod.development.js +13 -0
- package/esm/veplayer.biz.vod.production.js +2 -0
- package/esm/veplayer.d.ts +3071 -0
- package/esm/veplayer.development.css +743 -0
- package/esm/veplayer.development.js +21023 -0
- package/esm/veplayer.live.d.ts +3074 -0
- package/esm/veplayer.live.development.css +743 -0
- package/esm/veplayer.live.development.js +21022 -0
- package/esm/veplayer.live.production.css +1 -0
- package/esm/veplayer.live.production.js +11 -0
- package/esm/veplayer.production.css +1 -0
- package/esm/veplayer.production.js +11 -0
- package/esm/veplayer.vod.d.ts +1405 -0
- package/esm/veplayer.vod.development.css +702 -0
- package/esm/veplayer.vod.development.js +13104 -0
- package/esm/veplayer.vod.production.css +1 -0
- package/esm/veplayer.vod.production.js +11 -0
- package/package.json +78 -6
- package/umd/index.d.ts +1405 -0
- package/umd/veplayer.biz.live.development.css +41 -0
- package/umd/veplayer.biz.live.development.js +3169 -0
- package/umd/veplayer.biz.live.production.css +1 -0
- package/umd/veplayer.biz.live.production.js +1 -0
- package/umd/veplayer.biz.vod.development.js +29 -0
- package/umd/veplayer.biz.vod.production.js +1 -0
- package/umd/veplayer.d.ts +3071 -0
- package/umd/veplayer.development.css +743 -0
- package/umd/veplayer.development.js +21026 -0
- package/umd/veplayer.live.d.ts +3074 -0
- package/umd/veplayer.live.development.css +743 -0
- package/umd/veplayer.live.development.js +21034 -0
- package/umd/veplayer.live.production.css +1 -0
- package/umd/veplayer.live.production.js +1 -0
- package/umd/veplayer.production.css +1 -0
- package/umd/veplayer.production.js +1 -0
- package/umd/veplayer.vod.d.ts +1405 -0
- package/umd/veplayer.vod.development.css +702 -0
- package/umd/veplayer.vod.development.js +13119 -0
- package/umd/veplayer.vod.production.css +1 -0
- package/umd/veplayer.vod.production.js +1 -0
- package/index.d.ts +0 -3256
- package/index.min.css +0 -1
- package/index.min.js +0 -2
|
@@ -0,0 +1,1405 @@
|
|
|
1
|
+
import { default as XGPlayer } from "xgplayer/es/player";
|
|
2
|
+
import { IPlayerOptions as PlayerOptions } from "xgplayer/es/player";
|
|
3
|
+
import Player from "xgplayer";
|
|
4
|
+
import { IXGI18nText, IPluginOptions, Plugin } from "xgplayer";
|
|
5
|
+
import { IDefinition as XGDefinition } from "xgplayer";
|
|
6
|
+
import { IError as XGError } from "xgplayer";
|
|
7
|
+
import { default as Player$0 } 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 { FlvOption } from "xgplayer-flv/es/flv/options";
|
|
13
|
+
import { HlsOption } from "xgplayer-hls/es/hls/config";
|
|
14
|
+
declare const EN: {
|
|
15
|
+
DEFINITION_FALLBACK_TOAST: string;
|
|
16
|
+
DEFINITION_SWITCHING: string;
|
|
17
|
+
ERROR_REFRESH: string;
|
|
18
|
+
UNMUTE: string;
|
|
19
|
+
MANIFEST: string;
|
|
20
|
+
NETWORK: string;
|
|
21
|
+
NETWORK_TIMEOUT: string;
|
|
22
|
+
NETWORK_FORBIDDEN: string;
|
|
23
|
+
NETWORK_NOTFOUND: string;
|
|
24
|
+
DEMUX: string;
|
|
25
|
+
REMUX: string;
|
|
26
|
+
MEDIA: string;
|
|
27
|
+
MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
|
|
28
|
+
MEDIA_ERR_URL_EMPTY: string;
|
|
29
|
+
DRM: 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(): any;
|
|
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
|
+
next(): DefinitionUrl;
|
|
111
|
+
}
|
|
112
|
+
interface ExposedDefinition {
|
|
113
|
+
url: string;
|
|
114
|
+
definition: string;
|
|
115
|
+
text?: Record<Lang, string> | string;
|
|
116
|
+
fallbackUrls?: string[];
|
|
117
|
+
}
|
|
118
|
+
interface ExposedSource {
|
|
119
|
+
name?: string;
|
|
120
|
+
text?: Record<Lang, string> | string;
|
|
121
|
+
definitions: Array<ExposedDefinition | string>;
|
|
122
|
+
}
|
|
123
|
+
interface CompoundSources {
|
|
124
|
+
sources?: ExposedSource[];
|
|
125
|
+
url?: string;
|
|
126
|
+
fallbackUrls?: string[];
|
|
127
|
+
}
|
|
128
|
+
declare class Source {
|
|
129
|
+
readonly name?: string;
|
|
130
|
+
readonly text?: Record<Lang, string> | string;
|
|
131
|
+
readonly definitions: Array<Definition & {
|
|
132
|
+
source: Source;
|
|
133
|
+
}>;
|
|
134
|
+
private constructor();
|
|
135
|
+
get defaultDefinition(): Definition & {
|
|
136
|
+
source: Source;
|
|
137
|
+
};
|
|
138
|
+
static normalize(input: CompoundSources | ExposedSource[] | string): Source[];
|
|
139
|
+
private static normalizeUrl;
|
|
140
|
+
add(definition: Definition): void;
|
|
141
|
+
}
|
|
142
|
+
declare enum TOP_RIGHT_POSITIONS {
|
|
143
|
+
ROOT_TOP_RIGHT = "rootTopRight",
|
|
144
|
+
ROOT_TOP_RIGHT_COLLAPSE = "rootTopRightCollapse"
|
|
145
|
+
}
|
|
146
|
+
interface Config {
|
|
147
|
+
listType: ListTypeOption;
|
|
148
|
+
isAutoChange?: boolean;
|
|
149
|
+
onItemClick?: (e: Event, data: CallbackData) => void;
|
|
150
|
+
onOptionClick?: (e: Event, data: CallbackData) => void;
|
|
151
|
+
hide?: () => void;
|
|
152
|
+
list?: ListItem[];
|
|
153
|
+
panel?: {
|
|
154
|
+
className?: string;
|
|
155
|
+
title?: string | Record<Lang, string>;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
interface Options {
|
|
159
|
+
config: Config;
|
|
160
|
+
root: HTMLElement | null;
|
|
161
|
+
player: Player;
|
|
162
|
+
}
|
|
163
|
+
declare class MobilePlayerPanel {
|
|
164
|
+
private _root?;
|
|
165
|
+
private _config;
|
|
166
|
+
private _parent;
|
|
167
|
+
private _listDom?;
|
|
168
|
+
private _container?;
|
|
169
|
+
private _titleDom?;
|
|
170
|
+
private _player;
|
|
171
|
+
private _delegates?;
|
|
172
|
+
private _listType?;
|
|
173
|
+
constructor(args: Options);
|
|
174
|
+
changeMode(listType: ListTypeOption): void;
|
|
175
|
+
// 渲染选择列表
|
|
176
|
+
renderItemList(data?: ListItem[]): HTMLElement;
|
|
177
|
+
// 渲染panel的标题
|
|
178
|
+
renderTitle(): HTMLElement | undefined;
|
|
179
|
+
updatePanel(listType: ListTypeOption): void;
|
|
180
|
+
// 渲染panel
|
|
181
|
+
renderPanel(): void;
|
|
182
|
+
show(): void;
|
|
183
|
+
hide(): void;
|
|
184
|
+
destroy(): void;
|
|
185
|
+
private _bind;
|
|
186
|
+
private _unbind;
|
|
187
|
+
private _initEvents;
|
|
188
|
+
private _unbindEvents;
|
|
189
|
+
private _handleOrientationChange;
|
|
190
|
+
private _bindDomEvent;
|
|
191
|
+
private _unbindDomEvent;
|
|
192
|
+
private _stopPropagation;
|
|
193
|
+
private _onItemClick;
|
|
194
|
+
private _handleHide;
|
|
195
|
+
}
|
|
196
|
+
declare module MobilePlayerPanelWrapper {
|
|
197
|
+
export { MobilePlayerPanel };
|
|
198
|
+
}
|
|
199
|
+
import MobilePanel = MobilePlayerPanelWrapper.MobilePlayerPanel;
|
|
200
|
+
declare const ListType: {
|
|
201
|
+
readonly Middle: "middle";
|
|
202
|
+
readonly Bottom: "bottom";
|
|
203
|
+
readonly Fullscreen: "fullscreen";
|
|
204
|
+
readonly Inner: "inner";
|
|
205
|
+
};
|
|
206
|
+
type ListTypeOption = (typeof ListType)[keyof typeof ListType];
|
|
207
|
+
interface ListItem {
|
|
208
|
+
[key: string]: any;
|
|
209
|
+
selected?: boolean;
|
|
210
|
+
className?: string;
|
|
211
|
+
showText?: string | HTMLElement;
|
|
212
|
+
text?: string | Record<Lang, string>;
|
|
213
|
+
iconText?: string | Record<Lang, string>;
|
|
214
|
+
}
|
|
215
|
+
type CallbackData = {
|
|
216
|
+
to?: ListItem;
|
|
217
|
+
from?: ListItem;
|
|
218
|
+
};
|
|
219
|
+
declare const enum RenderType {
|
|
220
|
+
Icon = "Icon",
|
|
221
|
+
Text = "Text"
|
|
222
|
+
}
|
|
223
|
+
type Config$0<T> = {
|
|
224
|
+
[key: string]: any;
|
|
225
|
+
// 【xg】顺序
|
|
226
|
+
index?: number;
|
|
227
|
+
// 【xg】展示的选择列表
|
|
228
|
+
list?: Array<T>;
|
|
229
|
+
// 【xg】竖屏
|
|
230
|
+
hidePortrait?: boolean;
|
|
231
|
+
// 【xg】列表点击之后是否隐藏列表
|
|
232
|
+
isItemClickHide?: boolean;
|
|
233
|
+
className?: string;
|
|
234
|
+
// 【xg】是否展示已选择的
|
|
235
|
+
isShowIcon?: boolean;
|
|
236
|
+
// 【xg 扩展】列表渲染样式类型
|
|
237
|
+
listType?: ListTypeOption;
|
|
238
|
+
// 已选择的展示类型(文案 or icon)
|
|
239
|
+
renderType?: RenderType;
|
|
240
|
+
// 列表数据只有一个是否展示
|
|
241
|
+
hideOnSingleOption?: boolean;
|
|
242
|
+
// 横屏的时候是否切换mode
|
|
243
|
+
isAutoChange?: boolean;
|
|
244
|
+
// 自定义组件 mobilePanel的配置
|
|
245
|
+
panel?: {
|
|
246
|
+
className?: string;
|
|
247
|
+
// panel 的标题
|
|
248
|
+
title?: string | Record<Lang, string>;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
declare enum Codec {
|
|
252
|
+
H265 = "h265",
|
|
253
|
+
H264 = "h264"
|
|
254
|
+
}
|
|
255
|
+
declare enum Degradation {
|
|
256
|
+
SoftFirst = "soft-first",
|
|
257
|
+
H264First = "h264-first"
|
|
258
|
+
}
|
|
259
|
+
declare enum DecodeType {
|
|
260
|
+
Software = "software",
|
|
261
|
+
Hardware = "hardware"
|
|
262
|
+
}
|
|
263
|
+
type PrepareResult = {
|
|
264
|
+
options?: Partial<VePlayerBaseOptions>;
|
|
265
|
+
plugins?: any[];
|
|
266
|
+
};
|
|
267
|
+
type PreparePlugins = (url: string) => Promise<PrepareResult> | undefined;
|
|
268
|
+
type Constructor<T> = new (...args: any[]) => T;
|
|
269
|
+
interface VePlayerBaseOptions extends Omit<PlayerOptions, "autoplay" | "i18n"> {
|
|
270
|
+
url?: string;
|
|
271
|
+
id?: string;
|
|
272
|
+
el?: HTMLElement;
|
|
273
|
+
codec?: Codec;
|
|
274
|
+
fallbackUrls?: string[];
|
|
275
|
+
maxFallbackRound?: number;
|
|
276
|
+
degradation?: Degradation | boolean;
|
|
277
|
+
decodeType?: DecodeType;
|
|
278
|
+
poster?: string;
|
|
279
|
+
defaultSource?: string;
|
|
280
|
+
defaultDefinition?: string;
|
|
281
|
+
preparePlugins?: PreparePlugins;
|
|
282
|
+
autoplay?: {
|
|
283
|
+
muted: boolean;
|
|
284
|
+
} | boolean;
|
|
285
|
+
playlist?: ExposedSource[];
|
|
286
|
+
listType?: ListTypeOption;
|
|
287
|
+
flv?: Partial<FlvOption>;
|
|
288
|
+
hls?: Partial<HlsOption> & {
|
|
289
|
+
enableMSE?: boolean;
|
|
290
|
+
};
|
|
291
|
+
i18n?: {
|
|
292
|
+
texts: Record<Lang, Record<string, string>>;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
declare class VePlayerBase {
|
|
296
|
+
protected readonly _player: XGPlayer;
|
|
297
|
+
private readonly _sourceManager;
|
|
298
|
+
private readonly _preparePlugins?;
|
|
299
|
+
private _previousPrepareResult?;
|
|
300
|
+
private _i18nManager;
|
|
301
|
+
private _events;
|
|
302
|
+
private _errorCallback;
|
|
303
|
+
constructor(options?: VePlayerBaseOptions);
|
|
304
|
+
get readyState(): 0 | 2 | 1 | 4 | 3;
|
|
305
|
+
get buffered(): TimeRanges;
|
|
306
|
+
get played(): TimeRanges;
|
|
307
|
+
get cumulateTime(): number;
|
|
308
|
+
get isFocused(): boolean;
|
|
309
|
+
get isFullscreen(): boolean;
|
|
310
|
+
get isCssFullscreen(): boolean;
|
|
311
|
+
get networkState(): 0 | 2 | 1 | 3;
|
|
312
|
+
get paused(): boolean;
|
|
313
|
+
get ended(): boolean;
|
|
314
|
+
get state(): number;
|
|
315
|
+
get url(): any;
|
|
316
|
+
get source(): string | undefined;
|
|
317
|
+
get definition(): string;
|
|
318
|
+
get crossOrigin(): string;
|
|
319
|
+
set crossOrigin(crossOrigin: string);
|
|
320
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
321
|
+
get volume(): number;
|
|
322
|
+
set volume(volume: number);
|
|
323
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
324
|
+
get muted(): boolean;
|
|
325
|
+
set muted(isMuted: boolean);
|
|
326
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
327
|
+
get lang(): Lang;
|
|
328
|
+
set lang(lang: Lang);
|
|
329
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
330
|
+
protected get _src(): string;
|
|
331
|
+
static create<T extends VePlayerBase>(options?: VePlayerBaseOptions, Constructor?: Constructor<T>): Promise<T>;
|
|
332
|
+
switch(target: string | {
|
|
333
|
+
definition?: string;
|
|
334
|
+
source?: string;
|
|
335
|
+
}, options?: {
|
|
336
|
+
fallbackToFirstDefinition?: boolean;
|
|
337
|
+
}): Promise<Definition>;
|
|
338
|
+
updatePlaylist(playlist: ExposedSource[] | string, target?: string | {
|
|
339
|
+
definition?: string;
|
|
340
|
+
source?: string;
|
|
341
|
+
}): Promise<void>;
|
|
342
|
+
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
343
|
+
once(event: string, callback: (data?: any) => any, ...args: any[]): void;
|
|
344
|
+
off(event: string, callback: (data?: any) => any, ...args: any[]): void;
|
|
345
|
+
emit(event: string, data?: any, ...args: any[]): void;
|
|
346
|
+
offAll(): void;
|
|
347
|
+
on(event: string, callback: (data?: any) => any, ...args: any[]): void;
|
|
348
|
+
play(): any;
|
|
349
|
+
pause(): void;
|
|
350
|
+
requestPIP(): void;
|
|
351
|
+
exitPIP(): void;
|
|
352
|
+
retry(): void;
|
|
353
|
+
focus(data?: {
|
|
354
|
+
autoHide?: boolean;
|
|
355
|
+
delay?: number;
|
|
356
|
+
}): void;
|
|
357
|
+
blur(data?: {
|
|
358
|
+
ignorePaused?: boolean;
|
|
359
|
+
}): void;
|
|
360
|
+
getFullscreen(el?: HTMLElement): Promise<void>;
|
|
361
|
+
exitFullscreen(el?: HTMLElement): Promise<void>;
|
|
362
|
+
getCssFullscreen(el?: HTMLElement): void;
|
|
363
|
+
exitCssFullscreen(): void;
|
|
364
|
+
registerPlugin(plugin:
|
|
365
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
366
|
+
Function | {
|
|
367
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
368
|
+
plugin: Function;
|
|
369
|
+
options: object;
|
|
370
|
+
}, config?: {
|
|
371
|
+
[propName: string]: any;
|
|
372
|
+
}): any;
|
|
373
|
+
unRegisterPlugin(plugin: any, removedFromConfig?: boolean): void;
|
|
374
|
+
// 显示插件
|
|
375
|
+
showIcon(pluginNames: string[]): void;
|
|
376
|
+
// 隐藏插件显示
|
|
377
|
+
hideIcon(pluginNames: string[]): void;
|
|
378
|
+
destroy(): void;
|
|
379
|
+
prepare(url: string): Promise<any[]>;
|
|
380
|
+
private _handleFallback;
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
382
|
+
private _transformEvent;
|
|
383
|
+
private _switch;
|
|
384
|
+
private _switchUrl;
|
|
385
|
+
// 获取需要卸载和需要注册的播放插件
|
|
386
|
+
private _diffPlugins;
|
|
387
|
+
private _callBeforePlayerInitForUrl;
|
|
388
|
+
}
|
|
389
|
+
declare const enum State {
|
|
390
|
+
Fetching = 0,
|
|
391
|
+
Ready = 1,
|
|
392
|
+
Error = 2
|
|
393
|
+
}
|
|
394
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
395
|
+
type Exports = Record<string, any>;
|
|
396
|
+
interface Module {
|
|
397
|
+
src: string;
|
|
398
|
+
state: State;
|
|
399
|
+
name: string;
|
|
400
|
+
exports: Exports;
|
|
401
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
402
|
+
error?: any;
|
|
403
|
+
}
|
|
404
|
+
type ModuleSystem = "esm" | "umd";
|
|
405
|
+
interface LoaderOptions {
|
|
406
|
+
baseUrl: string;
|
|
407
|
+
}
|
|
408
|
+
declare enum DynamicModule {
|
|
409
|
+
BizVod = "biz:vod",
|
|
410
|
+
BizLive = "biz:live",
|
|
411
|
+
PluginFlv = "plugin:flv",
|
|
412
|
+
PluginMp4 = "plugin:mp4",
|
|
413
|
+
PluginHls = "plugin:hls",
|
|
414
|
+
PluginShaka = "plugin:shaka",
|
|
415
|
+
PluginRtm = "plugin:rtm",
|
|
416
|
+
PluginXgvideo = "plugin:xgvideo"
|
|
417
|
+
}
|
|
418
|
+
type ModulesMap = {
|
|
419
|
+
[DynamicModule.BizVod]: Exports;
|
|
420
|
+
[DynamicModule.BizLive]: Exports;
|
|
421
|
+
[DynamicModule.PluginFlv]: Exports;
|
|
422
|
+
[DynamicModule.PluginMp4]: Exports;
|
|
423
|
+
[DynamicModule.PluginHls]: Exports;
|
|
424
|
+
[DynamicModule.PluginShaka]: Exports;
|
|
425
|
+
[DynamicModule.PluginRtm]: Exports;
|
|
426
|
+
[DynamicModule.PluginXgvideo]: Exports;
|
|
427
|
+
};
|
|
428
|
+
declare const register: (name: string, exports: {
|
|
429
|
+
[x: string]: any;
|
|
430
|
+
}) => {
|
|
431
|
+
[x: string]: any;
|
|
432
|
+
};
|
|
433
|
+
declare function load<T extends DynamicModule>(name: T, src?: string): Promise<ModulesMap[T]>;
|
|
434
|
+
declare module MobilePlayerPanelWrapper {
|
|
435
|
+
export { MobilePlayerPanel };
|
|
436
|
+
}
|
|
437
|
+
declare namespace strategy {
|
|
438
|
+
const EN: {
|
|
439
|
+
DEFINITION_FALLBACK_TOAST: string;
|
|
440
|
+
DEFINITION_SWITCHING: string;
|
|
441
|
+
ERROR_REFRESH: string;
|
|
442
|
+
UNMUTE: string;
|
|
443
|
+
MANIFEST: string;
|
|
444
|
+
NETWORK: string;
|
|
445
|
+
NETWORK_TIMEOUT: string;
|
|
446
|
+
NETWORK_FORBIDDEN: string;
|
|
447
|
+
NETWORK_NOTFOUND: string;
|
|
448
|
+
DEMUX: string;
|
|
449
|
+
REMUX: string;
|
|
450
|
+
MEDIA: string;
|
|
451
|
+
MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
|
|
452
|
+
MEDIA_ERR_URL_EMPTY: string;
|
|
453
|
+
DRM: string;
|
|
454
|
+
OTHER: string;
|
|
455
|
+
RUNTIME: string;
|
|
456
|
+
MODULE_LOAD_ERROR: string;
|
|
457
|
+
UNKNOWN: string;
|
|
458
|
+
ERROR_TYPES: typeof XG_EN.TEXT.ERROR_TYPES;
|
|
459
|
+
HAVE_NOTHING: string;
|
|
460
|
+
HAVE_METADATA: string;
|
|
461
|
+
HAVE_CURRENT_DATA: string;
|
|
462
|
+
HAVE_FUTURE_DATA: string;
|
|
463
|
+
HAVE_ENOUGH_DATA: string;
|
|
464
|
+
NETWORK_EMPTY: string;
|
|
465
|
+
NETWORK_IDLE: string;
|
|
466
|
+
NETWORK_LOADING: string;
|
|
467
|
+
NETWORK_NO_SOURCE: string;
|
|
468
|
+
MEDIA_ERR_ABORTED: string;
|
|
469
|
+
MEDIA_ERR_NETWORK: string;
|
|
470
|
+
MEDIA_ERR_DECODE: string;
|
|
471
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: string;
|
|
472
|
+
REPLAY: string;
|
|
473
|
+
ERROR: string;
|
|
474
|
+
PLAY_TIPS: string;
|
|
475
|
+
PAUSE_TIPS: string;
|
|
476
|
+
PLAYNEXT_TIPS: string;
|
|
477
|
+
DOWNLOAD_TIPS: string;
|
|
478
|
+
ROTATE_TIPS: string;
|
|
479
|
+
RELOAD_TIPS: string;
|
|
480
|
+
FULLSCREEN_TIPS: string;
|
|
481
|
+
EXITFULLSCREEN_TIPS: string;
|
|
482
|
+
CSSFULLSCREEN_TIPS: string;
|
|
483
|
+
EXITCSSFULLSCREEN_TIPS: string;
|
|
484
|
+
TEXTTRACK: string;
|
|
485
|
+
PIP: string;
|
|
486
|
+
SCREENSHOT: string;
|
|
487
|
+
LIVE: string;
|
|
488
|
+
OFF: string;
|
|
489
|
+
OPEN: string;
|
|
490
|
+
MINI_DRAG: string;
|
|
491
|
+
MINISCREEN: string;
|
|
492
|
+
REFRESH_TIPS: string;
|
|
493
|
+
REFRESH: string;
|
|
494
|
+
FORWARD: string;
|
|
495
|
+
LIVE_TIP: string;
|
|
496
|
+
};
|
|
497
|
+
const ZH_CN: {
|
|
498
|
+
DEFINITION_FALLBACK_TOAST: string;
|
|
499
|
+
DEFINITION_SWITCHING: string;
|
|
500
|
+
ERROR_REFRESH: string;
|
|
501
|
+
UNMUTE: string;
|
|
502
|
+
MANIFEST: string;
|
|
503
|
+
NETWORK: string;
|
|
504
|
+
NETWORK_TIMEOUT: string;
|
|
505
|
+
NETWORK_FORBIDDEN: string;
|
|
506
|
+
NETWORK_NOTFOUND: string;
|
|
507
|
+
DEMUX: string;
|
|
508
|
+
REMUX: string;
|
|
509
|
+
MEDIA: string;
|
|
510
|
+
MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
|
|
511
|
+
MEDIA_ERR_URL_EMPTY: string;
|
|
512
|
+
DRM: string;
|
|
513
|
+
OTHER: string;
|
|
514
|
+
RUNTIME: string;
|
|
515
|
+
MODULE_LOAD_ERROR: string;
|
|
516
|
+
UNKNOWN: string;
|
|
517
|
+
ERROR_TYPES: typeof XG_ZH_CN.TEXT.ERROR_TYPES;
|
|
518
|
+
HAVE_NOTHING: string;
|
|
519
|
+
HAVE_METADATA: string;
|
|
520
|
+
HAVE_CURRENT_DATA: string;
|
|
521
|
+
HAVE_FUTURE_DATA: string;
|
|
522
|
+
HAVE_ENOUGH_DATA: string;
|
|
523
|
+
NETWORK_EMPTY: string;
|
|
524
|
+
NETWORK_IDLE: string;
|
|
525
|
+
NETWORK_LOADING: string;
|
|
526
|
+
NETWORK_NO_SOURCE: string;
|
|
527
|
+
MEDIA_ERR_ABORTED: string;
|
|
528
|
+
MEDIA_ERR_NETWORK: string;
|
|
529
|
+
MEDIA_ERR_DECODE: string;
|
|
530
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: string;
|
|
531
|
+
REPLAY: string;
|
|
532
|
+
ERROR: string;
|
|
533
|
+
PLAY_TIPS: string;
|
|
534
|
+
PAUSE_TIPS: string;
|
|
535
|
+
PLAYNEXT_TIPS: string;
|
|
536
|
+
DOWNLOAD_TIPS: string;
|
|
537
|
+
ROTATE_TIPS: string;
|
|
538
|
+
RELOAD_TIPS: string;
|
|
539
|
+
FULLSCREEN_TIPS: string;
|
|
540
|
+
EXITFULLSCREEN_TIPS: string;
|
|
541
|
+
CSSFULLSCREEN_TIPS: string;
|
|
542
|
+
EXITCSSFULLSCREEN_TIPS: string;
|
|
543
|
+
TEXTTRACK: string;
|
|
544
|
+
PIP: string;
|
|
545
|
+
SCREENSHOT: string;
|
|
546
|
+
LIVE: string;
|
|
547
|
+
OFF: string;
|
|
548
|
+
OPEN: string;
|
|
549
|
+
MINI_DRAG: string;
|
|
550
|
+
MINISCREEN: string;
|
|
551
|
+
REFRESH_TIPS: string;
|
|
552
|
+
REFRESH: string;
|
|
553
|
+
FORWARD: string;
|
|
554
|
+
LIVE_TIP: string;
|
|
555
|
+
};
|
|
556
|
+
type TextKey = keyof typeof EN;
|
|
557
|
+
type Lang = "zh-cn" | "zh-hk" | "en" | "jp" | string;
|
|
558
|
+
class VeI18n<T extends string = TextKey> {
|
|
559
|
+
private _lang;
|
|
560
|
+
constructor(config?: {
|
|
561
|
+
lang?: Lang;
|
|
562
|
+
i18n?: {
|
|
563
|
+
texts?: Record<Lang, Record<string, string>>;
|
|
564
|
+
};
|
|
565
|
+
});
|
|
566
|
+
static get langKeys(): any;
|
|
567
|
+
static isLangValid(lang: Lang): boolean;
|
|
568
|
+
static extend(i18nTextList: Array<IXGI18nText>, i18nLangs?: IXGI18n): void;
|
|
569
|
+
setLang(lang: string): void;
|
|
570
|
+
getLang(): string;
|
|
571
|
+
normalize(text?: string | Record<Lang, string>): string;
|
|
572
|
+
getText(textKey?: T | string): Record<string | T, string>[string | T] | undefined;
|
|
573
|
+
}
|
|
574
|
+
interface DefinitionUrl {
|
|
575
|
+
url: string;
|
|
576
|
+
next: DefinitionUrl | null;
|
|
577
|
+
}
|
|
578
|
+
function arrayToList(urls?: string[]): DefinitionUrl;
|
|
579
|
+
class Definition implements XGDefinition {
|
|
580
|
+
readonly definition: string;
|
|
581
|
+
readonly source: Source;
|
|
582
|
+
readonly text?: Record<Lang, string> | string;
|
|
583
|
+
readonly fallbackUrl: DefinitionUrl;
|
|
584
|
+
readonly urls: string[];
|
|
585
|
+
private _currentUrlRef;
|
|
586
|
+
constructor(definitionSetting: {
|
|
587
|
+
url: string;
|
|
588
|
+
definition: string;
|
|
589
|
+
source: Source;
|
|
590
|
+
text?: Record<Lang, string> | string;
|
|
591
|
+
fallbackUrls?: string[];
|
|
592
|
+
});
|
|
593
|
+
get url(): string;
|
|
594
|
+
next(): DefinitionUrl;
|
|
595
|
+
}
|
|
596
|
+
interface ExposedDefinition {
|
|
597
|
+
url: string;
|
|
598
|
+
definition: string;
|
|
599
|
+
text?: Record<Lang, string> | string;
|
|
600
|
+
fallbackUrls?: string[];
|
|
601
|
+
}
|
|
602
|
+
interface ExposedSource {
|
|
603
|
+
name?: string;
|
|
604
|
+
text?: Record<Lang, string> | string;
|
|
605
|
+
definitions: Array<ExposedDefinition | string>;
|
|
606
|
+
}
|
|
607
|
+
interface CompoundSources {
|
|
608
|
+
sources?: ExposedSource[];
|
|
609
|
+
url?: string;
|
|
610
|
+
fallbackUrls?: string[];
|
|
611
|
+
}
|
|
612
|
+
class Source {
|
|
613
|
+
readonly name?: string;
|
|
614
|
+
readonly text?: Record<Lang, string> | string;
|
|
615
|
+
readonly definitions: Array<Definition & {
|
|
616
|
+
source: Source;
|
|
617
|
+
}>;
|
|
618
|
+
private constructor();
|
|
619
|
+
get defaultDefinition(): Definition & {
|
|
620
|
+
source: Source;
|
|
621
|
+
};
|
|
622
|
+
static normalize(input: CompoundSources | ExposedSource[] | string): Source[];
|
|
623
|
+
private static normalizeUrl;
|
|
624
|
+
add(definition: Definition): void;
|
|
625
|
+
}
|
|
626
|
+
enum TOP_RIGHT_POSITIONS {
|
|
627
|
+
ROOT_TOP_RIGHT = "rootTopRight",
|
|
628
|
+
ROOT_TOP_RIGHT_COLLAPSE = "rootTopRightCollapse"
|
|
629
|
+
}
|
|
630
|
+
class TopRightBar extends Plugin {
|
|
631
|
+
static get pluginName(): string;
|
|
632
|
+
static get defaultConfig(): {
|
|
633
|
+
position: string;
|
|
634
|
+
plugins: never[];
|
|
635
|
+
};
|
|
636
|
+
static isTopRightPlugin(plugin: any, options: VePlayerBaseOptions): boolean;
|
|
637
|
+
registerIcons(): {
|
|
638
|
+
more: {
|
|
639
|
+
icon: any;
|
|
640
|
+
class: string;
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
children(): Record<string, {
|
|
644
|
+
plugin: Partial<Plugin>;
|
|
645
|
+
options: IPluginOptions["config"];
|
|
646
|
+
}>;
|
|
647
|
+
render(): string;
|
|
648
|
+
private _getPlugins;
|
|
649
|
+
}
|
|
650
|
+
interface Config {
|
|
651
|
+
listType: ListTypeOption;
|
|
652
|
+
isAutoChange?: boolean;
|
|
653
|
+
onItemClick?: (e: Event, data: CallbackData) => void;
|
|
654
|
+
onOptionClick?: (e: Event, data: CallbackData) => void;
|
|
655
|
+
hide?: () => void;
|
|
656
|
+
list?: ListItem[];
|
|
657
|
+
panel?: {
|
|
658
|
+
className?: string;
|
|
659
|
+
title?: string | Record<Lang, string>;
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
interface Options {
|
|
663
|
+
config: Config;
|
|
664
|
+
root: HTMLElement | null;
|
|
665
|
+
player: Player;
|
|
666
|
+
}
|
|
667
|
+
class MobilePlayerPanel {
|
|
668
|
+
private _root?;
|
|
669
|
+
private _config;
|
|
670
|
+
private _parent;
|
|
671
|
+
private _listDom?;
|
|
672
|
+
private _container?;
|
|
673
|
+
private _titleDom?;
|
|
674
|
+
private _player;
|
|
675
|
+
private _delegates?;
|
|
676
|
+
private _listType?;
|
|
677
|
+
constructor(args: Options);
|
|
678
|
+
changeMode(listType: ListTypeOption): void;
|
|
679
|
+
// 渲染选择列表
|
|
680
|
+
renderItemList(data?: ListItem[]): HTMLElement;
|
|
681
|
+
// 渲染panel的标题
|
|
682
|
+
renderTitle(): HTMLElement | undefined;
|
|
683
|
+
updatePanel(listType: ListTypeOption): void;
|
|
684
|
+
// 渲染panel
|
|
685
|
+
renderPanel(): void;
|
|
686
|
+
show(): void;
|
|
687
|
+
hide(): void;
|
|
688
|
+
destroy(): void;
|
|
689
|
+
private _bind;
|
|
690
|
+
private _unbind;
|
|
691
|
+
private _initEvents;
|
|
692
|
+
private _unbindEvents;
|
|
693
|
+
private _handleOrientationChange;
|
|
694
|
+
private _bindDomEvent;
|
|
695
|
+
private _unbindDomEvent;
|
|
696
|
+
private _stopPropagation;
|
|
697
|
+
private _onItemClick;
|
|
698
|
+
private _handleHide;
|
|
699
|
+
}
|
|
700
|
+
import MobilePanel = MobilePlayerPanelWrapper.MobilePlayerPanel;
|
|
701
|
+
const ListType: {
|
|
702
|
+
readonly Middle: "middle";
|
|
703
|
+
readonly Bottom: "bottom";
|
|
704
|
+
readonly Fullscreen: "fullscreen";
|
|
705
|
+
readonly Inner: "inner";
|
|
706
|
+
};
|
|
707
|
+
type ListTypeOption = (typeof ListType)[keyof typeof ListType];
|
|
708
|
+
interface ListItem {
|
|
709
|
+
[key: string]: any;
|
|
710
|
+
selected?: boolean;
|
|
711
|
+
className?: string;
|
|
712
|
+
showText?: string | HTMLElement;
|
|
713
|
+
text?: string | Record<Lang, string>;
|
|
714
|
+
iconText?: string | Record<Lang, string>;
|
|
715
|
+
}
|
|
716
|
+
type CallbackData = {
|
|
717
|
+
to?: ListItem;
|
|
718
|
+
from?: ListItem;
|
|
719
|
+
};
|
|
720
|
+
const enum RenderType {
|
|
721
|
+
Icon = "Icon",
|
|
722
|
+
Text = "Text"
|
|
723
|
+
}
|
|
724
|
+
type Config$0<T> = {
|
|
725
|
+
[key: string]: any;
|
|
726
|
+
// 【xg】顺序
|
|
727
|
+
index?: number;
|
|
728
|
+
// 【xg】展示的选择列表
|
|
729
|
+
list?: Array<T>;
|
|
730
|
+
// 【xg】竖屏
|
|
731
|
+
hidePortrait?: boolean;
|
|
732
|
+
// 【xg】列表点击之后是否隐藏列表
|
|
733
|
+
isItemClickHide?: boolean;
|
|
734
|
+
className?: string;
|
|
735
|
+
// 【xg】是否展示已选择的
|
|
736
|
+
isShowIcon?: boolean;
|
|
737
|
+
// 【xg 扩展】列表渲染样式类型
|
|
738
|
+
listType?: ListTypeOption;
|
|
739
|
+
// 已选择的展示类型(文案 or icon)
|
|
740
|
+
renderType?: RenderType;
|
|
741
|
+
// 列表数据只有一个是否展示
|
|
742
|
+
hideOnSingleOption?: boolean;
|
|
743
|
+
// 横屏的时候是否切换mode
|
|
744
|
+
isAutoChange?: boolean;
|
|
745
|
+
// 自定义组件 mobilePanel的配置
|
|
746
|
+
panel?: {
|
|
747
|
+
className?: string;
|
|
748
|
+
// panel 的标题
|
|
749
|
+
title?: string | Record<Lang, string>;
|
|
750
|
+
};
|
|
751
|
+
};
|
|
752
|
+
// 源自packages/xgplayer/src/plugins/common/optionsIcon.js
|
|
753
|
+
// 自定义了几种选择类型
|
|
754
|
+
class OptionsIcon extends Plugin {
|
|
755
|
+
icons: Record<string, any>;
|
|
756
|
+
config: Config$0<ListItem>;
|
|
757
|
+
optionsList?: MobilePanel | OptionList;
|
|
758
|
+
private _isIcon?;
|
|
759
|
+
private _isActive?;
|
|
760
|
+
private _curIndex;
|
|
761
|
+
private activeEvent?;
|
|
762
|
+
constructor(args: IPluginOptions);
|
|
763
|
+
static get pluginName(): string;
|
|
764
|
+
static get defaultConfig(): Config$0<ListItem>;
|
|
765
|
+
updateLang(): void;
|
|
766
|
+
afterCreate(): void;
|
|
767
|
+
initIcons(): void;
|
|
768
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
769
|
+
// @ts-ignore
|
|
770
|
+
show(): void;
|
|
771
|
+
hide(): void;
|
|
772
|
+
onEnter: (e: Event) => void;
|
|
773
|
+
onLeave: (e: Event) => void;
|
|
774
|
+
// 状态切换
|
|
775
|
+
toggle(isActive: boolean): void;
|
|
776
|
+
// 列表选择回调
|
|
777
|
+
onItemClick(e: Event, data: CallbackData): void;
|
|
778
|
+
// 列表点击回调
|
|
779
|
+
onOptionClick(e: Event, _data: CallbackData): void;
|
|
780
|
+
// 已选择 option 的文案
|
|
781
|
+
changeCurrentText(): void;
|
|
782
|
+
renderItemList(itemList: ListItem[], curIndex?: number): void;
|
|
783
|
+
destroy(): void;
|
|
784
|
+
render(): string;
|
|
785
|
+
private _getListType;
|
|
786
|
+
}
|
|
787
|
+
enum Codec {
|
|
788
|
+
H265 = "h265",
|
|
789
|
+
H264 = "h264"
|
|
790
|
+
}
|
|
791
|
+
enum Degradation {
|
|
792
|
+
SoftFirst = "soft-first",
|
|
793
|
+
H264First = "h264-first"
|
|
794
|
+
}
|
|
795
|
+
enum DecodeType {
|
|
796
|
+
Software = "software",
|
|
797
|
+
Hardware = "hardware"
|
|
798
|
+
}
|
|
799
|
+
type PrepareResult = {
|
|
800
|
+
options?: Partial<VePlayerBaseOptions>;
|
|
801
|
+
plugins?: any[];
|
|
802
|
+
};
|
|
803
|
+
type PreparePlugins = (url: string) => Promise<PrepareResult> | undefined;
|
|
804
|
+
type Constructor<T> = new (...args: any[]) => T;
|
|
805
|
+
const POSITIONS: {
|
|
806
|
+
ROOT_TOP_RIGHT: TOP_RIGHT_POSITIONS.ROOT_TOP_RIGHT;
|
|
807
|
+
ROOT_TOP_RIGHT_COLLAPSE: TOP_RIGHT_POSITIONS.ROOT_TOP_RIGHT_COLLAPSE;
|
|
808
|
+
ROOT: string;
|
|
809
|
+
ROOT_LEFT: string;
|
|
810
|
+
ROOT_RIGHT: string;
|
|
811
|
+
ROOT_TOP: string;
|
|
812
|
+
CONTROLS_LEFT: string;
|
|
813
|
+
CONTROLS_RIGTH: string;
|
|
814
|
+
CONTROLS_RIGHT: string;
|
|
815
|
+
CONTROLS_CENTER: string;
|
|
816
|
+
CONTROLS: string;
|
|
817
|
+
};
|
|
818
|
+
interface VePlayerBaseOptions extends Omit<PlayerOptions, "autoplay" | "i18n"> {
|
|
819
|
+
url?: string;
|
|
820
|
+
id?: string;
|
|
821
|
+
el?: HTMLElement;
|
|
822
|
+
codec?: Codec;
|
|
823
|
+
fallbackUrls?: string[];
|
|
824
|
+
maxFallbackRound?: number;
|
|
825
|
+
degradation?: Degradation | boolean;
|
|
826
|
+
decodeType?: DecodeType;
|
|
827
|
+
poster?: string;
|
|
828
|
+
defaultSource?: string;
|
|
829
|
+
defaultDefinition?: string;
|
|
830
|
+
preparePlugins?: PreparePlugins;
|
|
831
|
+
autoplay?: {
|
|
832
|
+
muted: boolean;
|
|
833
|
+
} | boolean;
|
|
834
|
+
playlist?: ExposedSource[];
|
|
835
|
+
listType?: ListTypeOption;
|
|
836
|
+
flv?: Partial<FlvOption>;
|
|
837
|
+
hls?: Partial<HlsOption> & {
|
|
838
|
+
enableMSE?: boolean;
|
|
839
|
+
};
|
|
840
|
+
i18n?: {
|
|
841
|
+
texts: Record<Lang, Record<string, string>>;
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
const transformOption: (options: VePlayerBaseOptions) => Omit<VePlayerBaseOptions, "i18n">;
|
|
845
|
+
class VePlayerBase {
|
|
846
|
+
protected readonly _player: XGPlayer;
|
|
847
|
+
private readonly _sourceManager;
|
|
848
|
+
private readonly _preparePlugins?;
|
|
849
|
+
private _previousPrepareResult?;
|
|
850
|
+
private _i18nManager;
|
|
851
|
+
private _events;
|
|
852
|
+
private _errorCallback;
|
|
853
|
+
constructor(options?: VePlayerBaseOptions);
|
|
854
|
+
get readyState(): 0 | 2 | 1 | 4 | 3;
|
|
855
|
+
get buffered(): TimeRanges;
|
|
856
|
+
get played(): TimeRanges;
|
|
857
|
+
get cumulateTime(): number;
|
|
858
|
+
get isFocused(): boolean;
|
|
859
|
+
get isFullscreen(): boolean;
|
|
860
|
+
get isCssFullscreen(): boolean;
|
|
861
|
+
get networkState(): 0 | 2 | 1 | 3;
|
|
862
|
+
get paused(): boolean;
|
|
863
|
+
get ended(): boolean;
|
|
864
|
+
get state(): number;
|
|
865
|
+
get url(): any;
|
|
866
|
+
get source(): string | undefined;
|
|
867
|
+
get definition(): string;
|
|
868
|
+
get crossOrigin(): string;
|
|
869
|
+
set crossOrigin(crossOrigin: string);
|
|
870
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
871
|
+
get volume(): number;
|
|
872
|
+
set volume(volume: number);
|
|
873
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
874
|
+
get muted(): boolean;
|
|
875
|
+
set muted(isMuted: boolean);
|
|
876
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
877
|
+
get lang(): Lang;
|
|
878
|
+
set lang(lang: Lang);
|
|
879
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
880
|
+
protected get _src(): string;
|
|
881
|
+
static create<T extends VePlayerBase>(options?: VePlayerBaseOptions, Constructor?: Constructor<T>): Promise<T>;
|
|
882
|
+
switch(target: string | {
|
|
883
|
+
definition?: string;
|
|
884
|
+
source?: string;
|
|
885
|
+
}, options?: {
|
|
886
|
+
fallbackToFirstDefinition?: boolean;
|
|
887
|
+
}): Promise<Definition>;
|
|
888
|
+
updatePlaylist(playlist: ExposedSource[] | string, target?: string | {
|
|
889
|
+
definition?: string;
|
|
890
|
+
source?: string;
|
|
891
|
+
}): Promise<void>;
|
|
892
|
+
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
893
|
+
once(event: string, callback: (data?: any) => any, ...args: any[]): void;
|
|
894
|
+
off(event: string, callback: (data?: any) => any, ...args: any[]): void;
|
|
895
|
+
emit(event: string, data?: any, ...args: any[]): void;
|
|
896
|
+
offAll(): void;
|
|
897
|
+
on(event: string, callback: (data?: any) => any, ...args: any[]): void;
|
|
898
|
+
play(): any;
|
|
899
|
+
pause(): void;
|
|
900
|
+
requestPIP(): void;
|
|
901
|
+
exitPIP(): void;
|
|
902
|
+
retry(): void;
|
|
903
|
+
focus(data?: {
|
|
904
|
+
autoHide?: boolean;
|
|
905
|
+
delay?: number;
|
|
906
|
+
}): void;
|
|
907
|
+
blur(data?: {
|
|
908
|
+
ignorePaused?: boolean;
|
|
909
|
+
}): void;
|
|
910
|
+
getFullscreen(el?: HTMLElement): Promise<void>;
|
|
911
|
+
exitFullscreen(el?: HTMLElement): Promise<void>;
|
|
912
|
+
getCssFullscreen(el?: HTMLElement): void;
|
|
913
|
+
exitCssFullscreen(): void;
|
|
914
|
+
registerPlugin(plugin:
|
|
915
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
916
|
+
Function | {
|
|
917
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
918
|
+
plugin: Function;
|
|
919
|
+
options: object;
|
|
920
|
+
}, config?: {
|
|
921
|
+
[propName: string]: any;
|
|
922
|
+
}): any;
|
|
923
|
+
unRegisterPlugin(plugin: any, removedFromConfig?: boolean): void;
|
|
924
|
+
// 显示插件
|
|
925
|
+
showIcon(pluginNames: string[]): void;
|
|
926
|
+
// 隐藏插件显示
|
|
927
|
+
hideIcon(pluginNames: string[]): void;
|
|
928
|
+
destroy(): void;
|
|
929
|
+
prepare(url: string): Promise<any[]>;
|
|
930
|
+
private _handleFallback;
|
|
931
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
932
|
+
private _transformEvent;
|
|
933
|
+
private _switch;
|
|
934
|
+
private _switchUrl;
|
|
935
|
+
// 获取需要卸载和需要注册的播放插件
|
|
936
|
+
private _diffPlugins;
|
|
937
|
+
private _callBeforePlayerInitForUrl;
|
|
938
|
+
}
|
|
939
|
+
/// <reference types="./loader" />
|
|
940
|
+
const NAME_MAP: {
|
|
941
|
+
readonly "biz:vod": "veplayer.biz.vod.[env].[ext]";
|
|
942
|
+
readonly "biz:live": "veplayer.biz.live.[env].[ext]";
|
|
943
|
+
readonly "plugin:flv": "veplayer.plugin.flv.[env].[ext]";
|
|
944
|
+
readonly "plugin:mp4": "veplayer.plugin.mp4.[env].[ext]";
|
|
945
|
+
readonly "plugin:hls": "veplayer.plugin.hls.[env].[ext]";
|
|
946
|
+
readonly "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]";
|
|
947
|
+
readonly "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]";
|
|
948
|
+
readonly "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]";
|
|
949
|
+
};
|
|
950
|
+
const enum State {
|
|
951
|
+
Fetching = 0,
|
|
952
|
+
Ready = 1,
|
|
953
|
+
Error = 2
|
|
954
|
+
}
|
|
955
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
956
|
+
type Exports = Record<string, any>;
|
|
957
|
+
interface Module {
|
|
958
|
+
src: string;
|
|
959
|
+
state: State;
|
|
960
|
+
name: string;
|
|
961
|
+
exports: Exports;
|
|
962
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
963
|
+
error?: any;
|
|
964
|
+
}
|
|
965
|
+
type ModuleSystem = "esm" | "umd";
|
|
966
|
+
interface LoaderOptions {
|
|
967
|
+
baseUrl: string;
|
|
968
|
+
}
|
|
969
|
+
enum DynamicModule {
|
|
970
|
+
BizVod = "biz:vod",
|
|
971
|
+
BizLive = "biz:live",
|
|
972
|
+
PluginFlv = "plugin:flv",
|
|
973
|
+
PluginMp4 = "plugin:mp4",
|
|
974
|
+
PluginHls = "plugin:hls",
|
|
975
|
+
PluginShaka = "plugin:shaka",
|
|
976
|
+
PluginRtm = "plugin:rtm",
|
|
977
|
+
PluginXgvideo = "plugin:xgvideo"
|
|
978
|
+
}
|
|
979
|
+
type ModulesMap = {
|
|
980
|
+
[DynamicModule.BizVod]: Exports;
|
|
981
|
+
[DynamicModule.BizLive]: Exports;
|
|
982
|
+
[DynamicModule.PluginFlv]: Exports;
|
|
983
|
+
[DynamicModule.PluginMp4]: Exports;
|
|
984
|
+
[DynamicModule.PluginHls]: Exports;
|
|
985
|
+
[DynamicModule.PluginShaka]: Exports;
|
|
986
|
+
[DynamicModule.PluginRtm]: Exports;
|
|
987
|
+
[DynamicModule.PluginXgvideo]: Exports;
|
|
988
|
+
};
|
|
989
|
+
class Loader {
|
|
990
|
+
readonly modules: Record<string, Module>;
|
|
991
|
+
readonly mountPromiseMap: Record<string, Promise<Exports>>;
|
|
992
|
+
private _baseUrl;
|
|
993
|
+
private _moduleSystem?;
|
|
994
|
+
constructor(options: LoaderOptions);
|
|
995
|
+
get baseUrl(): string;
|
|
996
|
+
get moduleSystem(): ModuleSystem | undefined;
|
|
997
|
+
setModuleSystem(moduleSystem: ModuleSystem): void;
|
|
998
|
+
setBaseUrl(url: string): void;
|
|
999
|
+
load: <T extends DynamicModule>(name: T, src?: string) => Promise<ModulesMap[T]>;
|
|
1000
|
+
register: (name: string, exports: Exports) => Exports;
|
|
1001
|
+
private _mount;
|
|
1002
|
+
}
|
|
1003
|
+
const register: (name: string, exports: {
|
|
1004
|
+
[x: string]: any;
|
|
1005
|
+
}) => {
|
|
1006
|
+
[x: string]: any;
|
|
1007
|
+
};
|
|
1008
|
+
function setModuleSystem(moduleSystem: ModuleSystem): void;
|
|
1009
|
+
function setBaseUrl(url: string): void;
|
|
1010
|
+
function getBaseUrl(): string;
|
|
1011
|
+
function load<T extends DynamicModule>(name: T, src?: string): Promise<ModulesMap[T]>;
|
|
1012
|
+
interface Strategy<T = VePlayerBaseOptions, R extends keyof ModulesMap = any> {
|
|
1013
|
+
options: Partial<T>;
|
|
1014
|
+
module: R;
|
|
1015
|
+
afterLoad?: (module: ModulesMap[R]) => void;
|
|
1016
|
+
}
|
|
1017
|
+
type StrategyCreator<T, R extends keyof ModulesMap = any> = (options?: T) => Strategy<T, R>;
|
|
1018
|
+
const createFlvMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginFlv>;
|
|
1019
|
+
const createHlsMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginHls>;
|
|
1020
|
+
const createSoftDecodeH264Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
|
|
1021
|
+
const createSoftDecodeH265Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
|
|
1022
|
+
function getCodec(options: VePlayerBaseOptions): Promise<"unknown" | Codec>;
|
|
1023
|
+
function detectCodec(url: string): Promise<"unknown" | Codec>;
|
|
1024
|
+
function isSoftDecode(options: VePlayerBaseOptions): Promise<boolean>;
|
|
1025
|
+
function combineOptions<T = VePlayerBaseOptions>(strategyList: (Strategy<T> | undefined)[]): Partial<T>;
|
|
1026
|
+
const getFlvStrategy: (options: VePlayerBaseOptions) => Promise<{
|
|
1027
|
+
options?: undefined;
|
|
1028
|
+
plugins?: undefined;
|
|
1029
|
+
} | {
|
|
1030
|
+
options: Partial<VePlayerBaseOptions>;
|
|
1031
|
+
plugins: {
|
|
1032
|
+
[x: string]: any;
|
|
1033
|
+
}[];
|
|
1034
|
+
}>;
|
|
1035
|
+
const getHlsStrategy: (options: VePlayerBaseOptions) => Promise<{
|
|
1036
|
+
options?: undefined;
|
|
1037
|
+
plugins?: undefined;
|
|
1038
|
+
} | {
|
|
1039
|
+
options: Partial<VePlayerBaseOptions>;
|
|
1040
|
+
plugins: {
|
|
1041
|
+
[x: string]: any;
|
|
1042
|
+
}[];
|
|
1043
|
+
}>;
|
|
1044
|
+
}
|
|
1045
|
+
declare namespace error {
|
|
1046
|
+
const EN: {
|
|
1047
|
+
DEFINITION_FALLBACK_TOAST: string;
|
|
1048
|
+
DEFINITION_SWITCHING: string;
|
|
1049
|
+
ERROR_REFRESH: string;
|
|
1050
|
+
UNMUTE: string;
|
|
1051
|
+
MANIFEST: string;
|
|
1052
|
+
NETWORK: string;
|
|
1053
|
+
NETWORK_TIMEOUT: string;
|
|
1054
|
+
NETWORK_FORBIDDEN: string;
|
|
1055
|
+
NETWORK_NOTFOUND: string;
|
|
1056
|
+
DEMUX: string;
|
|
1057
|
+
REMUX: string;
|
|
1058
|
+
MEDIA: string;
|
|
1059
|
+
MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
|
|
1060
|
+
MEDIA_ERR_URL_EMPTY: string;
|
|
1061
|
+
DRM: string;
|
|
1062
|
+
OTHER: string;
|
|
1063
|
+
RUNTIME: string;
|
|
1064
|
+
MODULE_LOAD_ERROR: string;
|
|
1065
|
+
UNKNOWN: string;
|
|
1066
|
+
ERROR_TYPES: typeof XG_EN.TEXT.ERROR_TYPES;
|
|
1067
|
+
HAVE_NOTHING: string;
|
|
1068
|
+
HAVE_METADATA: string;
|
|
1069
|
+
HAVE_CURRENT_DATA: string;
|
|
1070
|
+
HAVE_FUTURE_DATA: string;
|
|
1071
|
+
HAVE_ENOUGH_DATA: string;
|
|
1072
|
+
NETWORK_EMPTY: string;
|
|
1073
|
+
NETWORK_IDLE: string;
|
|
1074
|
+
NETWORK_LOADING: string;
|
|
1075
|
+
NETWORK_NO_SOURCE: string;
|
|
1076
|
+
MEDIA_ERR_ABORTED: string;
|
|
1077
|
+
MEDIA_ERR_NETWORK: string;
|
|
1078
|
+
MEDIA_ERR_DECODE: string;
|
|
1079
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: string;
|
|
1080
|
+
REPLAY: string;
|
|
1081
|
+
ERROR: string;
|
|
1082
|
+
PLAY_TIPS: string;
|
|
1083
|
+
PAUSE_TIPS: string;
|
|
1084
|
+
PLAYNEXT_TIPS: string;
|
|
1085
|
+
DOWNLOAD_TIPS: string;
|
|
1086
|
+
ROTATE_TIPS: string;
|
|
1087
|
+
RELOAD_TIPS: string;
|
|
1088
|
+
FULLSCREEN_TIPS: string;
|
|
1089
|
+
EXITFULLSCREEN_TIPS: string;
|
|
1090
|
+
CSSFULLSCREEN_TIPS: string;
|
|
1091
|
+
EXITCSSFULLSCREEN_TIPS: string;
|
|
1092
|
+
TEXTTRACK: string;
|
|
1093
|
+
PIP: string;
|
|
1094
|
+
SCREENSHOT: string;
|
|
1095
|
+
LIVE: string;
|
|
1096
|
+
OFF: string;
|
|
1097
|
+
OPEN: string;
|
|
1098
|
+
MINI_DRAG: string;
|
|
1099
|
+
MINISCREEN: string;
|
|
1100
|
+
REFRESH_TIPS: string;
|
|
1101
|
+
REFRESH: string;
|
|
1102
|
+
FORWARD: string;
|
|
1103
|
+
LIVE_TIP: string;
|
|
1104
|
+
};
|
|
1105
|
+
const ZH_CN: {
|
|
1106
|
+
DEFINITION_FALLBACK_TOAST: string;
|
|
1107
|
+
DEFINITION_SWITCHING: string;
|
|
1108
|
+
ERROR_REFRESH: string;
|
|
1109
|
+
UNMUTE: string;
|
|
1110
|
+
MANIFEST: string;
|
|
1111
|
+
NETWORK: string;
|
|
1112
|
+
NETWORK_TIMEOUT: string;
|
|
1113
|
+
NETWORK_FORBIDDEN: string;
|
|
1114
|
+
NETWORK_NOTFOUND: string;
|
|
1115
|
+
DEMUX: string;
|
|
1116
|
+
REMUX: string;
|
|
1117
|
+
MEDIA: string;
|
|
1118
|
+
MEDIA_ERR_CODEC_NOT_SUPPORTED: string;
|
|
1119
|
+
MEDIA_ERR_URL_EMPTY: string;
|
|
1120
|
+
DRM: string;
|
|
1121
|
+
OTHER: string;
|
|
1122
|
+
RUNTIME: string;
|
|
1123
|
+
MODULE_LOAD_ERROR: string;
|
|
1124
|
+
UNKNOWN: string;
|
|
1125
|
+
ERROR_TYPES: typeof XG_ZH_CN.TEXT.ERROR_TYPES;
|
|
1126
|
+
HAVE_NOTHING: string;
|
|
1127
|
+
HAVE_METADATA: string;
|
|
1128
|
+
HAVE_CURRENT_DATA: string;
|
|
1129
|
+
HAVE_FUTURE_DATA: string;
|
|
1130
|
+
HAVE_ENOUGH_DATA: string;
|
|
1131
|
+
NETWORK_EMPTY: string;
|
|
1132
|
+
NETWORK_IDLE: string;
|
|
1133
|
+
NETWORK_LOADING: string;
|
|
1134
|
+
NETWORK_NO_SOURCE: string;
|
|
1135
|
+
MEDIA_ERR_ABORTED: string;
|
|
1136
|
+
MEDIA_ERR_NETWORK: string;
|
|
1137
|
+
MEDIA_ERR_DECODE: string;
|
|
1138
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: string;
|
|
1139
|
+
REPLAY: string;
|
|
1140
|
+
ERROR: string;
|
|
1141
|
+
PLAY_TIPS: string;
|
|
1142
|
+
PAUSE_TIPS: string;
|
|
1143
|
+
PLAYNEXT_TIPS: string;
|
|
1144
|
+
DOWNLOAD_TIPS: string;
|
|
1145
|
+
ROTATE_TIPS: string;
|
|
1146
|
+
RELOAD_TIPS: string;
|
|
1147
|
+
FULLSCREEN_TIPS: string;
|
|
1148
|
+
EXITFULLSCREEN_TIPS: string;
|
|
1149
|
+
CSSFULLSCREEN_TIPS: string;
|
|
1150
|
+
EXITCSSFULLSCREEN_TIPS: string;
|
|
1151
|
+
TEXTTRACK: string;
|
|
1152
|
+
PIP: string;
|
|
1153
|
+
SCREENSHOT: string;
|
|
1154
|
+
LIVE: string;
|
|
1155
|
+
OFF: string;
|
|
1156
|
+
OPEN: string;
|
|
1157
|
+
MINI_DRAG: string;
|
|
1158
|
+
MINISCREEN: string;
|
|
1159
|
+
REFRESH_TIPS: string;
|
|
1160
|
+
REFRESH: string;
|
|
1161
|
+
FORWARD: string;
|
|
1162
|
+
LIVE_TIP: string;
|
|
1163
|
+
};
|
|
1164
|
+
type TextKey = keyof typeof EN;
|
|
1165
|
+
type Lang = "zh-cn" | "zh-hk" | "en" | "jp" | string;
|
|
1166
|
+
class VeI18n<T extends string = TextKey> {
|
|
1167
|
+
private _lang;
|
|
1168
|
+
constructor(config?: {
|
|
1169
|
+
lang?: Lang;
|
|
1170
|
+
i18n?: {
|
|
1171
|
+
texts?: Record<Lang, Record<string, string>>;
|
|
1172
|
+
};
|
|
1173
|
+
});
|
|
1174
|
+
static get langKeys(): any;
|
|
1175
|
+
static isLangValid(lang: Lang): boolean;
|
|
1176
|
+
static extend(i18nTextList: Array<IXGI18nText>, i18nLangs?: IXGI18n): void;
|
|
1177
|
+
setLang(lang: string): void;
|
|
1178
|
+
getLang(): string;
|
|
1179
|
+
normalize(text?: string | Record<Lang, string>): string;
|
|
1180
|
+
getText(textKey?: T | string): Record<string | T, string>[string | T] | undefined;
|
|
1181
|
+
}
|
|
1182
|
+
enum Level {
|
|
1183
|
+
Fatal = "Fatal",
|
|
1184
|
+
Error = "Error"
|
|
1185
|
+
}
|
|
1186
|
+
enum ErrorCode {
|
|
1187
|
+
MANIFEST_HLS_ERROR = 1100,
|
|
1188
|
+
MANIFEST_DASH_ERROR = 1200,
|
|
1189
|
+
NETWORK = 2100,
|
|
1190
|
+
NETWORK_TIMEOUT = 2101,
|
|
1191
|
+
NETWORK_FORBIDDEN = 2103,
|
|
1192
|
+
NETWORK_NOTFOUND = 2104,
|
|
1193
|
+
NETWORK_RANGE_NOT_SATISFIABLE = 2116,
|
|
1194
|
+
DEMUX_FLV_ERROR = 3100,
|
|
1195
|
+
DEMUX_HLS_ERROR = 3200,
|
|
1196
|
+
DEMUX_MP4_ERROR = 3300,
|
|
1197
|
+
DEMUX_FMP4_ERROR = 3400,
|
|
1198
|
+
DEMUX_SIDX_ERROR = 3410,
|
|
1199
|
+
REMUX_FMP4_ERROR = 4100,
|
|
1200
|
+
REMUX_MP4_ERROR = 4200,
|
|
1201
|
+
MEDIA_ERR_ABORTED = 5101,
|
|
1202
|
+
MEDIA_ERR_NETWORK = 5102,
|
|
1203
|
+
MEDIA_ERR_DECODE = 5103,
|
|
1204
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED = 5104,
|
|
1205
|
+
MEDIA_ERR_CODEC_NOT_SUPPORTED = 5105,
|
|
1206
|
+
MEDIA_ERR_URL_EMPTY = 5106,
|
|
1207
|
+
MEDIA_MSE_ADD_SB = 5200,
|
|
1208
|
+
MEDIA_MSE_APPEND_BUFFER = 5201,
|
|
1209
|
+
MEDIA_MSE_OTHER = 5202,
|
|
1210
|
+
MEDIA_MSE_FULL = 5203,
|
|
1211
|
+
MEDIA_MSE_HIJACK = 5204,
|
|
1212
|
+
MEDIA_EME_HIJACK = 5301,
|
|
1213
|
+
DRM_LICENSE = 7100,
|
|
1214
|
+
DRM_CUSTOM_LICENSE = 7200,
|
|
1215
|
+
OTHER = 8000,
|
|
1216
|
+
RUNTIME_NO_CANPLAY_ERROR = 9001,
|
|
1217
|
+
RUNTIME_BUFFERBREAK_ERROR = 9002,
|
|
1218
|
+
RUNTIME_BWAITING_TIMEOUT_ERROR = 9002,
|
|
1219
|
+
// veplayer 报错
|
|
1220
|
+
MODULE_LOAD_ERROR = 100,
|
|
1221
|
+
UNKNOWN = "UNKNOWN"
|
|
1222
|
+
}
|
|
1223
|
+
enum ErrorType {
|
|
1224
|
+
MANIFEST = "manifest",
|
|
1225
|
+
NETWORK = "network",
|
|
1226
|
+
DEMUX = "demux",
|
|
1227
|
+
REMUX = "remux",
|
|
1228
|
+
MEDIA = "media",
|
|
1229
|
+
DRM = "drm",
|
|
1230
|
+
OTHER = "other",
|
|
1231
|
+
RUNTIME = "runtime"
|
|
1232
|
+
}
|
|
1233
|
+
interface ErrorInfo<T = TextKey> {
|
|
1234
|
+
errorCode?: ErrorCode;
|
|
1235
|
+
message?: string;
|
|
1236
|
+
messageTextKey?: T;
|
|
1237
|
+
level?: Level;
|
|
1238
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1239
|
+
ext?: any;
|
|
1240
|
+
error?: Error;
|
|
1241
|
+
}
|
|
1242
|
+
// 参考: https://bytedance.feishu.cn/docx/doxcnGPXIOrJk3dGE3E3YghgZke
|
|
1243
|
+
const ERROR_INFO: Partial<Record<ErrorCode, ErrorInfo>>;
|
|
1244
|
+
const ERROR_TYPE_INFO: Record<ErrorType, ErrorInfo>;
|
|
1245
|
+
class VeError<T extends string = TextKey> extends Error {
|
|
1246
|
+
readonly errorCode: ErrorCode;
|
|
1247
|
+
readonly level?: Level;
|
|
1248
|
+
readonly ext?: any;
|
|
1249
|
+
constructor(error?: string | ErrorInfo<T>, i18n?: VeI18n<T>);
|
|
1250
|
+
}
|
|
1251
|
+
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" | "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">;
|
|
1252
|
+
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" | "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">;
|
|
1253
|
+
}
|
|
1254
|
+
declare namespace event {
|
|
1255
|
+
const BaseEvents: {
|
|
1256
|
+
SEI: string;
|
|
1257
|
+
PLAYER_CREATE_FINISH: string;
|
|
1258
|
+
FALLBACK_ERROR: string;
|
|
1259
|
+
FALLBACK: string;
|
|
1260
|
+
AUTOPLAY_STARTED: string;
|
|
1261
|
+
AUTOPLAY_PREVENTED: string;
|
|
1262
|
+
DOWNLOAD_SPEED_CHANGE: string;
|
|
1263
|
+
FULLSCREEN_CHANGE: string;
|
|
1264
|
+
CSS_FULLSCREEN_CHANGE: string;
|
|
1265
|
+
MINI_STATE_CHANGE: string;
|
|
1266
|
+
DEFINITION_CHANGE: string;
|
|
1267
|
+
BEFORE_DEFINITION_CHANGE: string;
|
|
1268
|
+
AFTER_DEFINITION_CHANGE: string;
|
|
1269
|
+
VIDEO_RESIZE: string;
|
|
1270
|
+
PIP_CHANGE: string;
|
|
1271
|
+
USER_ACTION: string;
|
|
1272
|
+
AUTOPLAY_UNMUTE: string;
|
|
1273
|
+
LONG_WAITING: string;
|
|
1274
|
+
DEFINITION_FALLBACK: string;
|
|
1275
|
+
AUTOPLAY_FAIL: string;
|
|
1276
|
+
AUTOPLAY_SUCCESS: string;
|
|
1277
|
+
ERROR_REFRESH_CLICK: string;
|
|
1278
|
+
SOURCE_CHANGE: string;
|
|
1279
|
+
};
|
|
1280
|
+
const Events: {
|
|
1281
|
+
SEI: string;
|
|
1282
|
+
PLAYER_CREATE_FINISH: string;
|
|
1283
|
+
FALLBACK_ERROR: string;
|
|
1284
|
+
FALLBACK: string;
|
|
1285
|
+
AUTOPLAY_STARTED: string;
|
|
1286
|
+
AUTOPLAY_PREVENTED: string;
|
|
1287
|
+
DOWNLOAD_SPEED_CHANGE: string;
|
|
1288
|
+
FULLSCREEN_CHANGE: string;
|
|
1289
|
+
CSS_FULLSCREEN_CHANGE: string;
|
|
1290
|
+
MINI_STATE_CHANGE: string;
|
|
1291
|
+
DEFINITION_CHANGE: string;
|
|
1292
|
+
BEFORE_DEFINITION_CHANGE: string;
|
|
1293
|
+
AFTER_DEFINITION_CHANGE: string;
|
|
1294
|
+
VIDEO_RESIZE: string;
|
|
1295
|
+
PIP_CHANGE: string;
|
|
1296
|
+
USER_ACTION: string;
|
|
1297
|
+
AUTOPLAY_UNMUTE: string;
|
|
1298
|
+
LONG_WAITING: string;
|
|
1299
|
+
DEFINITION_FALLBACK: string;
|
|
1300
|
+
AUTOPLAY_FAIL: string;
|
|
1301
|
+
AUTOPLAY_SUCCESS: string;
|
|
1302
|
+
ERROR_REFRESH_CLICK: string;
|
|
1303
|
+
SOURCE_CHANGE: string;
|
|
1304
|
+
REPLAY: string;
|
|
1305
|
+
ERROR: string;
|
|
1306
|
+
PLAY: string;
|
|
1307
|
+
PLAYING: string;
|
|
1308
|
+
ENDED: string;
|
|
1309
|
+
PAUSE: string;
|
|
1310
|
+
SEEKING: string;
|
|
1311
|
+
SEEKED: string;
|
|
1312
|
+
TIME_UPDATE: string;
|
|
1313
|
+
WAITING: string;
|
|
1314
|
+
CANPLAY: string;
|
|
1315
|
+
CANPLAY_THROUGH: string;
|
|
1316
|
+
DURATION_CHANGE: string;
|
|
1317
|
+
VOLUME_CHANGE: string;
|
|
1318
|
+
LOADED_DATA: string;
|
|
1319
|
+
RATE_CHANGE: string;
|
|
1320
|
+
PROGRESS: string;
|
|
1321
|
+
LOAD_START: string;
|
|
1322
|
+
EMPTIED: string;
|
|
1323
|
+
STALLED: string;
|
|
1324
|
+
SUSPEND: string;
|
|
1325
|
+
ABORT: string;
|
|
1326
|
+
BUFFER_CHANGE: string;
|
|
1327
|
+
PLAYER_FOCUS: string;
|
|
1328
|
+
PLAYER_BLUR: string;
|
|
1329
|
+
READY: string;
|
|
1330
|
+
URL_NULL: string;
|
|
1331
|
+
COMPLETE: string;
|
|
1332
|
+
DESTROY: string;
|
|
1333
|
+
URL_CHANGE: string;
|
|
1334
|
+
SEI_PARSED: string;
|
|
1335
|
+
RETRY: string;
|
|
1336
|
+
ROTATE: string;
|
|
1337
|
+
SCREEN_SHOT: string;
|
|
1338
|
+
PLAYNEXT: string;
|
|
1339
|
+
SHORTCUT: string;
|
|
1340
|
+
XGLOG: string;
|
|
1341
|
+
RESET: string;
|
|
1342
|
+
SOURCE_ERROR: string;
|
|
1343
|
+
SOURCE_SUCCESS: string;
|
|
1344
|
+
SWITCH_SUBTITLE: string;
|
|
1345
|
+
VIDEO_EVENTS: string;
|
|
1346
|
+
STATS_EVENTS: string;
|
|
1347
|
+
FPS_STUCK: string;
|
|
1348
|
+
};
|
|
1349
|
+
function transform(event: string, callback?: (data?: any) => void): {
|
|
1350
|
+
xgEventName: string;
|
|
1351
|
+
xgCallback: ((...args: any) => void) | undefined;
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1354
|
+
type Text = string | Record<Lang, string>;
|
|
1355
|
+
type Config$1 = {
|
|
1356
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1357
|
+
[key: string]: any;
|
|
1358
|
+
showErrorImg: boolean;
|
|
1359
|
+
showErrorTip: boolean;
|
|
1360
|
+
showRefresh: boolean;
|
|
1361
|
+
errorTipsText: Text;
|
|
1362
|
+
extraTips: {
|
|
1363
|
+
label: Text;
|
|
1364
|
+
value: Text;
|
|
1365
|
+
}[];
|
|
1366
|
+
};
|
|
1367
|
+
declare class Error extends Plugin {
|
|
1368
|
+
player: Player$0;
|
|
1369
|
+
icons: {
|
|
1370
|
+
error: HTMLElement;
|
|
1371
|
+
};
|
|
1372
|
+
langText: {
|
|
1373
|
+
refresh: string;
|
|
1374
|
+
errorTip: string;
|
|
1375
|
+
};
|
|
1376
|
+
config: Config$1;
|
|
1377
|
+
private _error?;
|
|
1378
|
+
static get pluginName(): string;
|
|
1379
|
+
static get defaultConfig(): Config$1;
|
|
1380
|
+
get _errorTip(): string;
|
|
1381
|
+
afterCreate(): void;
|
|
1382
|
+
registerIcons(): {
|
|
1383
|
+
error: {
|
|
1384
|
+
icon: any;
|
|
1385
|
+
class: string;
|
|
1386
|
+
};
|
|
1387
|
+
};
|
|
1388
|
+
updateLang(): void;
|
|
1389
|
+
showError(error: VeError | XGError): void;
|
|
1390
|
+
hideError(): void;
|
|
1391
|
+
destroy(): void;
|
|
1392
|
+
render(): string;
|
|
1393
|
+
private _focus;
|
|
1394
|
+
private _initIcons;
|
|
1395
|
+
private _initEvents;
|
|
1396
|
+
private _renderText;
|
|
1397
|
+
private _renderExtraTips;
|
|
1398
|
+
private _handleRefresh;
|
|
1399
|
+
private _renderRefresh;
|
|
1400
|
+
}
|
|
1401
|
+
interface VodVePlayerOptions {
|
|
1402
|
+
plugins: any[];
|
|
1403
|
+
}
|
|
1404
|
+
declare function createVodPlayer(options?: VodVePlayerOptions): Promise<VePlayerBase>;
|
|
1405
|
+
export { load, register, createVodPlayer };
|