demo · v138
Rotation Rounding Probe
The VideoFrame rotation field stores one of 0, 90, 180, or 270. The constructor parses arbitrary numeric input by rounding to the nearest quarter turn, with ties rounded toward positive infinity, then normalizing full turns. This probe runs each candidate value and records the exact readback behaviour in your browser.
Result will appear here.
Expected behaviour (spec)
| Value | Stored rotation | Expected behaviour |
|---|---|---|
| 0 | 0 | Already aligned. |
| 90 | 90 | Already aligned. |
| 180 | 180 | Already aligned. |
| 270 | 270 | Already aligned. |
| 45 | 90 | Tie between 0 and 90 rounds toward positive infinity. |
| -90 | 270 | Negative quarter turn normalizes modulo 360. |
| 360 | 0 | Full turn normalizes to 0. |
| 1 | 0 | Nearest quarter turn is 0. |
| undefined | 0 | Omitted rotation defaults to 0. |
| "90" | 90 | Web IDL numeric conversion parses the string before rotation parsing. |
// The stored value is always one quarter turn.
// Inputs are rounded, then normalized modulo 360.
const inputs = [0, 45, 90, 135, 180, 270, 360, -90, 1];
for (const r of inputs) {
try {
const frame = new VideoFrame(canvas, { timestamp: 0, rotation: r });
console.log('Input:', r, '→ frame.rotation =', frame.rotation);
frame.close();
} catch (e) {
console.log('Could not construct frame:', r, '→', e.name + ':', e.message);
}
}