Skip to content

captions.js


Function: renderString()

renderString(canvas, text, options): Promise<boolean>

Defined in: render/renderString.ts:21

Server/worker-friendly helper that paints a text string onto a provided canvas.

Parameters

canvas

HTMLCanvasElement

Destination canvas that should receive the rendered text.

text

string

Arbitrary content that needs to be painted.

options

Rendering options that include the style preset.

preset

StylePreset

Returns

Promise<boolean>

Resolves once the frame has been painted (always resolves to true).

Remarks

Uses the same Konva pipeline as the video overlay renderer so the results match what users see in the browser.