In an earlier post we explained that there are lower-level control capabilities that are slowly making their way into WebRTC 1.0. In this post and the one to follow we cover new changes related to more video control and DTMF APIs. This post focuses on enhanced video control.
While audio is not simple, video is even more complex. Different architectures for multi-party video and application requirements have driven the requests of developers to have better and tighter control over sending of video streams.
Other new parameters are likely to come soon. Examples are maxBitRate and various transport parameters. We’ll send updates when they arrive.
This is an API change that would give more control over sending of video streams.
The video encoding controls will very shortly be in the Editors’ Draft.
It is the complexity of sending today’s encoded video streams that has driven the push for lower-level controls in WebRTC. One of the most-requested controls is to be able to enable, disable, and prioritize different encodings for a media flow. This is particularly important for some multi-party video applications where each endpoint is sending both a low-resolution encoding and a high-resolution one, or for prioritizing between them. To support this, there are now two RTCRtpEncodingParameters:
- active: a boolean controlling whether or not media is being sent for the encoding
- priority: one of “very-low”, “low”, “medium”, or “high”, this attribute specifies the encoding relative to the other encodings.
These values can be retrieved and set using the new RTCRtpSender.getParameters() and RTCRtpSender.setParameters() methods. Here’s an example drawn from the next Editor’s draft:
Create a new Peer Connection: pc = new RTCPeerConnection(…);
Create a new media track for the new Peer Connection and receive the sender object: sender = pc.addTrack(…);
Get the parameters currently defined for this sender object: params = sender.getParameters();
Change parameters of the object as the application requires: params.encodings[0].active = false;
Set these new parameters: sender.setParameters(params);
While this capability is supported in WebRTC for the sending side only, an application may use its signaling to allow the receiving side to request that the sender change the resolution of the video it is sending.