RTMP Live Streaming

The Real-Time Messaging Protocol (RTMP) is a data transmission technology that supports live online video streaming to deliver encoded content to social media platforms, streaming platforms, and media servers.

Today, live streaming of video sessions through RTMP CDN providers is increasingly in demand as a result of the widespread use of digital streaming platforms like Youtube, Facebook, Vimeo, and many others for video broadcasting to large audiences. EnableX video sessions can be live streamed to meet this demand, using a few lines of code to forward the streams over RTMP to any live streaming CDNs that support this protocol. In addition to the predefined layout, you can define your custom layout for live streaming.

How does Live Streaming Work?

Users from different endpoints join a video session hosted on the EnableX platform. EnableX forwards a single video stream (with a presentable and configurable view) to RTMP CDN. The CDN provider sends the audio and video streams to specified end users. The following diagram depicts this flow.

Users join a Video Session hosted on the EnableX Platform from different endpoints. EnableX forwards a single Video Stream (with a presentable and configurable view) to RTMP CDN. Now, the CDN provider is responsible for sending audio and video streams to its end users.

Note: RTMP supports only the H.264 codec.

Setup Live Streaming

Perform the following steps to set up live streaming:

  1. Set up streaming through live streaming CDN providers.

    1. Get a CDN account for live streaming on a streaming platform such as YouTube, Vimeo, Facebook, Twitch, and so on.
    2. Set up or schedule your streaming using your CDN Provider Account.

    Once the streaming is setup, you get an RTMP Streaming URL and Streaming Key. They are required by the EnableX API for streaming. You will also get a Public URL from CDR provider that must be shared with the intended viewers.

    1. Use the EnableX API to stream out to the CDN provider.
  2. To initiate streaming, create the UI in your EnableX SDK-driven video application where you want the user (Moderator) to input the values for RTMP Streaming URL and Streaming Key.

var streamingConfig = {
rtmpDetails: {
urlDetails: {
// Start Streaming
room.startStreaming(streamingConfig, function(resp) {
if (resp.status.resultCode === 0) {
console.log('Streaming started. You are live.');
else { // Streaming failed
// Stop Streaming
room.stopStreaming(function(resp) {
console.log('Streaming Stopped.');
room.addEventListener('streaming-started', function(event) {
// All are notified that streaming has started
// event.message.startedBy : who started the streaming
room.addEventListener('streaming-stopped', function(event) {
// All are notified that streaming has stopped
// event.message.stoppedBy : who stopped the streaming

Refer to the API documentation to learn how to code to stream out your video session to a streaming CDN.

Note: EnableX uses a Default View to stream out. To develop your view, please read Creating Your Own RTMP Streaming View?

Monitor and Manage Streaming

Once the streaming starts from EnableX video application, it reaches the CDN provider. You can monitor the stream as it reaches the CDN provider through your account. You might experience significant lag from 10-40 seconds.

For a scheduled streaming event, you might need to click a button to go live, which makes the stream available on the public URL that you shared with your intended users.

On the console, you can monitor streaming statistics, views, and other similar details.

Setup Live Streaming on YouTube

While the concept of live streaming process remains the same with all other live streaming CDN providers, let us use YouTube as an example to help you understand the live streaming setup process.

To set up live streaming on YouTube:

  1. Navigate to setup

    1. Log in to YouTube.

    2. On top-right corner, click on your icon and follow the menu options.

    3. Click YouTube Studio

  1. On the top-right bar, click CREATE.

  2. Click Go live.

  1. Setup Streaming

    1. From right-side bar, click STREAM.

    2. In the form that opens, fill the required details.

    3. For your preferred category, you are recommended to choose People and Blogs.

  1. Obtain the CDN Information

After setting up live streaming, you ae provided a streaming console to obtain key information and get reported.

To obtain Stream URL and Streaming Key use the Stream URL and Streaming Key values in the API to stream out the content.

  1. Obtain the public URL to share with your audience.

    1. From the right of the top bar, click the Arrow icon to share the URL.

    A pop-up window displays the public URL and the options to share the URL.

    Copy the URL for your reference.

Create Own RTMP Streaming View

The RTMP Streaming View is an HTML client application hosted on a URL. The client uses this URL to live stream the content to a CDR provider for a larger audience. Streaming methods can be optionally provided with a custom URL for streaming view. If streaming methods are not provided, EnableX uses the default view.

  1. Use EnableX Web toolkit to create an HTML client application to join a video session when provided with a token.

  2. Ensure that this client app can join a session only without publishing an audio or a video stream into the video room.

  3. Create a URL scheme to accept the EnableX token as part of the URL, either as part of the URL or as a Query String. For example: https://your-domain/video/?token=ENABLEX-TOKEN

  4. Host the web application on a secured web server, that is, over https.

  5. Pass the URL of your hosted web application as part of stream configuration to the method to start streaming.

Note: Pass the URL without any token or the ENABLEX-TOKEN string. Use pass only. For example: https: //your-domain/video/?token=

API References

Visit the following API resources for implementing live streaming: