RTCEncodedVideoFrame: RTCEncodedVideoFrame() constructor
Baseline
2025
Newly available
Since November 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Note: This feature is available in Dedicated Web Workers.
The RTCEncodedVideoFrame() constructor creates a new and fully independent RTCEncodedVideoFrame object.
The new object is a deep clone of the original object data and metadata, with any metadata specified in the options parameter overwriting the copied values.
Syntax
new RTCEncodedVideoFrame(originalFrame);
new RTCEncodedVideoFrame(originalFrame, options);
Parameters
originalFrame-
The frame to be copied.
optionsOptional-
This is an object with the following property:
metadataOptional-
An object setting the frame metadata. This is an object with the same properties as the object returned by
RTCEncodedVideoFrame.getMetadata().
Exceptions
TypeError- The source buffer is detached.
RangeError- The allocation is too large.
Examples
Cloning a frame with modified metadata
This snippet shows how you might copy a frame and modify its metadata. In this case we just update the capture time.
// Frame is an incoming RTCEncodedVideoFrame
frame.getMetadata();
const newFrame = new RTCEncodedVideoFrame(frame, {
metadata: {
captureTime: frame.metadata.captureTime + 3,
},
});
This kind of modification might be useful if you need to create multiple outgoing frames from a single incoming frame; for example, in order to relay media to another peer on the network. Generally you will not need to modify the metadata for a frame.
Specifications
| Specification |
|---|
| WebRTC Encoded Transform # dom-rtcencodedvideoframe-constructor |
Browser compatibility
| desktop | mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
RTCEncodedVideoFrame() constructor
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.contributingSources parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.dependencies parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.frameId parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.height parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.mimeType parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.payloadType parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.receiveTime parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.rtpTimestamp parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.spatialIndex parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.synchronizationSource parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.temporalIndex parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
options.metadata.width parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support