Rate this page:

How to stream to CDN with RTMP support

A video call initiated from within a Web/Mobile application or SIP device goes to our cloud, which can forward the data stream to a CDN. A CDN provider would send audio and video streams to its end users, as typically does. Pay attention that RTMP supports only the H.264 codec, so it is crucial to specify it for streaming purposes.

Streaming Account Settings

We need to obtain two parameters from a streaming account in order to use them in a Voximplant JS scenario: stream name/key and server URL. Check the appropriate how-tos for YouTube, Twitch, and Restream.io.

Voximplant Settings

Log in to your account here: https://manage.voximplant.com/auth. On the left menu, select Applications, click New application and create a streaming application. Then go to your new application, switch to the Scenarios tab, and create a startStream scenario with the following code. Don't forget to substitute your streaming values in lines 8 and 9.

startStream scenario

startStream scenario

Switch to the Routing tab of your streaming application and click New rule. Name it streamRule; use the created JS scenario in the rule and leave the default call pattern ( .* ).

Switch to the Users tab, click Create user, set username (e.g., user1) and password, then click Create. We’ll need this login-password pair to authenticate in the web client.

Start Streaming

You can use your client or try videochat demo. Anyway, you have to explicitly specify the H.264 codec which will be used for streaming as RTMP uses it.

If you cloned our videochat demo, go the target folder and open the WebApp/JS/app.js file in your text editor/IDE. Specify the codec in the call method, see lines 262-266 :

Next, change the name of application on line 5 to streaming and save the file:

Finally, log in to your web client as user1, then initiate a video call. Streaming should begin in few seconds, enjoy!