Class RTCRtpScriptTransformer
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
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.
[Value("RTCRtpScriptTransformer")]
public class RTCRtpScriptTransformer : EventTarget
- Inheritance
-
RTCRtpScriptTransformer
- Inherited Members
Remarks
NOTE
This feature is available in Dedicated Web Workers.
Constructors
RTCRtpScriptTransformer()
public RTCRtpScriptTransformer()
Properties
Onkeyframerequest
[Value("onkeyframerequest")]
public EventHandlerNonNull Onkeyframerequest { get; set; }
Property Value
Options
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.
[Value("options")]
public dynamic Options { get; }
Property Value
- dynamic
An object.
Remarks
Readable
The readable read-only property of the RTCRtpScriptTransformer interface returns a ReadableStream instance is a source for encoded media frames.
[Value("readable")]
public ReadableStream Readable { get; }
Property Value
Remarks
When the corresponding RTCRtpScriptTransform is inserted into the WebRTC sender and receiver pipelines, this stream may be enqueued with outgoing or incoming encoded media frames (RTCEncodedVideoFrame or RTCEncodedAudioFrame).
A WebRTC encoded transform can read the frames, modify them as needed, and then send them back into the WebRTC pipeline by writing them to Writable.
A common way to perform this operation is to pipe the frames through a TransformStream.
Writable
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 Readable.
[Value("writable")]
public WritableStream Writable { get; }
Property Value
Remarks
When the corresponding RTCRtpScriptTransform is inserted into the WebRTC sender and receiver pipelines, encoded media frames (RTCEncodedVideoFrame or RTCEncodedAudioFrame) may be enqueued on the Readable.
A WebRTC encoded transform can read the frames from readable, modify them as needed, and then send them back into the WebRTC pipeline by sending them to this writable.
A common way to perform this operation is to pipe the frames through a TransformStream.
Methods
GenerateKeyFrame(string)
The generateKeyFrame() method of the RTCRtpScriptTransformer interface causes a video encoder to generate a key frame.
[Value("generateKeyFrame")]
public Task<ulong> GenerateKeyFrame(string rid = null)
Parameters
ridstring
Returns
- Task<ulong>
A Promise that fulfills with the timestamp of the frame, or rejects with an exception value.
Remarks
SendKeyFrameRequest()
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.
[Value("sendKeyFrameRequest")]
public Task<GlobalObject.Undefined> SendKeyFrameRequest()
Returns
- Task<GlobalObject.Undefined>
A Promise that fulfills with
undefinedonce the request is sent, or the user agent decides that it does not need to.
Remarks
The method may only be called when receiving video (not audio) frames and if, for whatever reason, a recipient will not be able to decode the video without a new key frame.
Note that the user agent can decide that the request for a key frame is not necessary, in which case the returned promise will fulfill even though the request was not actually sent.
NOTE
It might be called, for example, if a new user joins a WebRTC conference, in order to reduce the time before they receive a key frame and can hence start displaying video.
For more information see Triggering a key frame in Using WebRTC Encoded Transforms.