let buffer = new Uint8Array(videoFrame.allocationSize());
let layout = await videoFrame.copyTo(buffer);VideoFrame: copyTo() method / notebook
VideoFrame: copyTo() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const videoRect = {
x: 100,
y: 100,
width: 80,
height: 60,
};
const options = {
rect: videoRect,
format: "RGBX",
colorSpace: "display-p3",
};
const size = videoFrame.allocationSize(options);
const buffer = new ArrayBuffer(size);
const layout = await videoFrame.copyTo(buffer, options);