captions.js
API ReferenceFunctions

renderString()

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

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

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

Parameters

ParameterTypeDescription
canvasHTMLCanvasElementDestination canvas that should receive the rendered text.
textstringArbitrary content that needs to be painted.
options{ preset: StylePreset; }Rendering options that include the style preset.
options.presetStylePreset-

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.

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