AWS for M&E Blog
How to broadcast video chats to a streaming platform with ultra-low latency using Daily and Amazon IVS
Authored by Jessica Mitchell, Engineer, at Daily. The content and opinions in this post are those of the third-party author and AWS is not responsible for the content or accuracy of this post.
At Daily, we build real-time video and audio APIs that let developers embed calls into any site or app, with support for up to 1,000 participants. Recently, there has been a growing demand for a reliable live streaming solution. As more interactions move online, customers who typically rely on WebRTC for real-time conversations now need to host even larger events like webinars, live conferences, fitness classes, concerts, and large meetings on streaming platforms that reach millions.
To meet this growing demand, Daily offers live streaming of Daily calls via RTMP streaming. This format can be consumed by several existing solutions — most notably Amazon Interactive Video Service (Amazon IVS). It also provides ultra-low latency with only a two to five seconds of delay.
Daily prides itself on offering the simplest solution for video calls and live streaming, requiring only a few lines of code to get started. In addition to ease of use and low latency, Daily provides customizable layouts for live streaming or multi-participant calls, and full HD resolution. Our live streaming accommodates up to nine video feeds on screen at a time and a configurable number of simultaneous streams per account.
In this post, we show you how to set up a Daily video call in your app, initiate RTMPS live streaming, and have the stream consumed by the Amazon IVS player.
Requirements
To get started, there are a few requirements you will need to set up:
- A Daily paid account (Launch or Scale) to access the live streaming feature.
- A Daily room, which can be created via the Daily dashboard or the REST API.
- A meeting token for the Daily room, with the property `is_owner` set to `true`.
- An AWS account to use Amazon IVS.
- An Amazon IVS streaming channel. A channel can be created through the Amazon IVS console or through the Amazon IVS API directly.
Once you have a streaming channel created, keep the following pieces of information provided by Amazon IVS:
- The ingest server
- The stream key
- The playback URL
Create a Daily video call
Adding a Daily video call to your app is as simple as adding a few lines of code. To demonstrate this, let’s look at Daily’s prebuilt demo app, which uses our prebuilt video UI. (Developers also can build their own custom video interfaces with our front-end libraries.)
In `index.html`, there is a script tag to include `daily-js`, Daily’s front-end JavaScript library. There is also a `<div>` element that can be selected in the `index.js` file via its ID. This is where the video iframe is inserted by `daily-js`.
In `index.js`, there are three main steps to start a live stream. These steps require the Daily and Amazon IVS prerequisite data created earlier, including the RTMPS endpoint as shown by the following.
- Initialize the Daily iframe with the `createFrame()` Daily method.
- Once the Daily call has been initialized, join the Daily room created earlier with the `join()` method. This method should be passed an object with the Daily room URL and meeting owner token set, also created earlier.
- After the room has been joined, start live streaming the Daily call by choosing the demo’s “Start live streaming” button. This triggers the `startLiveStreaming()` Daily method, which accepts an object with the RTMP URL set, as well as additional configurable options. In the case of Amazon IVS, this is an RTMPS URL.The RTMPS URL uses two pieces of information provided by the Amazon IVS console (or REST API) from the new channel created earlier: the ingest server and the stream key.
As soon as `startLiveStreaming` successfully resolves, your Daily call is officially live streaming.
Viewing your live stream with Amazon IVS
Now that you have your Daily video streaming, playing the live stream is as simple as passing the playback URL to the Amazon IVS player, using the player SDK. To test the Daily live stream with the player, use the Amazon IVS basic web sample from the code repository list, or follow the player instructions for web, Android, or iOS.
Once you have the player available, use the playback URL supplied by Amazon IVS in the player setup. This playback URL is one of the pieces of information mentioned earlier while creating a new channel.
To confirm that the live stream is available, load the player in the browser and you can see your live stream with the ultra-low latency of only 2–5 seconds.
This setup can be further customized by using Daily’s various layouts, such as grid, active speaker, screen share, or single participant views.
Once your live stream content has ended, you can stop live streaming your Daily call by simply calling `callFrame.stopLivestreaming()` in your Daily call code.
About Daily
At Daily, our goal is to build video and audio APIs that inspire and support developers. We believe that live video is changing how we all live and work — and it should be much simpler, and faster, for developers and product teams to build creatively with video.
Using Daily with Amazon IVS provides reliable live streaming with ultra-low latency, with only a few lines of code. With Daily and Amazon IVS both being quick and easy to use, we’ve solved the hard parts of live streaming video for developers so they can focus on building better products faster.