Interface VideoFrame
codedHeight: number;
codedRect: DOMRectReadOnly | null;
codedWidth: number;
colorSpace: VideoColorSpace;
displayHeight: number;
displayWidth: number;
duration: number | null;
format: VideoPixelFormat | null;
timestamp: number;
visibleRect: DOMRectReadOnly | null;
allocationSize(options?: VideoFrameCopyToOptions): number;
clone(): VideoFrame;
close(): void;
copyTo(
destination: AllowSharedBufferSource,
options?: VideoFrameCopyToOptions,
): Promise<PlaneLayout[]>;
}
Index
Properties
ReadonlycodedHeight
The codedHeight property of the VideoFrame interface returns the height of the VideoFrame in pixels, potentially including non-visible padding, and prior to considering potential ratio adjustments.
ReadonlycodedRect
The codedRect property of the VideoFrame interface returns a DOMRectReadOnly with the width and height matching VideoFrame.codedWidth and VideoFrame.codedHeight.
ReadonlycodedWidth
The codedWidth property of the VideoFrame interface returns the width of the VideoFrame in pixels, potentially including non-visible padding, and prior to considering potential ratio adjustments.
ReadonlycolorSpace
The colorSpace property of the VideoFrame interface returns a VideoColorSpace object representing the color space of the video.
ReadonlydisplayHeight
The displayHeight property of the VideoFrame interface returns the height of the VideoFrame after applying aspect ratio adjustments.
ReadonlydisplayWidth
The displayWidth property of the VideoFrame interface returns the width of the VideoFrame after applying aspect ratio adjustments.
Readonlyduration
The duration property of the VideoFrame interface returns an integer indicating the duration of the video in microseconds.
Readonlyformat
The format property of the VideoFrame interface returns the pixel format of the VideoFrame.
Readonlytimestamp
The timestamp property of the VideoFrame interface returns an integer indicating the timestamp of the video in microseconds.
ReadonlyvisibleRect
The visibleRect property of the VideoFrame interface returns a DOMRectReadOnly describing the visible rectangle of pixels for this VideoFrame.
Methods
allocationSize
The
allocationSize()method of the VideoFrame interface returns the number of bytes required to hold the video as filtered by options passed into the method.Parameters
Optionaloptions: VideoFrameCopyToOptions
Returns number
clone
The
clone()method of the VideoFrame interface creates a newVideoFrameobject referencing the same media resource as the original.Returns VideoFrame
close
The
close()method of the VideoFrame interface clears all states and releases the reference to the media resource.Returns void
copyTo
- copyTo(
destination: AllowSharedBufferSource,
options?: VideoFrameCopyToOptions,
): Promise<PlaneLayout[]>The
copyTo()method of the VideoFrame interface copies the contents of theVideoFrameto anArrayBuffer.Parameters
- destination: AllowSharedBufferSource
Optionaloptions: VideoFrameCopyToOptions
Returns Promise<PlaneLayout[]>
The
VideoFrameinterface of the Web Codecs API represents a frame of a video.MDN Reference