@volcengine/veplayer 1.20.1-rc.4 → 1.20.1-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/index.d.ts CHANGED
@@ -597,6 +597,11 @@ export declare type SubtitleEditorContext = {
597
597
  totalCues: number;
598
598
  containerBox: DOMRectReadOnly;
599
599
  paddedOverlay: HTMLElement;
600
+ } | {
601
+ type: "cue-final";
602
+ cue: ISubtitleCue;
603
+ cueIndex: number;
604
+ totalCues: number;
600
605
  } | {
601
606
  type: "region";
602
607
  regionContainer: HTMLElement;
@@ -611,12 +616,12 @@ export declare type SubtitleEditorContext = {
611
616
  overlayEl: HTMLElement;
612
617
  };
613
618
  /** {zh}
614
- * @brief WebVTT 编辑回调。仅 cue 回调提供 styleBox。
615
- * @notes cue 和 region 可直接改 DOM 或返回样式。style 返回对象按类名及属性合并,返回数组替换全部样式。
619
+ * @brief WebVTT 编辑回调。cue 和 cue-final 回调提供 styleBox。
620
+ * @notes cue、cue-final 和 region 可直接改 DOM 或返回样式。cue-final 的样式在 cue 阶段之后生效。style 返回对象按类名及属性合并,返回数组替换全部样式。
616
621
  */
617
622
  /** {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.
623
+ * @brief WebVTT editor. The cue and cue-final callbacks receive a style box.
624
+ * @notes The cue, cue-final, and region callbacks may edit DOM or return styles. Cue-final styles apply after cue edits. Return an object from style to merge declarations by class, or an array to replace all styles.
620
625
  */
621
626
  export declare type SubtitleEditor = (styleBox: ISubtitleStyleBox | undefined, context: SubtitleEditorContext) => ISubtitleCueStyle | SubtitleCss | SubtitleStyleBlock | readonly SubtitleStyleBlock[] | void;
622
627
  /** {zh}
@@ -803,17 +808,36 @@ export interface ISubtitleConfig {
803
808
  subtitleStyleConfig?: ISubtitleStyleConfig;
804
809
  /** {zh}
805
810
  * @brief 编辑 WebVTT 字幕、区域和样式块。字幕编辑可覆盖全局样式。
811
+ * @notes 启用 enableSubtitleCueFinal 后,可在 cue-final 阶段测量字幕 DOM 并应用最终样式。
806
812
  * @example
807
813
  * Subtitle: { subtitleEditor: (_, context) =>
808
814
  * context.type === 'cue' ? { textStyle: { fontWeight: 'bold' } } : undefined }
809
815
  */
810
816
  /** {en}
811
817
  * @brief Edit WebVTT cues, regions, and style blocks. Cue edits can override shared styles.
818
+ * @notes Enable enableSubtitleCueFinal to measure cue DOM and apply final styles in the cue-final phase.
812
819
  * @example
813
820
  * Subtitle: { subtitleEditor: (_, context) =>
814
821
  * context.type === 'cue' ? { textStyle: { fontWeight: 'bold' } } : undefined }
815
822
  */
816
823
  subtitleEditor?: SubtitleEditor;
824
+ /** {zh}
825
+ * @brief 启用点播外挂 WebVTT 字幕的 cue-final 编辑回调。
826
+ * @default false
827
+ * @notes 在当批字幕挂载并完成 cue 阶段的编辑和定位后调用。字幕覆盖层尺寸改变时,重新渲染当前字幕并调用。
828
+ * @example
829
+ * Subtitle: { enableSubtitleCueFinal: true, subtitleEditor: (_, context) =>
830
+ * context.type === 'cue-final' ? { textStyle: { lineHeight: '1.374' } } : undefined }
831
+ */
832
+ /** {en}
833
+ * @brief Enable the cue-final editor callback for external VOD WebVTT captions.
834
+ * @default false
835
+ * @notes Runs after the batch is attached and cue edits and positioning are applied. A change in overlay size redraws the active cues and invokes the callback again.
836
+ * @example
837
+ * Subtitle: { enableSubtitleCueFinal: true, subtitleEditor: (_, context) =>
838
+ * context.type === 'cue-final' ? { textStyle: { lineHeight: '1.374' } } : undefined }
839
+ */
840
+ enableSubtitleCueFinal?: boolean;
817
841
  }
818
842
  /** {zh}
819
843
  * @list Options