@byteplus/veplayer 1.19.0-rc.4 → 1.19.0-rc.6

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/lite.d.ts CHANGED
@@ -22,6 +22,892 @@ export declare enum UmdKeys {
22
22
  }
23
23
  /** Resolved UMD module values keyed by their public UMD key. */
24
24
  export type UmdModules = Partial<Record<UmdKeys, unknown>>;
25
+ interface ISubTitleItem {
26
+ /** {zh}
27
+ * @brief 字幕来源。业务配置字幕为 `config`,Master M3U8 或原生 HLS 字幕为 `hls`。
28
+ * @default config
29
+ */
30
+ /** {en}
31
+ * @brief Subtitle source. Business-configured subtitles use `config`; Master M3U8 or native HLS subtitles use `hls`.
32
+ * @default config
33
+ */
34
+ source?: "config" | "hls";
35
+ /** {zh}
36
+ * @brief 字幕语言。
37
+ * @default -
38
+ */
39
+ /** {en}
40
+ * @brief Subtitle language.
41
+ * @default -
42
+ */
43
+ language?: string | number;
44
+ /** {zh}
45
+ * @brief 字幕 ID。
46
+ * @default -
47
+ */
48
+ /** {en}
49
+ * @brief Subtitle ID.
50
+ * @default -
51
+ */
52
+ id?: number | string;
53
+ /** {zh}
54
+ * @brief 是否为默认选择的字幕。
55
+ * @default false
56
+ */
57
+ /** {en}
58
+ * @brief Whether this is the default selected subtitle.
59
+ * @default false
60
+ */
61
+ isDefault?: boolean;
62
+ /** {zh}
63
+ * @brief 是否为强制字幕轨。
64
+ * @default false
65
+ */
66
+ /** {en}
67
+ * @brief Whether the subtitle track is forced.
68
+ * @default false
69
+ */
70
+ forced?: boolean;
71
+ /** {zh}
72
+ * @brief HLS 字幕轨的特征标识,例如无障碍字幕特征;未声明时为空。
73
+ * @default -
74
+ */
75
+ /** {en}
76
+ * @brief HLS subtitle-track characteristics, such as accessibility traits; absent when not declared.
77
+ * @default -
78
+ */
79
+ characteristics?: string;
80
+ /** {zh}
81
+ * @brief 字幕名称。
82
+ * @default -
83
+ */
84
+ /** {en}
85
+ * @brief Subtitle display name.
86
+ * @default -
87
+ */
88
+ text?: ISubtitleLabelValue;
89
+ /** {zh}
90
+ * @brief 字幕名称。兼容 xgplayer-subtitles 的 label 字段。
91
+ * @default -
92
+ */
93
+ /** {en}
94
+ * @brief 字幕名称。兼容 xgplayer-subtitles 的 label 字段。
95
+ * @default -
96
+ */
97
+ label?: ISubtitleLabelValue;
98
+ /** {zh}
99
+ * @brief 外挂字幕 URL 地址。
100
+ * @default -
101
+ */
102
+ /** {en}
103
+ * @brief External subtitle URL.
104
+ * @default -
105
+ */
106
+ url?: string;
107
+ /**
108
+ * @hidden
109
+ * @type {string}
110
+ * @memberof ISubTitleItem
111
+ */
112
+ stringContent?: string;
113
+ /** {zh}
114
+ * @brief 字幕内容列表。非 `url` 形式时使用。
115
+ * @default -
116
+ * @type {Array<Object>}
117
+ * @memberof ISubTitleItem
118
+ */
119
+ /** {en}
120
+ * @brief Subtitle content list when not using URL.
121
+ * @default -
122
+ * @type {Array<Object>}
123
+ * @memberof ISubTitleItem
124
+ */
125
+ list?: IListItem[];
126
+ }
127
+ /** {zh}
128
+ * @brief 字幕项名称,可为静态文案或按播放器语言配置的文案表。
129
+ * @detail ref
130
+ */
131
+ /** {en}
132
+ * @brief Subtitle item name as static text or a text map keyed by player language.
133
+ * @detail ref
134
+ */
135
+ export type ISubtitleLabelValue = string | number | Record<string, string | number>;
136
+ /** {zh}
137
+ * @brief 字幕标签映射项。
138
+ * @detail ref
139
+ */
140
+ /** {en}
141
+ * @brief Mapping item used to customize a subtitle label.
142
+ * @detail ref
143
+ */
144
+ export interface ISubtitleLabelItem {
145
+ /** {zh} @brief 多语言 key 无法解析时使用的回退文案。 */
146
+ /** {en} @brief Fallback text used when the i18n key cannot be resolved. */
147
+ text?: string;
148
+ /** {zh} @brief 从播放器当前多语言词典中读取文案的 key。 */
149
+ /** {en} @brief Key resolved from the player's active i18n dictionary. */
150
+ textKey?: string;
151
+ }
152
+ /** {zh}
153
+ * @brief 字幕标签映射表。匹配优先级为 `id`、完整 `language`、基础 `language`、原始 `text`。
154
+ * @detail ref
155
+ */
156
+ /** {en}
157
+ * @brief Subtitle label maps. Match order is `id`, full `language`, base `language`, then source `text`.
158
+ * @detail ref
159
+ */
160
+ export interface ISubtitleLabelMap {
161
+ /** {zh} @brief 按稳定字幕 ID 映射;不建议用于会话内生成 ID 的 Master M3U8 字幕。 */
162
+ /** {en} @brief Maps stable subtitle IDs; not recommended for session-scoped Master M3U8 IDs. */
163
+ id?: Record<string, ISubtitleLabelItem>;
164
+ /** {zh} @brief 按字幕语言映射,忽略大小写并兼容 `_` 与 `-`。 */
165
+ /** {en} @brief Maps subtitle languages case-insensitively, treating `_` and `-` as equivalent. */
166
+ language?: Record<string, ISubtitleLabelItem>;
167
+ /** {zh} @brief 按字幕原始名称映射。 */
168
+ /** {en} @brief Maps the source subtitle name. */
169
+ text?: Record<string, ISubtitleLabelItem>;
170
+ }
171
+ /** {zh}
172
+ * @brief 传给字幕标签 formatter 的只读安全字幕快照,不包含 URL 或字幕内容。
173
+ * @detail ref
174
+ */
175
+ /** {en}
176
+ * @brief Read-only safe subtitle snapshot passed to the label formatter, excluding URLs and subtitle content.
177
+ * @detail ref
178
+ */
179
+ export interface ISubtitleLabelTrack {
180
+ source?: "config" | "hls";
181
+ id?: string | number;
182
+ language?: string | number;
183
+ isDefault?: boolean;
184
+ forced?: boolean;
185
+ characteristics?: string;
186
+ text?: string | number;
187
+ label?: string | number;
188
+ }
189
+ /** {zh}
190
+ * @brief 字幕标签格式化上下文。
191
+ * @detail ref
192
+ */
193
+ /** {en}
194
+ * @brief Context passed to the subtitle label formatter.
195
+ * @detail ref
196
+ */
197
+ export interface ISubtitleLabelContext {
198
+ /** {zh} @brief 当前字幕项的只读安全快照。 */
199
+ /** {en} @brief Read-only safe snapshot of the current subtitle item. */
200
+ item: Readonly<ISubtitleLabelTrack>;
201
+ /** {zh} @brief 当前字幕列表的只读安全快照。 */
202
+ /** {en} @brief Read-only safe snapshots of the current subtitle list. */
203
+ items: ReadonlyArray<Readonly<ISubtitleLabelTrack>>;
204
+ /** {zh} @brief 当前字幕项在列表中的位置。 */
205
+ /** {en} @brief Position of the current subtitle item in the list. */
206
+ index: number;
207
+ /** {zh} @brief 应用标签映射前的原始回退文案。 */
208
+ /** {en} @brief Source fallback text before applying label mappings. */
209
+ canonicalLabel: string;
210
+ /** {zh} @brief 应用 `textKey` 或 `text` 后的文案。 */
211
+ /** {en} @brief Label after applying `textKey` or `text`. */
212
+ localizedLabel: string;
213
+ /** {zh} @brief formatter 返回空值或抛出异常时使用的文案。 */
214
+ /** {en} @brief Label used when the formatter returns an empty value or throws. */
215
+ defaultLabel: string;
216
+ /** {zh} @brief 播放器当前语言。 */
217
+ /** {en} @brief Current player language. */
218
+ lang: string;
219
+ /** {zh} @brief 本地化后的文案是否在当前字幕列表中重复。 */
220
+ /** {en} @brief Whether the localized label is duplicated in the current subtitle list. */
221
+ duplicated: boolean;
222
+ }
223
+ /** {zh}
224
+ * @brief 字幕标签多语言映射与自定义格式化配置。
225
+ * @detail ref
226
+ */
227
+ /** {en}
228
+ * @brief Localization mapping and custom formatter for subtitle labels.
229
+ * @detail ref
230
+ */
231
+ export interface ISubtitleLabelOptions {
232
+ /** {zh} @brief 按字幕 ID、语言或原始名称配置展示文案。 */
233
+ /** {en} @brief Display-label mappings keyed by subtitle ID, language, or source name. */
234
+ map?: ISubtitleLabelMap;
235
+ /** {zh} @brief 同步格式化最终标签;返回空值、Promise 或抛出异常时回退到 `defaultLabel`。 */
236
+ /** {en} @brief Synchronously formats the final label; empty values, Promises, or exceptions fall back to `defaultLabel`. */
237
+ formatter?: (context: ISubtitleLabelContext) => string | null | undefined;
238
+ }
239
+ interface IListItem {
240
+ /** {zh}
241
+ * @brief 开始时间,单位为秒。
242
+ * @type {number}
243
+ */
244
+ /** {en}
245
+ * @brief Start time in seconds.
246
+ * @type {number}
247
+ */
248
+ start: number;
249
+ /** {zh}
250
+ * @brief 结束时间,单位为秒。
251
+ * @type {number}
252
+ */
253
+ /** {en}
254
+ * @brief End time in seconds.
255
+ * @type {number}
256
+ */
257
+ end: number;
258
+ /** {zh}
259
+ * @brief 字幕数据列表。
260
+ * @type {Array<ITextItem>}
261
+ */
262
+ /** {en}
263
+ * @brief Subtitle cue data list.
264
+ * @type {Array<ITextItem>}
265
+ */
266
+ list: Array<ITextItem>;
267
+ /**
268
+ * @hidden
269
+ * @type {any}
270
+ */
271
+ [propName: string]: any;
272
+ }
273
+ interface ITextItem {
274
+ /**
275
+ * @hidden
276
+ * @type {any}
277
+ */
278
+ [propName: string]: any;
279
+ /** {zh}
280
+ * @brief 开始时间,单位为秒。
281
+ * @type {number}
282
+ */
283
+ /** {en}
284
+ * @brief Start time in seconds.
285
+ * @type {number}
286
+ */
287
+ start: number;
288
+ /** {zh}
289
+ * @brief 结束时间,单位为秒。
290
+ * @type {number}
291
+ */
292
+ /** {en}
293
+ * @brief End time in seconds.
294
+ * @type {number}
295
+ */
296
+ end: number;
297
+ /** {zh}
298
+ * @brief 字幕文案数组。
299
+ * @type {string[]}
300
+ */
301
+ /** {en}
302
+ * @brief Subtitle text array.
303
+ * @type {string[]}
304
+ */
305
+ text: string[];
306
+ /** {zh}
307
+ * @brief 字幕顺序。
308
+ * @type {number}
309
+ */
310
+ /** {en}
311
+ * @brief Subtitle display order.
312
+ * @type {number}
313
+ */
314
+ index?: number;
315
+ }
316
+ /** {zh}
317
+ * @brief VePlayer 实际使用的 HLS 播放内核。
318
+ * @detail ref
319
+ */
320
+ /** {en}
321
+ * @brief The HLS playback engine actually used by VePlayer.
322
+ * @detail ref
323
+ */
324
+ export type HlsPlaybackEngine = "hlsjs" | "veplayer-hls" | "native" | "none";
325
+ /** {zh}
326
+ * @brief HLS 自动码率决策引擎配置值。
327
+ * @detail ref
328
+ */
329
+ /** {en}
330
+ * @brief Configurable HLS adaptive-bitrate decision engine.
331
+ * @detail ref
332
+ */
333
+ export type HlsAbrEngine = "hlsjs" | "veplayer";
334
+ /** {zh}
335
+ * @brief 当前播放会话最终解析出的自动码率决策引擎。
336
+ * @detail ref
337
+ */
338
+ /** {en}
339
+ * @brief Adaptive-bitrate decision engine resolved for the current playback session.
340
+ * @detail ref
341
+ */
342
+ export type ResolvedAbrEngine = HlsAbrEngine | "native" | "none";
343
+ /** {zh}
344
+ * @brief HLS 自动码率控制模式。
345
+ * @detail ref
346
+ */
347
+ /** {en}
348
+ * @brief HLS adaptive-bitrate control mode.
349
+ * @detail ref
350
+ */
351
+ export type HlsAbrMode = "auto" | "manual";
352
+ /** {zh}
353
+ * @brief 当前播放会话无法使用 HLS ABR 的原因。
354
+ * @detail ref
355
+ */
356
+ /** {en}
357
+ * @brief Reason why HLS ABR is unavailable for the current playback session.
358
+ * @detail ref
359
+ */
360
+ export type HlsAbrUnavailableReason = "NOT_HLS" | "NOT_HLSJS_ENGINE" | "MANIFEST_NOT_READY" | "MULTI_LEVEL_MASTER_REQUIRED" | "DEFINITION_LIST_REQUIRED" | "ABR_MODULE_UNAVAILABLE" | "ABR_RUNTIME_UNAVAILABLE" | "LICENSE_UNAVAILABLE" | "NO_ABR_VARIANTS";
361
+ /** {zh}
362
+ * @brief 当前 HLS 播放会话支持的 ABR 能力。
363
+ * @detail ref
364
+ */
365
+ /** {en}
366
+ * @brief ABR capabilities supported by the current HLS playback session.
367
+ * @detail ref
368
+ */
369
+ export interface IHlsAbrCapabilities {
370
+ /** {zh} @brief 是否可读取 HLS Level 列表。 */
371
+ /** {en} @brief Whether the HLS Level list is available. */
372
+ levelList: boolean;
373
+ /** {zh} @brief 是否支持手动切换 HLS Level。 */
374
+ /** {en} @brief Whether manual HLS Level switching is supported. */
375
+ manualLevelSwitch: boolean;
376
+ /** {zh} @brief 是否支持恢复当前 ABR 引擎的自动模式。 */
377
+ /** {en} @brief Whether automatic mode can be restored for the resolved ABR engine. */
378
+ restoreAuto: boolean;
379
+ /** {zh} @brief 是否支持按 Level 设置自动码率上限。 */
380
+ /** {en} @brief Whether an automatic bitrate cap can be set by Level. */
381
+ levelCap: boolean;
382
+ /** {zh} @brief 是否支持按码率设置自动码率上限。 */
383
+ /** {en} @brief Whether an automatic bitrate cap can be set by bitrate. */
384
+ bitrateCap: boolean;
385
+ /** {zh} @brief 是否支持按 VePlayer 清晰度设置自动码率上限。 */
386
+ /** {en} @brief Whether an automatic bitrate cap can be set by VePlayer definition. */
387
+ definitionCap: boolean;
388
+ }
389
+ /** {zh}
390
+ * @brief 当前播放会话的 HLS ABR 状态快照。
391
+ * @detail ref
392
+ */
393
+ /** {en}
394
+ * @brief HLS ABR state snapshot for the current playback session.
395
+ * @detail ref
396
+ */
397
+ export interface IHlsAbrState {
398
+ /** {zh} @brief 播放会话 ID,用于识别过期状态和事件。 */
399
+ /** {en} @brief Playback session ID used to reject stale state and events. */
400
+ playbackSessionId: string;
401
+ /** {zh} @brief VePlayer 实际使用的 HLS 播放内核。 */
402
+ /** {en} @brief HLS playback engine actually used by VePlayer. */
403
+ playbackEngine: HlsPlaybackEngine;
404
+ /** {zh} @brief 业务显式配置的 ABR 引擎;未配置时为 `null`。 */
405
+ /** {en} @brief Explicitly configured ABR engine, or `null` when omitted. */
406
+ configuredEngine: HlsAbrEngine | null;
407
+ /** {zh} @brief 当前播放会话最终解析出的 ABR 决策引擎。 */
408
+ /** {en} @brief ABR decision engine resolved for the current playback session. */
409
+ engine: ResolvedAbrEngine;
410
+ /** {zh} @brief 当前清晰度决策使用的数据源。 */
411
+ /** {en} @brief Data source used for the current rendition decision. */
412
+ decisionSource: "hls-levels" | "definition-list" | "native" | "none";
413
+ /** {zh} @brief 当前播放会话是否具备所选 ABR 引擎所需条件。 */
414
+ /** {en} @brief Whether the selected ABR engine is available in the current session. */
415
+ available: boolean;
416
+ /** {zh} @brief 当前 ABR 决策引擎是否正在自动选档。 */
417
+ /** {en} @brief Whether the resolved ABR engine is actively selecting renditions. */
418
+ active: boolean;
419
+ /** {zh} @brief 当前为自动模式还是手动模式。 */
420
+ /** {en} @brief Whether the current mode is automatic or manual. */
421
+ mode: HlsAbrMode;
422
+ /** {zh} @brief hls.js 当前实际播放的 Level 索引。 */
423
+ /** {en} @brief Current hls.js Level index being rendered. */
424
+ currentLevel?: number;
425
+ /** {zh} @brief VePlayer ABR 当前实际播放的清晰度。 */
426
+ /** {en} @brief Current definition rendered by VePlayer ABR. */
427
+ currentDefinition?: string;
428
+ /** {zh} @brief ABR 不可用时的稳定原因码。 */
429
+ /** {en} @brief Stable reason code when ABR is unavailable. */
430
+ reason?: HlsAbrUnavailableReason;
431
+ /** {zh} @brief 当前播放会话支持的 ABR 控制能力。 */
432
+ /** {en} @brief ABR control capabilities supported by the current session. */
433
+ capabilities: IHlsAbrCapabilities;
434
+ }
435
+ /** {zh}
436
+ * @brief HLS ABR 上限;`null` 表示清除上限。
437
+ * @detail ref
438
+ */
439
+ /** {en}
440
+ * @brief HLS ABR limit; `null` clears the active limit.
441
+ * @detail ref
442
+ */
443
+ export type IHlsAbrLimit = {
444
+ type: "level";
445
+ maxLevel: number;
446
+ } | {
447
+ type: "bitrate";
448
+ maxBitrate: number;
449
+ } | {
450
+ type: "definition";
451
+ maxDefinition: string;
452
+ } | null;
453
+ /** {zh}
454
+ * @brief `HLS_ABR_ENGINE_RESOLVED` 事件数据。
455
+ * @detail ref
456
+ */
457
+ /** {en}
458
+ * @brief Payload of the `HLS_ABR_ENGINE_RESOLVED` event.
459
+ * @detail ref
460
+ */
461
+ export interface IHlsAbrEngineResolvedEvent extends IHlsAbrState {
462
+ }
463
+ /** {zh}
464
+ * @brief `HLS_ABR_STATE_CHANGE` 事件数据。
465
+ * @detail ref
466
+ */
467
+ /** {en}
468
+ * @brief Payload of the `HLS_ABR_STATE_CHANGE` event.
469
+ * @detail ref
470
+ */
471
+ export interface IHlsAbrStateChangeEvent extends IHlsAbrState {
472
+ }
473
+ /** {zh}
474
+ * @brief `HLS_ABR_LIMIT_CHANGE` 事件数据。
475
+ * @detail ref
476
+ */
477
+ /** {en}
478
+ * @brief Payload of the `HLS_ABR_LIMIT_CHANGE` event.
479
+ * @detail ref
480
+ */
481
+ export interface IHlsAbrLimitChangeEvent {
482
+ /** {zh} @brief 事件所属的播放会话 ID。 */
483
+ /** {en} @brief Playback session ID that owns the event. */
484
+ playbackSessionId: string;
485
+ /** {zh} @brief 当前播放会话最终解析出的 ABR 决策引擎。 */
486
+ /** {en} @brief ABR decision engine resolved for the current playback session. */
487
+ engine: ResolvedAbrEngine;
488
+ /** {zh} @brief 已生效的 ABR 上限;`null` 表示上限已清除。 */
489
+ /** {en} @brief Applied ABR limit, or `null` when the limit has been cleared. */
490
+ limit: IHlsAbrLimit;
491
+ }
492
+ /** {zh}
493
+ * @brief Master M3U8 中一个标准化的 HLS Level;`index` 仅在当前播放会话内有效。
494
+ * @detail ref
495
+ */
496
+ /** {en}
497
+ * @brief A normalized HLS Level from a Master M3U8; `index` is valid only in the current playback session.
498
+ * @detail ref
499
+ */
500
+ export interface IHlsLevel {
501
+ /** {zh} @brief 当前播放会话内的 Level 索引。 */
502
+ /** {en} @brief Level index within the current playback session. */
503
+ index: number;
504
+ /** {zh} @brief 峰值码率,单位为 bit/s。 */
505
+ /** {en} @brief Peak bitrate in bits per second. */
506
+ bitrate: number;
507
+ /** {zh} @brief 平均码率,单位为 bit/s。 */
508
+ /** {en} @brief Average bitrate in bits per second. */
509
+ averageBitrate?: number;
510
+ /** {zh} @brief 视频宽度,单位为像素。 */
511
+ /** {en} @brief Video width in pixels. */
512
+ width?: number;
513
+ /** {zh} @brief 视频高度,单位为像素。 */
514
+ /** {en} @brief Video height in pixels. */
515
+ height?: number;
516
+ /** {zh} @brief 视频帧率。 */
517
+ /** {en} @brief Video frame rate. */
518
+ frameRate?: number;
519
+ /** {zh} @brief 视频编码标识。 */
520
+ /** {en} @brief Video codec identifier. */
521
+ videoCodec?: string;
522
+ /** {zh} @brief 音频编码标识。 */
523
+ /** {en} @brief Audio codec identifier. */
524
+ audioCodec?: string;
525
+ /** {zh} @brief 视频动态范围标识。 */
526
+ /** {en} @brief Video dynamic-range identifier. */
527
+ videoRange?: string;
528
+ /** {zh} @brief Manifest 声明的 Level 名称。 */
529
+ /** {en} @brief Level name declared by the manifest. */
530
+ name?: string;
531
+ }
532
+ /** {zh}
533
+ * @brief HLS Level 标签映射项。
534
+ * @detail ref
535
+ */
536
+ /** {en}
537
+ * @brief Mapping item used to customize an HLS Level label.
538
+ * @detail ref
539
+ */
540
+ export interface IHlsLevelLabelItem {
541
+ /** {zh} @brief 当多语言 key 无法解析时使用的回退文案。 */
542
+ /** {en} @brief Fallback text used when the i18n key cannot be resolved. */
543
+ text?: string;
544
+ /** {zh} @brief 从播放器当前多语言词典中读取文案的 key。 */
545
+ /** {en} @brief Key resolved from the player's active i18n dictionary. */
546
+ textKey?: string;
547
+ }
548
+ /** {zh}
549
+ * @brief HLS Level 标签格式化上下文。
550
+ * @detail ref
551
+ */
552
+ /** {en}
553
+ * @brief Context passed to the HLS Level label formatter.
554
+ * @detail ref
555
+ */
556
+ export interface IHlsLevelLabelContext {
557
+ /** {zh} @brief 当前 Level 的只读安全快照。 */
558
+ /** {en} @brief Read-only safe snapshot of the current Level. */
559
+ level: Readonly<IHlsLevel>;
560
+ /** {zh} @brief 当前播放会话全部 Level 的只读安全快照。 */
561
+ /** {en} @brief Read-only safe snapshots of all Levels in the current playback session. */
562
+ levels: ReadonlyArray<Readonly<IHlsLevel>>;
563
+ /** {zh} @brief 视频短边像素值;Manifest 未提供分辨率时为空。 */
564
+ /** {en} @brief Video short edge in pixels, or undefined when dimensions are unavailable. */
565
+ shortEdge?: number;
566
+ /** {zh} @brief 未本地化、未消歧的标准标签。 */
567
+ /** {en} @brief Canonical label before localization and disambiguation. */
568
+ canonicalLabel: string;
569
+ /** {zh} @brief 应用 `textKey` 或 `text` 后的基础标签。 */
570
+ /** {en} @brief Base label after applying `textKey` or `text`. */
571
+ localizedLabel: string;
572
+ /** {zh} @brief 完成 SDK 默认重名消歧后的标签。 */
573
+ /** {en} @brief Label after the SDK's default duplicate disambiguation. */
574
+ defaultLabel: string;
575
+ /** {zh} @brief 播放器当前语言。 */
576
+ /** {en} @brief Current player language. */
577
+ lang: string;
578
+ /** {zh} @brief 当前标准标签是否在 Level 列表中重复。 */
579
+ /** {en} @brief Whether the canonical label is duplicated in the Level list. */
580
+ duplicated: boolean;
581
+ }
582
+ /** {zh}
583
+ * @brief HLS Level 标签的多语言映射与自定义格式化配置。
584
+ * @detail ref
585
+ * @example
586
+ * ``` javascript
587
+ * hlsLevelLabel: {
588
+ * map: {
589
+ * '720p': { textKey: 'HLS_LEVEL_HD', text: '720p' }
590
+ * },
591
+ * formatter: ({ defaultLabel, level }) =>
592
+ * level.videoRange === 'PQ' ? `${defaultLabel} HDR` : defaultLabel
593
+ * }
594
+ * ```
595
+ */
596
+ /** {en}
597
+ * @brief Localization mapping and custom formatter for HLS Level labels.
598
+ * @detail ref
599
+ * @example
600
+ * ``` javascript
601
+ * hlsLevelLabel: {
602
+ * map: {
603
+ * '720p': { textKey: 'HLS_LEVEL_HD', text: '720p' }
604
+ * },
605
+ * formatter: ({ defaultLabel, level }) =>
606
+ * level.videoRange === 'PQ' ? `${defaultLabel} HDR` : defaultLabel
607
+ * }
608
+ * ```
609
+ */
610
+ export interface IHlsLevelLabelOptions {
611
+ /** {zh} @brief 按标准标签(如 `720p`、`1080p`)配置展示文案。 */
612
+ /** {en} @brief Display-label mappings keyed by canonical labels such as `720p` and `1080p`. */
613
+ map?: Record<string, IHlsLevelLabelItem>;
614
+ /** {zh} @brief 同步格式化最终标签;返回空值或抛出异常时回退到 `defaultLabel`。 */
615
+ /** {en} @brief Synchronously formats the final label; empty returns or exceptions fall back to `defaultLabel`. */
616
+ formatter?: (context: IHlsLevelLabelContext) => string | null | undefined;
617
+ }
618
+ /** {zh}
619
+ * @brief 当前播放会话的 HLS Level 状态快照。
620
+ * @detail ref
621
+ */
622
+ /** {en}
623
+ * @brief HLS Level state snapshot for the current playback session.
624
+ * @detail ref
625
+ */
626
+ export interface IHlsLevelState {
627
+ /** {zh} @brief 播放会话 ID,用于识别过期状态和事件。 */
628
+ /** {en} @brief Playback session ID used to reject stale state and events. */
629
+ playbackSessionId: string;
630
+ /** {zh} @brief Level 列表是否已就绪。 */
631
+ /** {en} @brief Whether the Level list is ready. */
632
+ ready: boolean;
633
+ /** {zh} @brief 当前播放会话内的标准化 Level 列表。 */
634
+ /** {en} @brief Normalized Level list for the current playback session. */
635
+ levels: IHlsLevel[];
636
+ /** {zh} @brief 当前实际播放的 Level 索引,未知时为 `-1`。 */
637
+ /** {en} @brief Currently rendered Level index, or `-1` when unknown. */
638
+ currentLevel: number;
639
+ /** {zh} @brief 当前加载的 Level 索引,未知时为 `-1`。 */
640
+ /** {en} @brief Currently loaded Level index, or `-1` when unknown. */
641
+ loadLevel: number;
642
+ /** {zh} @brief 下一个分片使用的 Level 索引,未知时为 `-1`。 */
643
+ /** {en} @brief Level index for the next fragment, or `-1` when unknown. */
644
+ nextLevel: number;
645
+ /** {zh} @brief 手动 Level 索引;自动模式下为 `-1`。 */
646
+ /** {en} @brief Manual Level index; `-1` in automatic mode. */
647
+ manualLevel: number;
648
+ /** {zh} @brief hls.js 是否处于自动选档模式。 */
649
+ /** {en} @brief Whether hls.js automatic Level selection is enabled. */
650
+ autoLevelEnabled: boolean;
651
+ /** {zh} @brief hls.js 自动选档的 Level 上限;未设置时为 `-1`。 */
652
+ /** {en} @brief hls.js automatic Level cap; `-1` when unset. */
653
+ autoLevelCapping: number;
654
+ }
655
+ /** {zh}
656
+ * @brief HLS Level 手动切换模式。
657
+ * @detail ref
658
+ */
659
+ /** {en}
660
+ * @brief Manual HLS Level switching mode.
661
+ * @detail ref
662
+ */
663
+ export type HlsLevelSwitchMode = "immediate" | "next-fragment" | "smooth";
664
+ /** {zh}
665
+ * @brief 手动切换 HLS Level 的选项。
666
+ * @detail ref
667
+ */
668
+ /** {en}
669
+ * @brief Options for manually switching an HLS Level.
670
+ * @detail ref
671
+ */
672
+ export interface IHlsLevelSwitchOptions {
673
+ /** {zh} @brief 切换模式,默认为 `next-fragment`。 */
674
+ /** {en} @brief Switching mode. Defaults to `next-fragment`. */
675
+ mode?: HlsLevelSwitchMode;
676
+ /** {zh} @brief 可选的播放会话 ID;不匹配时拒绝本次切换。 */
677
+ /** {en} @brief Optional playback session ID; a mismatch rejects the switch. */
678
+ playbackSessionId?: string;
679
+ }
680
+ /** {zh}
681
+ * @brief HLS Level 切换事件数据。
682
+ * @detail ref
683
+ */
684
+ /** {en}
685
+ * @brief HLS Level switching event payload.
686
+ * @detail ref
687
+ */
688
+ export interface IHlsLevelSwitchEvent {
689
+ /** {zh} @brief 事件所属的播放会话 ID。 */
690
+ /** {en} @brief Playback session ID that owns the event. */
691
+ playbackSessionId: string;
692
+ /** {zh} @brief 切换前的 Level 索引。 */
693
+ /** {en} @brief Level index before switching. */
694
+ from: number;
695
+ /** {zh} @brief 目标或已切换到的 Level 索引。 */
696
+ /** {en} @brief Target or switched-to Level index. */
697
+ to: number;
698
+ /** {zh} @brief 本次切换由手动操作还是 ABR 触发。 */
699
+ /** {en} @brief Whether the switch was triggered manually or by ABR. */
700
+ reason: "manual" | "abr";
701
+ /** {zh} @brief 当前播放会话的 ABR 决策引擎。 */
702
+ /** {en} @brief ABR decision engine for the current playback session. */
703
+ abrEngine: ResolvedAbrEngine;
704
+ /** {zh} @brief 目标或已生效的安全 Level 快照。 */
705
+ /** {en} @brief Safe snapshot of the target or active Level. */
706
+ level?: IHlsLevel;
707
+ }
708
+ /** {zh}
709
+ * @brief `HLS_SUBTITLE_TRACKS_UPDATED` 事件数据。
710
+ * @detail ref
711
+ */
712
+ /** {en}
713
+ * @brief Payload of the `HLS_SUBTITLE_TRACKS_UPDATED` event.
714
+ * @detail ref
715
+ */
716
+ export interface IHlsSubtitleTracksUpdatedEvent {
717
+ /** {zh} @brief 事件所属的播放会话 ID。 */
718
+ /** {en} @brief Playback session ID that owns the event. */
719
+ playbackSessionId: string;
720
+ /** {zh} @brief 当前实际使用的 HLS 播放内核。 */
721
+ /** {en} @brief HLS playback engine actually used by the session. */
722
+ playbackEngine: HlsPlaybackEngine;
723
+ /** {zh} @brief 不含播放地址和底层轨道索引的安全字幕列表。 */
724
+ /** {en} @brief Safe subtitle list without media URLs or internal track indexes. */
725
+ tracks: ReadonlyArray<ISubTitleItem>;
726
+ }
727
+ /** {zh}
728
+ * @brief HLS 字幕轨切换事件数据。
729
+ * @detail ref
730
+ */
731
+ /** {en}
732
+ * @brief HLS subtitle-track switching event payload.
733
+ * @detail ref
734
+ */
735
+ export interface IHlsSubtitleTrackSwitchEvent {
736
+ /** {zh} @brief 事件所属的播放会话 ID。 */
737
+ /** {en} @brief Playback session ID that owns the event. */
738
+ playbackSessionId: string;
739
+ /** {zh} @brief 当前实际使用的 HLS 播放内核。 */
740
+ /** {en} @brief HLS playback engine actually used by the session. */
741
+ playbackEngine: HlsPlaybackEngine;
742
+ /** {zh} @brief 切换前的安全字幕 ID;关闭状态为 `null`。 */
743
+ /** {en} @brief Safe subtitle ID before switching, or `null` when disabled. */
744
+ from: string | number | null;
745
+ /** {zh} @brief 目标或已生效的安全字幕 ID;关闭状态为 `null`。 */
746
+ /** {en} @brief Target or active safe subtitle ID, or `null` when disabled. */
747
+ to: string | number | null;
748
+ /** {zh} @brief 目标或已生效的安全字幕快照。 */
749
+ /** {en} @brief Safe snapshot of the target or active subtitle track. */
750
+ track?: ISubTitleItem;
751
+ }
752
+ /** {zh}
753
+ * @brief HLS 控制 API 的标准错误码。
754
+ * @detail ref
755
+ */
756
+ /** {en}
757
+ * @brief Standard error codes for HLS control APIs.
758
+ * @detail ref
759
+ */
760
+ export type HlsControlErrorCode = "HLS_MANIFEST_NOT_READY" | "HLS_ENGINE_UNSUPPORTED" | "HLS_LEVEL_OUT_OF_RANGE" | "HLS_PLAYBACK_SESSION_EXPIRED" | "HLS_ABR_UNAVAILABLE" | "HLS_ABR_LIMIT_UNSUPPORTED" | "HLS_SUBTITLE_TRACK_NOT_FOUND" | "HLS_SUBTITLE_TRACK_AMBIGUOUS" | "HLS_SUBTITLE_SWITCH_FAILED" | "HLS_SUBTITLE_SWITCH_TIMEOUT";
761
+ /** {zh}
762
+ * @brief HLS Level、ABR 或字幕控制失败时抛出的标准错误。
763
+ * @detail Api
764
+ */
765
+ /** {en}
766
+ * @brief Standard error thrown when HLS Level, ABR, or subtitle control fails.
767
+ * @detail Api
768
+ */
769
+ export declare class HlsControlError extends Error {
770
+ /** {zh} @brief 稳定的 HLS 控制错误码。 */
771
+ /** {en} @brief Stable HLS control error code. */
772
+ readonly code: HlsControlErrorCode;
773
+ constructor(code: HlsControlErrorCode, message: string);
774
+ }
775
+ /** {zh}
776
+ * @list Options
777
+ * @brief 自适应码率配置。
778
+ * @kind property
779
+ */
780
+ /** {en}
781
+ * @list Options
782
+ * @brief Adaptive bitrate (ABR) playback configuration.
783
+ * @kind property
784
+ */
785
+ export interface IAutoBitrateOpts {
786
+ /** {zh}
787
+ * @brief 是否开启自适应码率功能。
788
+ * @default false
789
+ */
790
+ /** {en}
791
+ * @brief Whether to enable adaptive bitrate (ABR).
792
+ * @default false
793
+ */
794
+ enable: boolean;
795
+ /** {zh}
796
+ * @brief HLS 自动码率决策引擎。仅对 HLS 生效;开启 ABR 但不设置时,为兼容旧版本使用 VePlayer ABR。
797
+ * @default veplayer
798
+ */
799
+ /** {en}
800
+ * @brief HLS adaptive-bitrate decision engine. Applies only to HLS; when ABR is enabled and this field is omitted, VePlayer ABR is used for backward compatibility.
801
+ * @default veplayer
802
+ */
803
+ engine?: HlsAbrEngine;
804
+ /** {zh}
805
+ * @brief 是否以自动清晰度档位起播。开启自适应码率功能且 `defaultDefinition` 为 `auto` 时,才会以自动清晰度档位起播。
806
+ * @default false
807
+ */
808
+ /** {en}
809
+ * @brief Whether to start playback with the auto definition level. Takes effect only when ABR is enabled and `defaultDefinition` is `auto`.
810
+ * @default false
811
+ */
812
+ startWithAuto?: boolean;
813
+ /** {zh}
814
+ * @brief 自动清晰度档位是否展示当前实际清晰度,如自动(720p)。
815
+ * @default false
816
+ */
817
+ /** {en}
818
+ * @brief Whether the auto definition label shows the actual resolution, e.g. Auto (720p).
819
+ * @default false
820
+ */
821
+ showRealDefinition?: boolean;
822
+ /** {zh}
823
+ * @brief 自动清晰度档位的显示文案。
824
+ * @default 自动
825
+ */
826
+ /** {en}
827
+ * @brief Display text for the auto definition level.
828
+ * @default auto
829
+ */
830
+ autoDefinitionText?: string;
831
+ /** {zh}
832
+ * @brief 自动清晰度档位的多语言 key。
833
+ * @default DEFINITION_AUTO
834
+ */
835
+ /** {en}
836
+ * @brief i18n key for the auto definition level label.
837
+ * @default DEFINITION_AUTO
838
+ */
839
+ definitionTextKey?: string;
840
+ /**
841
+ * @hidden
842
+ * @brief 软解module
843
+ */
844
+ module?: unknown;
845
+ }
846
+ interface AudioTrackOption {
847
+ /** {zh}
848
+ * @brief 音轨主要语言,BCP-47 格式(如 `zh`、`en`)。对应 `#EXT-X-MEDIA` 的 `LANGUAGE`。
849
+ */
850
+ /** {en}
851
+ * @brief Primary track language in BCP-47 format (e.g. `zh`, `en`). Maps to `#EXT-X-MEDIA` `LANGUAGE`.
852
+ */
853
+ lang?: string;
854
+ /** {zh}
855
+ * @brief 关联语言代码。对应 `#EXT-X-MEDIA` 的 `ASSOC-LANGUAGE`。
856
+ */
857
+ /** {en}
858
+ * @brief Associated language code. Maps to `#EXT-X-MEDIA` `ASSOC-LANGUAGE`.
859
+ */
860
+ assocLang?: string;
861
+ /** {zh}
862
+ * @brief 轨道特征描述字符串。对应 `#EXT-X-MEDIA` 的 `CHARACTERISTICS`(如 `public.accessibility.describes-video`)。
863
+ */
864
+ /** {en}
865
+ * @brief Track characteristics string. Maps to `#EXT-X-MEDIA` `CHARACTERISTICS`.
866
+ */
867
+ characteristics?: string;
868
+ /** {zh}
869
+ * @brief 声道数。对应 `#EXT-X-MEDIA` 的 `CHANNELS`(如 `"2"`)。
870
+ */
871
+ /** {en}
872
+ * @brief Number of audio channels. Maps to `#EXT-X-MEDIA` `CHANNELS` (e.g. `"2"`).
873
+ */
874
+ channels?: string;
875
+ /** {zh}
876
+ * @brief 音轨名称,用于展示或精确匹配(如 `Stereo`)。hls.js 路径下与 `lang` 组合可唯一定位轨道。
877
+ */
878
+ /** {en}
879
+ * @brief Track name for display or precise matching (e.g. `Stereo`). With `lang`, uniquely identifies a track on the hls.js path.
880
+ */
881
+ name?: string;
882
+ /** {zh}
883
+ * @brief 音频编解码器标识(如 `mp4a.40.2`)。
884
+ */
885
+ /** {en}
886
+ * @brief Audio codec identifier (e.g. `mp4a.40.2`).
887
+ */
888
+ audioCodec?: string;
889
+ /** {zh}
890
+ * @brief 音频组 ID。对应 `#EXT-X-MEDIA` 的 `GROUP-ID`。
891
+ */
892
+ /** {en}
893
+ * @brief Audio group ID. Maps to `#EXT-X-MEDIA` `GROUP-ID`.
894
+ */
895
+ groupId?: string;
896
+ /** {zh}
897
+ * @brief 是否为 manifest 中的默认音轨。
898
+ */
899
+ /** {en}
900
+ * @brief Whether this is the default track declared in the manifest.
901
+ */
902
+ default?: boolean;
903
+ /** {zh}
904
+ * @hidden
905
+ */
906
+ /** {en}
907
+ * @hidden
908
+ */
909
+ [key: string]: unknown;
910
+ }
25
911
  /** Video and audio codec names supported by the player. */
26
912
  export declare const CodecType: {
27
913
  readonly H264: "h264";
@@ -71,6 +957,9 @@ export declare const enum POSITIONS {
71
957
  /** Public event-name map shared by Lite and Full UMD constructors. */
72
958
  export interface LiteEvents {
73
959
  readonly READY: "ready";
960
+ readonly HLS_LEVEL_SWITCHING: "hls_level_switching";
961
+ readonly HLS_LEVEL_SWITCHED: "hls_level_switched";
962
+ readonly HLS_ABR_LIMIT_CHANGE: "hls_abr_limit_change";
74
963
  readonly [eventName: string]: string;
75
964
  }
76
965
  /** Legacy grouped event-name map. */
@@ -204,6 +1093,7 @@ export interface LitePlayerPlaybackStateSnapshot {
204
1093
  isBeforePlayerCreate: boolean;
205
1094
  albumId: string | null;
206
1095
  episodeId: string | null;
1096
+ vid: string | null;
207
1097
  playbackSessionId: string;
208
1098
  duration: number;
209
1099
  currentTime: number;
@@ -334,6 +1224,19 @@ export interface LiteTTDramaEnv {
334
1224
  getDramaInfo: (callback: (res: LiteDramaInfoResponse) => void, options: LiteDramaInfoRequest) => void;
335
1225
  videoSecurityModule?: unknown;
336
1226
  sendLog: (eventName: string, params: Record<string, unknown>) => void;
1227
+ /** {zh}
1228
+ * @hidden
1229
+ * @brief 当前在播短剧身份变化通知,由宿主集成层消费。
1230
+ */
1231
+ /** {en}
1232
+ * @hidden
1233
+ * @brief Notifies the host integration when the current drama playback identity changes.
1234
+ */
1235
+ onCurrentDramaPlaybackContextChange?: (context: {
1236
+ albumId: string | null;
1237
+ episodeId: string | null;
1238
+ vid: string | null;
1239
+ } | null) => boolean | void;
337
1240
  getTokenVerifySecret?: () => Promise<string>;
338
1241
  }
339
1242
  export interface LiteDefaultConfig {
@@ -371,8 +1274,11 @@ export interface LiteStream<MediaUrl extends LiteMediaUrl = LiteMediaUrl> {
371
1274
  }
372
1275
  export interface LiteSubtitleConfig {
373
1276
  list?: LiteSubtitleItem[];
1277
+ label?: ISubtitleLabelOptions;
374
1278
  defaultSubtitleId?: string | number;
375
1279
  defaultSubtitleLanguage?: string | number;
1280
+ mode?: "external" | "native";
1281
+ nativeRenderMode?: "system" | "dom";
376
1282
  updateMode?: "vod";
377
1283
  [key: string]: unknown;
378
1284
  }
@@ -533,9 +1439,13 @@ export interface LitePlayerConfig<MediaUrl extends LiteMediaUrl = LiteMediaUrl,
533
1439
  mobile?: LiteMobileConfig;
534
1440
  start?: LiteStartConfig;
535
1441
  enableHlsMSE?: boolean;
1442
+ enableMobileHlsPlugin?: boolean;
1443
+ enableHlsJs?: boolean;
1444
+ hlsLevelSwitchMode?: HlsLevelSwitchMode;
536
1445
  useHlsPluginForSafari?: boolean;
537
1446
  enableMp4MSE?: boolean;
538
1447
  defaultDefinition?: string;
1448
+ audioPreference?: AudioTrackOption;
539
1449
  plugins?: unknown[];
540
1450
  presets?: unknown[];
541
1451
  ignores?: string[];
@@ -590,9 +1500,13 @@ export interface LiteDefinition {
590
1500
  export interface LiteSubtitleItem {
591
1501
  id?: string | number;
592
1502
  language?: string | number;
593
- label?: string | number;
594
- text?: string;
1503
+ label?: ISubtitleLabelValue;
1504
+ text?: ISubtitleLabelValue;
595
1505
  url?: string;
1506
+ isDefault?: boolean;
1507
+ source?: "config" | "hls";
1508
+ forced?: boolean;
1509
+ characteristics?: string;
596
1510
  }
597
1511
  export interface LitePluginInstance {
598
1512
  readonly pluginName?: string;
@@ -601,6 +1515,11 @@ export interface LitePluginConstructor<Instance extends LitePluginInstance = Lit
601
1515
  readonly pluginName?: string;
602
1516
  new (...args: unknown[]): Instance;
603
1517
  }
1518
+ type LiteHlsEventPayloadMap = {
1519
+ hls_abr_limit_change: IHlsAbrLimitChangeEvent;
1520
+ hls_level_switching: IHlsLevelSwitchEvent;
1521
+ hls_level_switched: IHlsLevelSwitchEvent;
1522
+ };
604
1523
  export interface LiteVePlayer {
605
1524
  readonly preLoadData: {
606
1525
  hit: number;
@@ -615,6 +1534,10 @@ export interface LiteVePlayer {
615
1534
  emit(action: string, payload?: unknown): void;
616
1535
  getCurrentPlayerConfig(): LiteDefaultConfig;
617
1536
  getDefinitionList(): LiteDefinition[];
1537
+ getHlsAbrLimit(): IHlsAbrLimit;
1538
+ getHlsAbrState(): IHlsAbrState;
1539
+ getHlsLevels(): IHlsLevel[];
1540
+ getHlsLevelState(): IHlsLevelState;
618
1541
  getLogUserId(): string | undefined;
619
1542
  getPlayerInstance(): unknown;
620
1543
  getPlugin(pluginName: string): LitePluginInstance | null;
@@ -623,10 +1546,14 @@ export interface LiteVePlayer {
623
1546
  hideSubtitle(): void;
624
1547
  next<MediaUrl extends LiteMediaUrl, StreamUrl extends LiteMediaUrl>(config: LitePlayerConfig<MediaUrl, StreamUrl>, isNewVideo?: boolean): Promise<void>;
625
1548
  off(action: string, func: (...args: unknown[]) => void): void;
1549
+ on<EventName extends keyof LiteHlsEventPayloadMap>(action: EventName, func: (payload: LiteHlsEventPayloadMap[EventName]) => void): void;
626
1550
  on(action: string, func: (...args: unknown[]) => void): void;
627
1551
  once(action: string, func: (...args: unknown[]) => void): void;
628
1552
  playNext<MediaUrl extends LiteMediaUrl, StreamUrl extends LiteMediaUrl>(config: LitePlayerConfig<MediaUrl, StreamUrl>, isNewVideo?: boolean): Promise<unknown>;
629
1553
  showSubtitle(): void;
1554
+ setHlsAbrLimit(limit: IHlsAbrLimit): void;
1555
+ setHlsAbrMode(mode: HlsAbrMode): void;
1556
+ setHlsLevel(levelIndex: number, options?: IHlsLevelSwitchOptions): void;
630
1557
  switchAuthToken(config: LitePlayAuthTokenConfig, isNewVideo?: boolean): Promise<void>;
631
1558
  switchSubtitle(subtitle: {
632
1559
  id?: string | number;