AWS for M&E Blog
Add multiple hosts to live streams with Amazon IVS
Amazon Web Services (AWS) launched Amazon Interactive Video Service (Amazon IVS), a managed live streaming solution that enables developers to build interactive video experiences, in 2020. Developers now use Amazon IVS to build apps across many verticals including social networking, ecommerce, and fitness. Collaborative live streaming has emerged as a key trend since the Amazon IVS launch. Companies such as Twitch have launched features like Guest Star that allow streamers to pull audience members into their live video streams, creating more engaging and participatory content.
As collaborative live streaming gains popularity, we have received frequent requests from developers for a solution that can combine video from multiple hosts into one live stream. We are excited to see developers pushing the boundaries of interactive live streaming, and we share their excitement about the potential of multi-host live streams. We also understand that building these experiences can be complex due to the need to bridge live streaming and real-time video technologies.
To meet this need, we are happy to announce that developers can now add multiple hosts to their live streams with Amazon IVS. As part of this update, Amazon IVS is adding a new resource called a stage. A stage is a virtual space where participants can exchange audio and video in real time. You can then broadcast a stage to a channel to reach a larger audience and you can build applications where audience members can be brought “on stage” to contribute to the live conversation. Use cases include:
- Guest Spots – Streamers can invite audience members into the broadcast.
- Versus Mode – Streamers are matched with each other to compete in a singing competition, trivia, or other challenges.
- Group Broadcasts – Multiple speakers can converse with each other in front of a large audience.
In this blog post, we provide an example of how a developer can use the new functionality to enable a guest spots experience. This post covers Android, but the Amazon IVS Broadcast SDKs for iOS and web also include the stage APIs. Code samples for both iOS and Android are available as open-source repositories:
In addition, the serverless backend that powers these applications is available as an open-source repository:
Sample Android application
This sample Android app shows how a developer can use Amazon IVS to enable a multi-host experience that allows users to live stream several guests interacting with each other in real time with text, video, and audio. Once you have cloned and set up the Android demo, you can launch the application on an Android Virtual Device, or Android Phone and create a stage session in the app that others can join.
The app will prompt you for permissions to access the microphone and camera, and allow you to enter a username and select an avatar. Once you are on the “Stages” screen, selecting “Create a new stage” will create a stage session that other users in the app can select to join.
The user who created the session can stream the combined video of themselves and their guests to an Amazon IVS channel, allowing viewers to watch a live stream of them and their guests.
Architecture overview
The overall architecture of the sample Android application and accompanying serverless backend has three major sections, as illustrated by the following diagram.
The leftmost section represents the Android application that participants use to exchange video and audio in real time. The center section represents the serverless backend app, and the rightmost section represents the playback application, which is a JavaScript application using the Amazon IVS Player SDK.
When a user in the Android app creates a stage, the app sends a request to an Amazon API Gateway endpoint, which invokes an AWS Lambda function. The Lambda function creates the required Amazon IVS resources and returns encrypted tokens that the Android app can use to join the Amazon IVS stage and chat room that were created. An Amazon DynamoDB entry is also created to keep track of the Amazon IVS resources that were created so that other users can view and join the stage.
When a user streams their stage session, the Android app calls a method in the Amazon IVS Broadcast SDK broadcastSession.start()
, which streams the stage directly to an Amazon IVS channel. When a stage is streamed, viewers can watch the live stream of the stage using the Amazon IVS Player SDK.
As more guests join the session, the app will automatically slot them into the broadcast, allowing viewers outside of the stage to watch and chat with the guests as they interact. While this sample implementation is intended for educational purposes, this overall architecture and approach shows how you can get started building a multi-host app using Amazon IVS and AWS.
Conclusion
This blog post serves as one example of how a developer could use the new real-time video features of Amazon IVS to create live streams with multiple hosts. Head over to the Enabling Multiple Hosts on a Stream guide for more detailed information about the APIs. As always, we are available on AWS re:Post to answer your questions.