WebRTC encoded transform
The rtctransform event is fired at a worker's DedicatedWorkerGlobalScope object when an encoded video or audio frame has been queued for processing by a WebRTC Encoded Transform.
The event's transformer property returns a RTCRtpScriptTransformer that exposes the ReadableStream on which the frame is queued, and a WritableStream where the frame can be written to inject it back into the WebRTC pipeline.
This event is not cancellable and does not bubble.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 86 | 86 | 117 | 15.4 | 86 | 15.4 | |
| The rtctransform event is fired at a worker's DedicatedWorkerGlobalScope object when an encoded video or audio frame has been queued for processing by a WebRTC API/Using Encoded Transforms. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The data property of the RTCEncodedAudioFrame interface returns a buffer containing the data for an encoded frame. | 86 | 86 | 117 | 15.4 | 86 | 15.4 |
| The getMetadata() method of the RTCEncodedAudioFrame interface returns an object containing the metadata associated with the frame. | 86 | 86 | 117 | 15.4 | 86 | 15.4 |
| The RTCEncodedAudioFrame() constructor creates a new and fully independent RTCEncodedAudioFrame object. | 127 | 127 | 145 | 26 | 127 | 26 |
| The RTCEncodedVideoFrame of the WebRTC API represents an encoded video frame in the WebRTC receiver or sender pipeline, which may be modified using a WebRTC Encoded Transform. | 86 | 86 | 117 | 15.4 | 86 | 15.4 |
| The data property of the RTCEncodedVideoFrame interface returns a buffer containing the frame data. | 86 | 86 | 117 | 15.4 | 86 | 15.4 |
| The getMetadata() method of the RTCEncodedVideoFrame interface returns an object containing the metadata associated with the frame. | 86 | 86 | 117 | 15.4 | 86 | 15.4 |
| The RTCEncodedVideoFrame() constructor creates a new and fully independent RTCEncodedVideoFrame object. | 127 | 127 | 145 | 26 | 127 | 26 |
| The type read-only property of the RTCEncodedVideoFrame interface indicates whether this frame is a key frame or a delta frame. | 86 | 86 | 117 | 15.4 | 86 | 15.4 |
| The transform property of the RTCRtpReceiver object is used to insert a transform stream (TransformStream) running in a worker thread into the receiver pipeline. This allows stream transforms to be applied to encoded video and audio frames as they arrive from the packetizer (before they are played/rendered). | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The RTCRtpScriptTransform interface of the WebRTC API is used to insert a WebRTC Encoded Transform (a TransformStream running in a worker thread) into the WebRTC sender and receiver pipelines. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The RTCRtpScriptTransform() constructor creates a new RTCRtpScriptTransform object. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The RTCRtpScriptTransformer interface of the WebRTC API provides a worker-side Stream API interface that a WebRTC Encoded Transform can use to modify encoded media frames in the incoming and outgoing WebRTC pipelines. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The generateKeyFrame() method of the RTCRtpScriptTransformer interface causes a video encoder to generate a key frame. | | | 117 | 15.4 | | 15.4 |
| The options read-only property of the RTCRtpScriptTransformer interface returns the object that was (optionally) passed as the second argument during construction of the corresponding RTCRtpScriptTransform. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The readable read-only property of the RTCRtpScriptTransformer interface returns a ReadableStream instance is a source for encoded media frames. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The sendKeyFrameRequest() method of the RTCRtpScriptTransformer interface may be called by a WebRTC Encoded Transform that is processing incoming encoded video frames, in order to request a key frame from the sender. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The writable read-only property of the RTCRtpScriptTransformer interface returns a WritableStream instance that can be used as a sink for encoded media frames enqueued on the corresponding RTCRtpScriptTransformer.readable. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The transform property of the RTCRtpSender object is used to insert a transform stream (TransformStream) running in a worker thread into the sender pipeline. This allows stream transforms to be applied to encoded video and audio frames after they are output by a codec, and before they are sent. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The RTCTransformEvent of the WebRTC API represent an event that is fired in a dedicated worker when an encoded frame has been queued for processing by a WebRTC Encoded Transform. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
| The read-only transformer property of the RTCTransformEvent interface returns the RTCRtpScriptTransformer associated with the event. | 141 | 141 | 117 | 15.4 | 141 | 15.4 |
Syntax
addEventListener("rtctransform", (event) => { })
onrtctransform = (event) => { } Use cases
-
Using WebRTC encoded transform
The rtctransform event is fired at a worker's DedicatedWorkerGlobalScope object when an encoded video or audio frame has been queued for processing by a WebRTC Encoded Transform.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.