The SDK has two WebRTC APIs and two WebRTC cores. This article compares them and explains how to move an application that uses the previous API (MWebRTC) to the new core.
Differences
WebRTC 1.0 (MWebRTC) |
WebRTC 2.0 (MConnect) |
|
|---|---|---|
| API |
MWebRTCClass: one object with a mode (sender, receiver, duplex) and Login / Logout. |
MConnectClass: Channel_Create, Channel_Connect, Enum_Create; the channel with ChannelSend / ChannelReceive. |
| Session | A sender and its receivers, or a link between two peers. | A channel with a Host and any number of Guests; video and audio in both directions. |
| Mix-minus | Built by the application. | Part of the channel, see WebRTC Mix-Minus. |
| Video in the application | The object is used as a source or as an output. | The application exchanges SDK frames with the channel. |
| Participants | Events and the peer list of the object. | Connected peers with IDs and properties (connected[i]); a peer can be disconnected and its mix controlled. |
| Signaling server |
WebRTC 1.0 signaling server; the API default is https://rtc.medialooks.com:8889. |
WebRTC 2.0 signaling server; the API default is https://videosdk.medialooks.com:8080. |
| Web pages | The pages of the 1.0 server. | Pages for desktop and mobile browsers, for example /wg2/<id> to join and /<id> to watch. |
| TURN server | Set on the sending application; the signaling server passes its setting to web pages. | A TURN server set on the signaling server is passed to web pages and to SDK applications. |
| Decoding of received video | GPU decoding is off by default (decoder.gpu_enabled). |
With webrtc.external_decoder the video is decoded by the SDK pipeline, with NVIDIA and Intel Quick Sync decoders and optional 10-bit output, see MConnect properties. |
| Shared encoder | One gpu_h264 or cpu_h264 encoder serves all receivers, at the bitrate of the slowest one. |
The encoder can be shared between the peers (webrtc.shared_encoder, on by default). |
| Samples | Streamer, Receiver and Duplex samples of WebRTC 1.0. | Quick Start Console, Duplex Sample 2.0 and WebRTC Meeting Sample, see WebRTC 2.0 Samples. |
| Core | Medialooks.WebRTC |
Medialooks.WebRTC_Core20, based on a current WebRTC source. |
Use MConnect for a new application. Many-to-many channels, mix-minus and frames in your own pipeline are available only through MConnect.
Run an existing application on the new core
The MWebRTC object is a front end: at its first use, normally the first Login, it creates the engine, the core, that does the work. The property webrtc20.enabled chooses it: false (the default) is the WebRTC 1.0 core, true is the WebRTC 2.0 core. The API stays the same.
In the code, before the first Login:
var webRTC = new MWebRTCClass();
webRTC.PropsSet("mode", "sender");
webRTC.PropsSet("webrtc20.enabled", "true");
webRTC.PropsSet("signaling_server", "https://videosdk.medialooks.com:8080");
webRTC.Login("https://videosdk.medialooks.com:8080/Room/MyChannel", "", out string id);
Or in the registry, for all applications of the user that do not set the properties themselves. The object reads these values when it is created:
HKEY_CURRENT_USER\Software\Medialooks\WebRTC
webrtc20.enabled = true
signaling_server = https://videosdk.medialooks.com:8080
Change the signaling server too
The two generations use different signaling servers that are not compatible. A WebRTC 2.0 core cannot log in to a 1.0 server and the other way round, so change signaling_server together with webrtc20.enabled:
Core (webrtc20.enabled) |
Signaling server | Result |
|---|---|---|
WebRTC 1.0 (false) |
WebRTC 1.0 | Works |
WebRTC 2.0 (true) |
WebRTC 2.0 | Works |
WebRTC 2.0 (true) |
WebRTC 1.0 |
Login fails with a timeout |
WebRTC 1.0 (false) |
WebRTC 2.0 |
Login fails with a timeout |
All applications that connect to each other must use the same generation. To run your own server, see Signaling server WebRTC 2.0 usage.
Change the links
The links for receivers are different on the new server. Read them from the object after Login:
webRTC.PropsGet("stat::path", out string webLink); // link for web receivers
webRTC.PropsGet("stat::my_upi", out string nativeLink); // link for application receivers
Notes
- Set
webrtc20.enabledbefore the firstLogin. The core is created then; to change it, use a new object. - Many-to-many channels and mix-minus are not part of the
MWebRTCAPI, also on the new core. For them useMConnect. - The default is
false, so an update does not change the behaviour of existing installations. - To check the setting, read
PropsGet("webrtc20.enabled", ...). The 2.0 core is running when the moduleMedialooks.WebRTC_Core20is loaded in the process that hosts the WebRTC engine (a separateMServerprocess whileexternal_processis on).Medialooks.WebRTCis loaded in both cases, because it contains theMWebRTCobject itself. - Test your application with the new core before you move it to production.
Sample code
Streamer samples that use the MWebRTC API on the 2.0 core:
Next
Still have questions?
Tell us what didn’t work or what you’d like clarified.