Skip to content

Function: sampleDimensions()

sampleDimensions(srcWidth, srcHeight, maxWidth?): object

Defined in: aiui-intent-runtime/src/video.ts:52

Downscaled frame dimensions: cap the width at maxWidth, keep the aspect ratio, and never upscale (a small capture stays its own size). Pure — srcWidth/srcHeight are the video element's intrinsic size. A non-positive source (metadata not loaded yet) yields 0×0; the caller clamps to ≥1 so a not-yet-ready element still produces a (tiny, harmless) frame rather than throwing.

Parameters

srcWidth

number

srcHeight

number

maxWidth?

number = VIDEO_MAX_WIDTH

Returns

object

height

height: number

width

width: number