captions.js

Captions

Imperative controller that owns the Konva stage lifecycle for a single video element.

Imperative controller that owns the Konva stage lifecycle for a single video element.

Constructors

Constructor

new Captions(options): Captions;

Create a controller bound to the provided video element and preset.

Parameters

ParameterTypeDescription
optionsCaptionsOptionsComplete configuration for the controller.

Returns

Captions

Methods

captions()

captions(nextCaptions): void;

Replace the current caption track and repaint without reloading fonts.

Parameters

ParameterTypeDescription
nextCaptionsCaption[] | nullTimed words that should drive the overlay.

Returns

void


destroy()

destroy(): void;

Alias for disable() to match typical imperative controller APIs.

Returns

void


disable()

disable(): void;

Tear down overlays, observers and animation loops to free resources.

Returns

void


enable()

enable(): void;

Mount caption overlays onto the configured video if they are not active yet.

Returns

void


getRenderCount()

getRenderCount(): number;

Number of times the scene has been rebuilt. Useful for diagnostics and tests — it stays flat while the video is paused.

Returns

number


isEnabled()

isEnabled(): boolean;

Whether the Konva overlay is currently attached to the video element.

Returns

boolean

true when the overlay is mounted on top of the video.


preset()

preset(nextPreset): void;

Swap the active preset and re-render with updated typography/colors.

Parameters

ParameterTypeDescription
nextPresetStylePresetPreset that becomes the new render baseline.

Returns

void

For AI agents and LLMs: this page as Markdown · llms.txt · all docs in one file