Class EmbedSubtitlesClip

嵌入式字幕,将字幕(目前仅支持 SRT 格式)嵌入视频画面中

Example

const es = new EmbedSubtitlesClip(srtSubtitleStr, {
videoWidth: 1280,
videoHeight: 720,
fontFamily: 'Noto Sans SC',
color: 'white',
});

Implements

Constructors

Properties

#ctx: OffscreenCanvasRenderingContext2D
#cvs: OffscreenCanvas
#lastVF: null | VideoFrame = null
#lineHeight: number = 0
#linePadding: number = 0
#meta: {
    duration: number;
    height: number;
    width: number;
} = ...

Type declaration

  • duration: number
  • height: number
  • width: number
#opts: Required<IEmbedSubtitlesOpts> = ...
#subtitles: SubtitleStruct[] = []
ready: Promise<IClipMeta>

当素材准备完成,ready 会切换到 resolved 状态

Accessors

  • get meta(): {
        duration: number;
        height: number;
        width: number;
    }
  • 数据元数据

    Returns {
        duration: number;
        height: number;
        width: number;
    }

    • duration: number
    • height: number
    • width: number

Methods