createVideoCaptions
Call Signature
Section titled “Call Signature”createVideoCaptions<
T>(captionsMap):VideoCaptions<T>
Defined in: caption.ts:345
Creates caption controllers backed by pre-recorded asset files instead of
TTS-generated audio. Each entry maps a name to either an asset path string
or an object with assetPath and an optional subtitle text.
At render time the asset file is used directly as the voiceover audio.
If subtitle is provided, words are spread with equal timing across the
audio duration (no word-level TTS data available).
Same constraints as createCaptions: cannot overlap with other captions,
and cannot fall inside input events.
Two overloads:
1. Single-language:
const captions = createVideoCaptions({ intro: '/assets/intro.mp3', demo: { assetPath: '/assets/demo.mp3', subtitle: 'Watch the demo.' },})2. Multi-language (type-safe): TypeScript enforces that every language has the same caption keys.
const captions = createVideoCaptions({ en: { captions: { intro: '/assets/en/intro.mp3' } }, fi: { captions: { intro: '/assets/fi/intro.mp3' } },})Type Parameters
Section titled “Type Parameters”T extends Record<string, VideoCaptionEntry>
Parameters
Section titled “Parameters”captionsMap
Section titled “captionsMap”T
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”createVideoCaptions<
L,T>(languagesMap):VideoCaptions<T&Record<string,VideoCaptionEntry>>
Defined in: caption.ts:348
Creates caption controllers backed by pre-recorded asset files instead of
TTS-generated audio. Each entry maps a name to either an asset path string
or an object with assetPath and an optional subtitle text.
At render time the asset file is used directly as the voiceover audio.
If subtitle is provided, words are spread with equal timing across the
audio duration (no word-level TTS data available).
Same constraints as createCaptions: cannot overlap with other captions,
and cannot fall inside input events.
Two overloads:
1. Single-language:
const captions = createVideoCaptions({ intro: '/assets/intro.mp3', demo: { assetPath: '/assets/demo.mp3', subtitle: 'Watch the demo.' },})2. Multi-language (type-safe): TypeScript enforces that every language has the same caption keys.
const captions = createVideoCaptions({ en: { captions: { intro: '/assets/en/intro.mp3' } }, fi: { captions: { intro: '/assets/fi/intro.mp3' } },})Type Parameters
Section titled “Type Parameters”L extends "fi" | "en"
T extends Record<string, VideoCaptionEntry>
Parameters
Section titled “Parameters”languagesMap
Section titled “languagesMap”{ [K in “fi” | “en”]: { captions: T } } & RequireAllSameVideoKeys<{ [K in “fi” | “en”]: { captions: Record<string, VideoCaptionEntry> } }>
Returns
Section titled “Returns”VideoCaptions<T & Record<string, VideoCaptionEntry>>