Initially, WebRTC technology was designed for establishing direct connections between web browsers, like it is shown in the picture below.
The signaling server here is not a part of WebRTC engine, but it is required to initiate the connection and resolve firewall bypassing issues.
We adopted this scheme for MPlatform and MFromats SDK and created the MWebRTC object. It can act as WebRTC streaming or receiving clients.
Here is how it works:
As you see you need to have a signaling server and HTML pages except for MPlatform or MFormats based applications to play around with WebRTC.
Go for it if you want to use your own signaling server and deploy HTML pages on your own web server.
Step 1: Run your own signaling server.
Signaling server source code is available in the installation package:
- MPlatorm SDK: "C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\SIGNALING SERVER"
- MFormats SDK: "C:\Program Files (x86)\Medialooks\MFormats SDK\Samples WebRTC\SIGNALING SERVER"
We use [https://github.com/andyet/signalmaster Signalmaster], a Node.js based signaling server, with some minor modifications. It helps to establish a peer connection between the MWebRTC object and the browser or another MWebRTC object.
To run your own server, you need to:
- Install Node.js engine: https://nodejs.org/en/download
- Open a command prompt and navigate to the folder with signaling server (e.g "C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\SIGNALING SERVER").
- Run "npm install" (Windows user might previously want to install Visual Studio 2013/2015 to avoid missing dependencies during this step).
- Generate test self-signed SSL certificate (cert.pem, key.pem) to allow secure communication with your signaling server and put it in "C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples WebRTC\SIGNALING SERVER\config\sslcerts" folder. Windows users can do it by using OpenSSL like described [https://msol.io/blog/tech/create-a-self-signe.../ here].
- Run following in command line :
6. start the signaling server
Once you're done with signaling server setup, don't forget to specify signaling server IP in your applications, by default after SDK installation all MWebRTC objects will be using https://rtc.medialooks.com:8889
signaling_server = https://rtc.medialooks.com:8889
All local WebRTC objects will use this signaling server address by default.