Skip to content

captions.js


Class: Captions

Defined in: captions/Captions.ts:33

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

Constructors

Constructor

new Captions(options): Captions

Defined in: captions/Captions.ts:67

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

Parameters

options

CaptionsOptions

Complete configuration for the controller.

Returns

Captions

Methods

captions()

captions(nextCaptions): void

Defined in: captions/Captions.ts:178

Replace the current caption track and repaint without reloading fonts.

Parameters

nextCaptions

Timed words that should drive the overlay.

Caption[] | null

Returns

void


destroy()

destroy(): void

Defined in: captions/Captions.ts:155

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

Returns

void


disable()

disable(): void

Defined in: captions/Captions.ts:125

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

Returns

void


enable()

enable(): void

Defined in: captions/Captions.ts:86

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

Returns

void


isEnabled()

isEnabled(): boolean

Defined in: captions/Captions.ts:192

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

Defined in: captions/Captions.ts:164

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

Parameters

nextPreset

StylePreset

Preset that becomes the new render baseline.

Returns

void