HLS Streaming

HLS Streaming lets you connect large audiences with your video sessions in real time without any delay. It supports adaptive bitrate streaming for best quality videos and can dynamically adapt to network conditions through playback speed optimization for both wired and wireless connections. Webinars, conference calls, classes, concerts, town hall meetings at large companies, and many other live events are good candidates for live streaming.

You can link a web-based Video UI to define the view of live streaming, which is then played in the configured devices. At the back-end, the linked Video UI is configured to automatically join the video and the same view is used to create an HLS stream. When the stream is ready, the endpoints receive an HLS Stream URL to play the stream in the HLS Player.

HLS Service Subscription

The HLS streaming infrastructure is owned and managed by EnableX. Therefore, it is a subscription-based service. Connect to Sales/Account Manager for subscription details.

Note: For live streaming to YouTube, Vimeo, LinkedIn, and Facebook, See RTMP Live Streaming.

HLS View

HLS Streaming experience can be achieved through Video UI. You can add video UI or HLS view in one of the following ways:

  • Use the Default View: The default view of EnableX does not require any coding effort to add the HLS streaming support. However, it provides limited customization options.
  • Develop a Custom View: For a custom view, you need to develop a web-based application, host it on a publicly accessible https URL, and link it to the video room. For more information to develop a custom view for your stream, see Creating Your Own RTMP Streaming View.

HLS Enabled Room

To include HLS streaming in your video session, specify the following room level settings:

  • audiences: Numeric. Optional. The number of audiences are needed in the room. This number cannot be greater than the capping set for the subscription. If the following settings are specified for the room, the audience count must be positive.
    • send_audiences_stats: Boolean, true or false. By default, it is set to false. Set it to true if the endpoint needs to receive a user-connected and user-disconnected event on entry and exit of an audience.
    • hls_view_url: String. URL. Optional. A custom view URL. If not passed, the default HLS streaming view is used. You can explicitly pass DEFAULT as a value for this key.

Below is an example JSON payload for room definition to enable HLS streaming.

Example:

{
"name": "HLS Trial",
"owner_ref": "XOXO",
"settings": {
"description": "HLS Trial",
"mode": "group",
"scheduled": false,
"adhoc": false,
"duration": 30,
"moderators": "1",
"participants": "2",
"audiences": 6,
"hls_view_url": "https://your-domain/path/?token=",
"send_audiences_stats": true,
"auto_recording": false,
"quality": "SD"
}
}

For more information, see:

Note: You are not permitted to define a room with HLS settings without an HLS subscription.

Audience Token

A new role, audience, has been added for HLS audience to join a video room. This role requires a token to join a video room. When the first audience joins a video room, the HLS streaming is automatically initiated. The HLS streaming stops when the last audience exits or disconnects from the video room.

Refer to the following example to create a token for the audience role:

{
"name": "John",
"user_ref": "XOXO",
"role": "audience"
}

For more information:

HLS Player

You need an HLS player to play the HLS stream URL. This HLS stream URL is received through the Video SDK using an event, callback, or the delegate method. You can play the HLS stream URL in one of the following ways:

  • Use your own HLS player
  • Browse for an HLS player online

For more information about the HLS player, refer to your preferred SDK:

Room Notifications

HLS streaming starts as soon as the first audience joins a video room and stops when the last audience exits or disconnects from the video room. Therefore, you need to add HLS notifications when such events occur to handle the UI and create a better user experience. Four types of notifications are sent to endpoints as described in the following table:

Event Listeners

Event ListenerDescription
HLS StartThis notification is sent to the publisher and connected audiences when an HLS stream starts. It is also sent to the new audiences when they connect to the room. It carries hls_url to play.
HLS StopThis notification is sent to the publisher when an HLS stream stops. This occurs when the last audience leaves a video room.
HLS FailureThis notification is sent to the publisher and audiences when an HLS stream fails to start or fails during an ongoing streaming.
HLS WaitingThis notification is sent to audiences only when the HLS stream initiation process is on, and waiting to start.

Note: The event, callback, and delegate methods have different names in the SDKs. Refer to your preferred SDK for details:

Error Codes

Error codes are sent to endpoints with corresponding event, callback, and delegate methods.

ErrorDescription
On HLS Start
7501Input parameters to start HLS streaming are missing due to an internal server error.
7502The HLS streaming timeout has started due to an internal server error.
7503Request to start HLS streaming is in process.
7504Request to start HLS streaming has timed-out due to an internal server error.
7505Request to start HLS streaming is in waiting and will be started.
7506The HLS streaming cannot be started now. Please try after 2 minutes.
7507Input parameters to start HLS streaming are missing due to an internal server error.
7508Input parameters to start HLS streaming are missing due to an internal server error.
On HLS Stop
7520The HLS streaming request was in the waiting queue and an error prevented it from starting. It is now removed from the queue.
7521Failed to stop HLS streaming due to an internal server error.
7522The HLS streaming timeout is stopped due to an internal server error.
On HLS Waiting
7509The HLS streaming cannot be started due to an internal server error. Please try again after 2 minutes.
7510Failed to start HLS streaming due to an internal server error. Please try again after 2 minutes.
7511The last HLS streaming request is in waiting.
7512The HLS streaming cannot be started due to an internal server error. Please try again.
7513Failed to start HLS streaming due to an internal server error.
HLS Generic Error
7000Input parameters to start HLS streaming are missing due to an internal server error.