Streaming with HLS
Developers can start live streaming sessions with HLS (HTTP Live Streaming) with Daily. HLS is a multi-bitrate adaptive streaming protocol. It means that the audience watching your stream receives fair-quality video playback over a cellular network while also supporting the best-quality playback on a high-speed connection. The downside is latency; there is roughly a 12-to-20 second delay between what is happening "live". If you are hosting your own streams and want control on where that video output is stored on the Internet, then this guide to HLS is for you.
If you want your audience to watch your streams on Twitch, YouTube, and other providers, then you'll want to take advantage of Daily's RTMP support.
This guide covers:
- The HLS architecture at Daily
- How to configure HLS
- Starting an HLS live stream
- Enabling HLS playback for your audience
- Current limitations for HLS with Daily
Receive a $15 credit for freeTry Daily pay-as-you-go features for free! New accounts have a $15 credit automatically applied when you add a credit card to the account. Learn more about pay-as-you-go features on our pricing page.
HLS live streams are a beta feature. The API is subject to change.
The HLS architecture at Daily
How to configure HLS
HLS support is configured through a room property called
In this example, we are creating an HLS live streaming configuration named
Each object inside the
streaming_endpoints array represents a live streaming configuration:
name: the label that will be used in
daily-jsto reference a specific configuration
hlsfor an RTMP and HLS configuration
rtmp_config: the RTMP configuration details (when
url: the RTMP url
hls_config: the HLS configuration details (when
truewhen you want to save the output of the live stream once the stream is finished; otherwise,
false. This can be used as a replacement for cloud recording.
variant: specifies all the HLS variants to generate. Specified as array with following properties.
width: output width.
height: output height.
fps: output FPS.
bitrate: output bitrate in kilobits per second (kbps).
iframe_only: whether this is iframe-only variant.
storage: the storage details when
save_hls_recordingis set to
bucket_name: the name of the S3 bucket where the HLS output will be stored
bucket_region: the AWS region of the S3 bucket (this is an S3 bucket that you own)
assume_role_arn: The Amazon Resource Name to assume in order to write to the S3 bucket
path: the S3 key path prefix for where to store the output (HLS recording). The final master.m3u8 path template is
For a complete list of the properties available on
streaming_endpoints, check out the rooms configuration.
/rooms API to configure the
streaming_endpoints for your room:
Starting an HLS live stream
These examples will work with
In the code example below, we use
call to start the HLS stream, after completing the
call represents an instance of the
DailyIframe class, which is initiated in projects utilizing either call object or Daily Prebuilt projects.
In this example,
hls_s3 is the name of endpoint that we defined as a
Note that if your use case requires both HLS and cloud recording or HLS and RTMP in the same meeting session, then multiple instances are required, each with a unique
It is not possible to use
endpoints at the same time with
Define your existing
streaming_endpoints room properties in order to start live streaming with both RTMP and HLS.
endpoints, it is not possible to add/remove an RTMP URL to an existing stream through
Enabling HLS playback for your audience
We recommend that the HLS video be served from a CDN (like CloudFront). We advise you to not serve it directly from an S3 bucket. In order to reduce security risk, your S3 resources should implement a "least privilege access" model. From a geographical perspective, serving the HLS video through a CDN ensures that the video is served closest to where your audience is located on the planet.
CDN setup is outside the scope of this guide. We have an example project that creates the necessary AWS infrastructure to serve HLS video through CloudFront.
Current limitations for HLS with Daily
Daily does not store HLS output
Output is stored in one of your AWS S3 buckets. This allows you to have more control over your data and its storage.
Daily supports 4 bitrates out-of-the-box
|Width||Height||Frames per Second||Bitrate(kbps)|
These bitrates cover most use case needs. It is currently not possible to change this configuration, but may be possible in a future release.
HLS configuration is only available as a room property
HLS configuration (
streaming_endpoints) is only available as a room property, not a domain property.
This means it cannot currently be set as a default at the domain level, but can be used by any room under your domain.
There is a maximum of 20
You can store up to 20
streaming_endpoints configuration objects per room.