Hiyve Components - v1.0.0
    Preparing search index...
    • 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.

      Parameters

      • input: {
            elementHeight: number;
            elementWidth: number;
            objectFit?: "contain" | "cover" | "fill" | "none" | "scale-down";
            sourceHeight: number;
            sourceWidth: number;
        }
        • elementHeight: number
        • elementWidth: number

          Rendered size of the <video> element.

        • OptionalobjectFit?: "contain" | "cover" | "fill" | "none" | "scale-down"

          CSS object-fit mode. Defaults to 'contain' (back-compat).

        • sourceHeight: number
        • sourceWidth: number

          Intrinsic source size (videoWidth / videoHeight).

      Returns VideoContentRect | null