useVideoBox
Computes the painted video rectangle inside an
object-contain video element (the element fills the stage, but the actual
frame is letterboxed within it). Used to anchor overlay subtitles to the
frame rather than the element box.
Interfaces¶
VideoBox¶
Defined in: src/features/player/hooks/useVideoBox.ts:10
Properties¶
| Property | Type | Description | Defined in |
|---|---|---|---|
height |
number |
Painted frame height, in px. | src/features/player/hooks/useVideoBox.ts:18 |
left |
number |
Offset from the element's left edge to the painted frame, in px. | src/features/player/hooks/useVideoBox.ts:12 |
top |
number |
Offset from the element's top edge to the painted frame, in px. | src/features/player/hooks/useVideoBox.ts:14 |
width |
number |
Painted frame width, in px. | src/features/player/hooks/useVideoBox.ts:16 |
Functions¶
useVideoBox()¶
Defined in: src/features/player/hooks/useVideoBox.ts:28
Tracks the painted (contained) video rect, recomputing on metadata load and element resize.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
video |
| HTMLVideoElement | null |
The video element. |
Returns¶
VideoBox | null
The painted rect, or null until known.