VideoFrame: copyTo() メソッド
Baseline
2024
Newly available
Since September 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
copyTo() は VideoFrame インターフェイスのメソッドで、この VideoFrame の内容を ArrayBuffer へコピーします。
構文
js
copyTo(destination)
copyTo(destination, options)
引数
destination-
コピー先となる
ArrayBuffer,TypedArray,DataViewのいずれかです。 options省略可-
以下のものを含むオブジェクトです。
rect省略可-
VideoFrameからコピーされるピクセルの長方形。未指定の場合、visibleRectを使用します。これは以下のものを含む辞書オブジェクトの形を採ります。x: X 座標です。y: Y 座標です。width: フレームの幅です。height: フレームの高さです。
layout省略可-
VideoFrame内の各プレーンについて、以下の値を格納したリスト。プレーンは重なってはいけません。未指定の場合、プレーンは密に詰められます。
返値
コピーが完了したときに、コピーのレイアウトに解決する Promise。
例
次の例は videoFrame の内容全体をコピーしています。
js
let buffer = new Uint8Array(videoFrame.allocationSize());
let layout = await videoFrame.copyTo(buffer);
仕様書
| Specification |
|---|
| WebCodecs> # dom-videoframe-copyto> |
ブラウザーの互換性
Loading…