Skip to main content

Class: Voiceover

Defined in: src/audio/Voiceover.ts:228

Narrates text and syncs animation beats to the narration.

One instance can be reused for a whole scene; each voiceover call is one narration segment with its own tracker.

Constructors​

Constructor​

new Voiceover(options): Voiceover

Defined in: src/audio/Voiceover.ts:232

Parameters​

options​

VoiceoverOptions = {}

Returns​

Voiceover

Methods​

cancel()​

cancel(): void

Defined in: src/audio/Voiceover.ts:321

Cancel the narration currently in flight, if any.

Returns​

void


voiceover()​

voiceover(text, callback?, options?): Promise<VoiceoverTracker>

Defined in: src/audio/Voiceover.ts:248

Speak text and run callback while it plays.

The narration and the callback run together. Any <bookmark mark="..."/> markers in text are stripped before speaking and exposed through the tracker. The returned promise resolves after the narration finishes.

Parameters​

text​

string

Narration, optionally with bookmark markers.

callback?​

VoiceoverCallback

Runs animations; may await tracker.waitForMark.

options?​

VoiceoverOptions = {}

Per-call speech options (merged over the instance options).

Returns​

Promise<VoiceoverTracker>

The tracker for this narration segment.


voiceoverAudio()​

voiceoverAudio(options, callback?): Promise<VoiceoverTracker>

Defined in: src/audio/Voiceover.ts:291

Play a pre-recorded narration clip through the given scheduler and sync animation beats to explicit bookmark times.

Scheduling is delegated to the VoiceoverAudioScheduler (normally a scene's audioManager); this method never duplicates audio scheduling.

Parameters​

options​

VoiceoverAudioOptions

Clip URL, scheduler, bookmark times and timing.

callback?​

VoiceoverCallback

Runs animations; may await tracker.waitForMark.

Returns​

Promise<VoiceoverTracker>

The tracker for this narration segment.