VideoFrame: allocationSize() メソッド
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.
allocationSize() は VideoFrame インターフェイスのメソッドで、メソッドに渡すオプションでフィルタリングされた動画を保持するために必要なバイト数を返します。
構文
js
allocationSize()
allocationSize(options)
引数
options省略可-
以下のものを含むオブジェクトです。
rect省略可-
VideoFrameからコピーされるピクセルの長方形。未指定の場合、visibleRectを使用します。これは以下のものを含む辞書オブジェクトの形を採ります。x: X 座標です。y: Y 座標です。width: フレームの幅です。height: フレームの高さです。
layout省略可-
VideoFrame内の各プレーンについて、以下の値を格納したリスト。プレーンは重なってはいけません。未指定の場合、プレーンは密に詰められます。
返値
options で指定したフレームを格納するのに必要なバイト数を示す整数。
例
次の例では、左上の 800 × 600 の長方形に対して allocationSize が返されます。
js
const videoRect = {
x: 0,
y: 0,
width: 800,
height: 600,
};
let size = VideoFrame.allocationSize({ rect: videoRect });
仕様書
| Specification |
|---|
| WebCodecs> # dom-videoframe-allocationsize> |
ブラウザーの互換性
Loading…