@byteplus/veplayer 1.19.0-rc.2 → 1.19.0-rc.3
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/index.d.ts +296 -4
- package/index.min.js +2 -2
- package/lite.cjs +2 -2
- package/lite.d.ts +203 -4
- package/lite.esm.mjs +2 -2
- package/lite.min.js +2 -2
- package/package.json +1 -1
- package/plugin/modules/DashAbralgo.mjs +1 -1
- package/plugin/modules/XGVideo.mjs +1 -1
- package/plugin/modules/danmuMask.mjs +1 -1
- package/plugin/modules/danmujs.mjs +1 -1
- package/plugin/modules/dash.mjs +1 -1
- package/plugin/modules/flv.mjs +1 -1
- package/plugin/modules/hls.mjs +1 -1
- package/plugin/modules/hlsEncrypt.mjs +1 -1
- package/plugin/modules/hlsjs.mjs +1 -1
- package/plugin/modules/hlsjsPro.mjs +1 -1
- package/plugin/modules/mp4Encrypt.mjs +1 -1
- package/plugin/modules/preloader.mjs +1 -1
- package/plugin/modules/streamprobe.mjs +1 -1
- package/plugin/modules/vestrategy.mjs +1 -1
- package/plugin/modules/vestrategy_adapt_range.mjs +1 -1
- package/plugin/modules/vestrategy_h265.mjs +1 -1
- package/plugin/modules/vestrategy_preload.mjs +1 -1
package/lite.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ interface ISubTitleItem {
|
|
|
85
85
|
* @brief Subtitle display name.
|
|
86
86
|
* @default -
|
|
87
87
|
*/
|
|
88
|
-
text?:
|
|
88
|
+
text?: ISubtitleLabelValue;
|
|
89
89
|
/** {zh}
|
|
90
90
|
* @brief 字幕名称。兼容 xgplayer-subtitles 的 label 字段。
|
|
91
91
|
* @default -
|
|
@@ -94,7 +94,7 @@ interface ISubTitleItem {
|
|
|
94
94
|
* @brief 字幕名称。兼容 xgplayer-subtitles 的 label 字段。
|
|
95
95
|
* @default -
|
|
96
96
|
*/
|
|
97
|
-
label?:
|
|
97
|
+
label?: ISubtitleLabelValue;
|
|
98
98
|
/** {zh}
|
|
99
99
|
* @brief 外挂字幕 URL 地址。
|
|
100
100
|
* @default -
|
|
@@ -124,6 +124,118 @@ interface ISubTitleItem {
|
|
|
124
124
|
*/
|
|
125
125
|
list?: IListItem[];
|
|
126
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
|
+
}
|
|
127
239
|
interface IListItem {
|
|
128
240
|
/** {zh}
|
|
129
241
|
* @brief 开始时间,单位为秒。
|
|
@@ -417,6 +529,92 @@ export interface IHlsLevel {
|
|
|
417
529
|
/** {en} @brief Level name declared by the manifest. */
|
|
418
530
|
name?: string;
|
|
419
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
|
+
}
|
|
420
618
|
/** {zh}
|
|
421
619
|
* @brief 当前播放会话的 HLS Level 状态快照。
|
|
422
620
|
* @detail ref
|
|
@@ -994,6 +1192,7 @@ export interface LiteStream<MediaUrl extends LiteMediaUrl = LiteMediaUrl> {
|
|
|
994
1192
|
}
|
|
995
1193
|
export interface LiteSubtitleConfig {
|
|
996
1194
|
list?: LiteSubtitleItem[];
|
|
1195
|
+
label?: ISubtitleLabelOptions;
|
|
997
1196
|
defaultSubtitleId?: string | number;
|
|
998
1197
|
defaultSubtitleLanguage?: string | number;
|
|
999
1198
|
mode?: "external" | "native";
|
|
@@ -1216,8 +1415,8 @@ export interface LiteDefinition {
|
|
|
1216
1415
|
export interface LiteSubtitleItem {
|
|
1217
1416
|
id?: string | number;
|
|
1218
1417
|
language?: string | number;
|
|
1219
|
-
label?:
|
|
1220
|
-
text?:
|
|
1418
|
+
label?: ISubtitleLabelValue;
|
|
1419
|
+
text?: ISubtitleLabelValue;
|
|
1221
1420
|
url?: string;
|
|
1222
1421
|
isDefault?: boolean;
|
|
1223
1422
|
source?: "config" | "hls";
|