@volcengine/veplayer 1.20.1-rc.3 → 1.20.1-rc.4
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 +208 -0
- package/index.min.js +2 -2
- package/lite.cjs +2 -2
- package/lite.d.ts +292 -0
- 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/index.d.ts
CHANGED
|
@@ -504,6 +504,121 @@ export interface ExternalItem {
|
|
|
504
504
|
value: boolean;
|
|
505
505
|
lang?: Lang;
|
|
506
506
|
}
|
|
507
|
+
/** {zh}
|
|
508
|
+
* @brief CSS 声明,支持驼峰、短横线属性名和 CSS 自定义属性。长度应包含单位。
|
|
509
|
+
*/
|
|
510
|
+
/** {en}
|
|
511
|
+
* @brief CSS declarations accepting camelCase, hyphenated names, and custom properties. Include units for lengths.
|
|
512
|
+
*/
|
|
513
|
+
export declare type SubtitleCss = Readonly<Record<string, string | number>>;
|
|
514
|
+
/** {zh}
|
|
515
|
+
* @brief 字幕背景框和文字的统一样式。
|
|
516
|
+
*/
|
|
517
|
+
/** {en}
|
|
518
|
+
* @brief Shared styles for the subtitle background box and text.
|
|
519
|
+
*/
|
|
520
|
+
export interface ISubtitleStyleConfig {
|
|
521
|
+
cueBoxStyle?: SubtitleCss;
|
|
522
|
+
textStyle?: SubtitleCss;
|
|
523
|
+
}
|
|
524
|
+
/** {zh}
|
|
525
|
+
* @brief 单条字幕的样式,可覆盖全局配置。
|
|
526
|
+
*/
|
|
527
|
+
/** {en}
|
|
528
|
+
* @brief Styles for a single cue, overriding shared configuration.
|
|
529
|
+
*/
|
|
530
|
+
export interface ISubtitleCueStyle extends ISubtitleStyleConfig {
|
|
531
|
+
wrapperStyle?: SubtitleCss;
|
|
532
|
+
}
|
|
533
|
+
/** {zh}
|
|
534
|
+
* @brief 可编辑的外层定位容器和背景框,文字位于 `.veplayer-webvtt-cue-text`。
|
|
535
|
+
*/
|
|
536
|
+
/** {en}
|
|
537
|
+
* @brief Editable positioning wrapper and background box containing `.veplayer-webvtt-cue-text`.
|
|
538
|
+
*/
|
|
539
|
+
export interface ISubtitleStyleBox {
|
|
540
|
+
div: HTMLElement;
|
|
541
|
+
cueDiv: HTMLElement;
|
|
542
|
+
}
|
|
543
|
+
/** {zh}
|
|
544
|
+
* @brief WebVTT 字幕及定位设置。起止时间以秒为单位。
|
|
545
|
+
*/
|
|
546
|
+
/** {en}
|
|
547
|
+
* @brief A WebVTT cue and its layout settings. Times are in seconds.
|
|
548
|
+
*/
|
|
549
|
+
export interface ISubtitleCue {
|
|
550
|
+
readonly id: string;
|
|
551
|
+
readonly text: string;
|
|
552
|
+
readonly classes: readonly string[];
|
|
553
|
+
readonly startTime: number;
|
|
554
|
+
readonly endTime: number;
|
|
555
|
+
readonly region_id?: string;
|
|
556
|
+
readonly line?: number;
|
|
557
|
+
readonly snapToLines: boolean;
|
|
558
|
+
readonly lineAlign?: "start" | "center" | "end";
|
|
559
|
+
readonly position?: number;
|
|
560
|
+
readonly positionAlign?: "line-left" | "center" | "line-right";
|
|
561
|
+
readonly size?: number;
|
|
562
|
+
readonly align: "start" | "center" | "end" | "left" | "right";
|
|
563
|
+
readonly vertical?: "rl" | "lr";
|
|
564
|
+
}
|
|
565
|
+
/** {zh}
|
|
566
|
+
* @brief WebVTT 区域的尺寸和锚点。
|
|
567
|
+
*/
|
|
568
|
+
/** {en}
|
|
569
|
+
* @brief WebVTT region dimensions and anchors.
|
|
570
|
+
*/
|
|
571
|
+
export interface ISubtitleRegion {
|
|
572
|
+
readonly width: number;
|
|
573
|
+
readonly lines: number;
|
|
574
|
+
readonly regionAnchorX: number;
|
|
575
|
+
readonly regionAnchorY: number;
|
|
576
|
+
readonly viewportAnchorX: number;
|
|
577
|
+
readonly viewportAnchorY: number;
|
|
578
|
+
readonly scroll: "" | "up";
|
|
579
|
+
}
|
|
580
|
+
/** {zh}
|
|
581
|
+
* @brief 按类名索引的 WebVTT 样式块。`veplayer-webvtt-cue-text` 表示默认 `::cue`。
|
|
582
|
+
*/
|
|
583
|
+
/** {en}
|
|
584
|
+
* @brief A WebVTT style block keyed by class name. `veplayer-webvtt-cue-text` represents the default `::cue`.
|
|
585
|
+
*/
|
|
586
|
+
export declare type SubtitleStyleBlock = Readonly<Record<string, SubtitleCss>>;
|
|
587
|
+
/** {zh}
|
|
588
|
+
* @brief 字幕编辑回调的上下文。索引和总数以当前渲染批次为准。
|
|
589
|
+
*/
|
|
590
|
+
/** {en}
|
|
591
|
+
* @brief Subtitle editor context. Cue indexes and counts refer to the current render batch.
|
|
592
|
+
*/
|
|
593
|
+
export declare type SubtitleEditorContext = {
|
|
594
|
+
type: "cue";
|
|
595
|
+
cue: ISubtitleCue;
|
|
596
|
+
cueIndex: number;
|
|
597
|
+
totalCues: number;
|
|
598
|
+
containerBox: DOMRectReadOnly;
|
|
599
|
+
paddedOverlay: HTMLElement;
|
|
600
|
+
} | {
|
|
601
|
+
type: "region";
|
|
602
|
+
regionContainer: HTMLElement;
|
|
603
|
+
regionData: Readonly<{
|
|
604
|
+
id: string;
|
|
605
|
+
region: ISubtitleRegion;
|
|
606
|
+
}>;
|
|
607
|
+
overlayEl: HTMLElement;
|
|
608
|
+
} | {
|
|
609
|
+
type: "style";
|
|
610
|
+
styles: readonly SubtitleStyleBlock[];
|
|
611
|
+
overlayEl: HTMLElement;
|
|
612
|
+
};
|
|
613
|
+
/** {zh}
|
|
614
|
+
* @brief WebVTT 编辑回调。仅 cue 回调提供 styleBox。
|
|
615
|
+
* @notes cue 和 region 可直接改 DOM 或返回样式。style 返回对象按类名及属性合并,返回数组替换全部样式。
|
|
616
|
+
*/
|
|
617
|
+
/** {en}
|
|
618
|
+
* @brief WebVTT editor. Only the cue callback receives a style box.
|
|
619
|
+
* @notes Cue and region callbacks may edit DOM or return styles. Return an object from style to merge declarations by class, or an array to replace all styles.
|
|
620
|
+
*/
|
|
621
|
+
export declare type SubtitleEditor = (styleBox: ISubtitleStyleBox | undefined, context: SubtitleEditorContext) => ISubtitleCueStyle | SubtitleCss | SubtitleStyleBlock | readonly SubtitleStyleBlock[] | void;
|
|
507
622
|
/** {zh}
|
|
508
623
|
* @brief 外挂字幕配置。
|
|
509
624
|
* @list Options
|
|
@@ -585,6 +700,37 @@ export interface ISubtitleConfig {
|
|
|
585
700
|
* ```
|
|
586
701
|
*/
|
|
587
702
|
label?: ISubtitleLabelOptions;
|
|
703
|
+
/** {zh}
|
|
704
|
+
* @brief Master M3U8 字幕轨的默认选择条件。配置的条件需唯一匹配;`language` 对应字幕轨的 `LANGUAGE`,`name` 对应 `NAME`。
|
|
705
|
+
* @list Options
|
|
706
|
+
* @kind property
|
|
707
|
+
* @notes 仅在未配置非空 `Subtitle.list` 时生效。未匹配或匹配到多条轨道时,回退到 Master M3U8 的默认轨;没有默认轨时回退到第一条。
|
|
708
|
+
* @example
|
|
709
|
+
* ``` javascript
|
|
710
|
+
* Subtitle: {
|
|
711
|
+
* defaultSubtitle: { language: 'zh' }
|
|
712
|
+
* }
|
|
713
|
+
* ```
|
|
714
|
+
*/
|
|
715
|
+
/** {en}
|
|
716
|
+
* @brief Selection criteria for the default subtitle track in a Master M3U8. The criteria must match one track; `language` matches the track's `LANGUAGE` and `name` matches its `NAME`.
|
|
717
|
+
* @list Options
|
|
718
|
+
* @kind property
|
|
719
|
+
* @notes Applies only when `Subtitle.list` is not configured with a non-empty list. If no track or multiple tracks match, falls back to the Master M3U8 default track, then the first track.
|
|
720
|
+
* @example
|
|
721
|
+
* ``` javascript
|
|
722
|
+
* Subtitle: {
|
|
723
|
+
* defaultSubtitle: { language: 'zh' }
|
|
724
|
+
* }
|
|
725
|
+
* ```
|
|
726
|
+
*/
|
|
727
|
+
defaultSubtitle?: {
|
|
728
|
+
language: string | number;
|
|
729
|
+
name?: string;
|
|
730
|
+
} | {
|
|
731
|
+
language?: string | number;
|
|
732
|
+
name: string;
|
|
733
|
+
};
|
|
588
734
|
/** {zh}
|
|
589
735
|
* @brief 是否默认打开字幕。
|
|
590
736
|
* @default true
|
|
@@ -644,6 +790,30 @@ export interface ISubtitleConfig {
|
|
|
644
790
|
* @default -
|
|
645
791
|
*/
|
|
646
792
|
style?: ISubtitleStyle;
|
|
793
|
+
/** {zh}
|
|
794
|
+
* @brief 点播外挂 WebVTT 样式的兼容入口。
|
|
795
|
+
* @notes 按 CSS 属性与 style 合并,同名属性以 style 为准。空对象仍可启用 WebVTT 渲染。
|
|
796
|
+
* @deprecated 请使用 style.cueBoxStyle 和 style.textStyle。
|
|
797
|
+
*/
|
|
798
|
+
/** {en}
|
|
799
|
+
* @brief Compatibility option for external VOD WebVTT styles.
|
|
800
|
+
* @notes Merges with style by CSS property. Values in style take precedence. An empty object still enables WebVTT rendering.
|
|
801
|
+
* @deprecated Use style.cueBoxStyle and style.textStyle.
|
|
802
|
+
*/
|
|
803
|
+
subtitleStyleConfig?: ISubtitleStyleConfig;
|
|
804
|
+
/** {zh}
|
|
805
|
+
* @brief 编辑 WebVTT 字幕、区域和样式块。字幕编辑可覆盖全局样式。
|
|
806
|
+
* @example
|
|
807
|
+
* Subtitle: { subtitleEditor: (_, context) =>
|
|
808
|
+
* context.type === 'cue' ? { textStyle: { fontWeight: 'bold' } } : undefined }
|
|
809
|
+
*/
|
|
810
|
+
/** {en}
|
|
811
|
+
* @brief Edit WebVTT cues, regions, and style blocks. Cue edits can override shared styles.
|
|
812
|
+
* @example
|
|
813
|
+
* Subtitle: { subtitleEditor: (_, context) =>
|
|
814
|
+
* context.type === 'cue' ? { textStyle: { fontWeight: 'bold' } } : undefined }
|
|
815
|
+
*/
|
|
816
|
+
subtitleEditor?: SubtitleEditor;
|
|
647
817
|
}
|
|
648
818
|
/** {zh}
|
|
649
819
|
* @list Options
|
|
@@ -656,6 +826,24 @@ export interface ISubtitleConfig {
|
|
|
656
826
|
* @kind property
|
|
657
827
|
*/
|
|
658
828
|
export interface ISubtitleStyle {
|
|
829
|
+
/** {zh}
|
|
830
|
+
* @brief 点播外挂 WebVTT 字幕的背景框样式。传入空对象可启用 WebVTT 渲染。
|
|
831
|
+
* @example Subtitle: { style: { cueBoxStyle: { borderRadius: '8px' } } }
|
|
832
|
+
*/
|
|
833
|
+
/** {en}
|
|
834
|
+
* @brief Styles the external VOD WebVTT cue background box. An empty object enables WebVTT rendering.
|
|
835
|
+
* @example Subtitle: { style: { cueBoxStyle: { borderRadius: '8px' } } }
|
|
836
|
+
*/
|
|
837
|
+
cueBoxStyle?: SubtitleCss;
|
|
838
|
+
/** {zh}
|
|
839
|
+
* @brief 点播外挂 WebVTT 字幕的文字样式。传入空对象可启用 WebVTT 渲染。
|
|
840
|
+
* @example Subtitle: { style: { textStyle: { display: 'block', lineHeight: 'normal' } } }
|
|
841
|
+
*/
|
|
842
|
+
/** {en}
|
|
843
|
+
* @brief Styles external VOD WebVTT cue text. An empty object enables WebVTT rendering.
|
|
844
|
+
* @example Subtitle: { style: { textStyle: { display: 'block', lineHeight: 'normal' } } }
|
|
845
|
+
*/
|
|
846
|
+
textStyle?: SubtitleCss;
|
|
659
847
|
/** {zh}
|
|
660
848
|
* @brief 是否跟随控制栏调整位置。
|
|
661
849
|
* @default false
|
|
@@ -10554,6 +10742,20 @@ declare class NativeSubTitle extends EventEmitter {
|
|
|
10554
10742
|
refresh(): void;
|
|
10555
10743
|
setPlaybackSessionId(playbackSessionId: string): void;
|
|
10556
10744
|
}
|
|
10745
|
+
export interface HlsRuntimeLike {
|
|
10746
|
+
levels: Array<Record<string, unknown>>;
|
|
10747
|
+
subtitleTracks?: Array<Record<string, unknown>>;
|
|
10748
|
+
subtitleTrack?: number;
|
|
10749
|
+
subtitleDisplay?: boolean;
|
|
10750
|
+
currentLevel: number;
|
|
10751
|
+
loadLevel: number;
|
|
10752
|
+
nextLevel: number;
|
|
10753
|
+
manualLevel: number;
|
|
10754
|
+
autoLevelEnabled: boolean;
|
|
10755
|
+
autoLevelCapping: number;
|
|
10756
|
+
on(event: string, listener: (...args: any[]) => void): void;
|
|
10757
|
+
off(event: string, listener: (...args: any[]) => void): void;
|
|
10758
|
+
}
|
|
10557
10759
|
export interface IPanelItem {
|
|
10558
10760
|
showText: string;
|
|
10559
10761
|
selected: boolean;
|
|
@@ -10596,10 +10798,14 @@ export declare class Subtitle extends Plugin {
|
|
|
10596
10798
|
curItem: ISubTitleItem;
|
|
10597
10799
|
player: Player & {
|
|
10598
10800
|
_subTitles?: NativeSubTitle | SubTitles;
|
|
10801
|
+
panel?: MobilePlayerPanel;
|
|
10599
10802
|
};
|
|
10803
|
+
private mobilePanelContent?;
|
|
10600
10804
|
private _hideListTimer;
|
|
10601
10805
|
private _optionListEnterHandler?;
|
|
10602
10806
|
private _optionListLeaveHandler?;
|
|
10807
|
+
private webVttPlayback?;
|
|
10808
|
+
private webVttHls?;
|
|
10603
10809
|
private _runtimeSubtitleSource;
|
|
10604
10810
|
private _runtimeSubtitleBridge?;
|
|
10605
10811
|
afterCreate(): void;
|
|
@@ -10633,6 +10839,8 @@ export declare class Subtitle extends Plugin {
|
|
|
10633
10839
|
openSubtitle(): Promise<any>;
|
|
10634
10840
|
getSubTitleIndex(list: ISubTitleItem[], subtitle?: Pick<ISubTitleItem, "id" | "language">): number;
|
|
10635
10841
|
setRuntimeSubtitleSource(source: "config" | "hls"): void;
|
|
10842
|
+
/** @hidden Connect the custom renderer to the current hls.js instance. */
|
|
10843
|
+
setWebVttHls(hls?: HlsRuntimeLike): void;
|
|
10636
10844
|
setRuntimeSubtitleBridge(bridge?: {
|
|
10637
10845
|
switchSubtitle: (subtitle: {
|
|
10638
10846
|
id?: string | number;
|