The copyTo() method of the VideoFrame interface copies the contents of the VideoFrame to an ArrayBuffer.
The copyTo() method of the VideoFrame interface copies the contents of the VideoFrame to an ArrayBuffer.
js
copyTo(destination) copyTo(destination, options)
destinationAn ArrayBuffer, a TypedArray, or a DataView to copy to.
options Optional
An object containing the following:
rect Optional
The rectangle of pixels to copy from the VideoFrame. If unspecified, the visibleRect will be used. This is in the format of a dictionary object containing:
x: The x-coordinate.y: The y-coordinate.width: The width of the frame.height: The height of the frame.layout Optional
A list containing the following values for each plane in the VideoFrame:
A Promise that resolves to the layout of the copy when the copy has completed.
The following example copies the entire contents of videoFrame.
js
let buffer = new Uint8Array(videoFrame.allocationSize()); let layout = await videoFrame.copyTo(buffer);
| Specification |
|---|
| WebCodecs # dom-videoframe-copyto |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
copyTo |
94 | 94 | No | No | 80 | 16.4 | 94 | 94 | No | 66 | 16.4 | 17.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame/copyTo