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)

ValueStored rotationExpected behaviour
00Already aligned.
9090Already aligned.
180180Already aligned.
270270Already aligned.
4590Tie between 0 and 90 rounds toward positive infinity.
-90270Negative quarter turn normalizes modulo 360.
3600Full turn normalizes to 0.
10Nearest quarter turn is 0.
undefined0Omitted rotation defaults to 0.
"90"90Web 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);
  }
}

see also