Compute the rendered content rect of a <video>, given the element's
box, the source's intrinsic dimensions, and the current objectFit
mode. Returns null when the source dims aren't yet known (the
<video> hasn't loaded metadata).
Pixel coordinates are relative to the video element's box (top-left
= 0,0). Consumers either render the canvas as a sibling positioned
with the rect's offsets, or as a child of the same parent and use
the rect to clip / transform.
objectFit semantics:
'contain' (default): letterbox / pillarbox the source inside
the element. The returned rect describes the visible content
region (smaller than the element when the ARs differ).
'cover' / 'fill': source is cropped (cover) or stretched
(fill) to fill the element. The returned rect IS the element box;
there are no letterbox bands. aspectRatio still reports the
source AR — strokes are stored normalised to source content, so
receivers need the source AR to render them in the same relative
position regardless of the current fit mode.
Compute the rendered content rect of a
<video>, given the element's box, the source's intrinsic dimensions, and the currentobjectFitmode. Returnsnullwhen the source dims aren't yet known (the<video>hasn't loaded metadata).Pixel coordinates are relative to the video element's box (top-left = 0,0). Consumers either render the canvas as a sibling positioned with the rect's offsets, or as a child of the same parent and use the rect to clip / transform.
objectFitsemantics:'contain'(default): letterbox / pillarbox the source inside the element. The returned rect describes the visible content region (smaller than the element when the ARs differ).'cover'/'fill': source is cropped (cover) or stretched (fill) to fill the element. The returned rect IS the element box; there are no letterbox bands.aspectRatiostill reports the source AR — strokes are stored normalised to source content, so receivers need the source AR to render them in the same relative position regardless of the current fit mode.