Untitled fiddle

HTML

<pre id="log"></pre>

JavaScript

function makeI420Gray4x4() {
  const buf = new Uint8Array(4 * 4 + 2 * 2 + 2 * 2);
  buf.fill(128);
  return buf;
}

function baseInit() {
  return {
    format: "I420",
    codedWidth: 4,
    codedHeight: 4,
    timestamp: 0,
  };
}

const data = makeI420Gray4x4();
const frame = new VideoFrame(data, {
    format: "I420",
    codedWidth: 4,
    codedHeight: 4,
    timestamp: 0,
    colorSpace: { primaries: "bt709", transfer: null, fullRange:true }
});

log.innerHTML += JSON.stringify(frame.colorSpace) +"<br>";