Amazon Chime SDK Smart Video Sending Demo
The Amazon Chime SDK provides real-time communications components that developers can use to quickly add audio, video, and screen sharing capabilities to their own web or mobile applications. In this blog post, we introduce the open-source Amazon Chime SDK Smart Video Sending Demo. The Demo showcases how to dynamically display up to 16 video tiles from a pool of up to 250 meeting attendees. Smart Video Sending is a simple method for developers to prioritize which videos are sent during a meeting. Any attendee joining a meeting is able to turn on and preview their video. Meanwhile a backend component uses a pre-assigned algorithm or configurable role-based logic to choose up to 16 attendee video streams to be sent and shared with the meeting. Developers can build logic to automatically determine the video streams that are shared, such as active or recent speaker, or assign control and selection of video streams in the meeting to a role, such as a facilitator. This solution enables all meeting attendees to share their video tiles on their own client. It also allows custom server-side logic to choose which ones are actually streamed to the meeting. For this demo, our backend logic is based on the order the attendees join, so new attendees get prioritized in streaming video. This logic lives in the AWS Lambda function depicted in the architecture diagram.
Note: Use of this demo is subject to standard pricing for the Amazon Chime SDK.
The basic flow is that meeting attendees can opt in to a video pool by turning on their local video. This is previewed locally by the meeting attendee and not initially shared with the meeting. After the attendee has opted in to the video pool, streaming of that video to the meeting is toggled on and off by the backend logic. This video control is determined by the backend pre-assigned logic or role-based logic for the meeting.
General Smart Video Sending solution
Smart Video Sending uses a pre-assigned algorithm that can be based on most recent speakers, active speakers, or any meeting state that is favored. The algorithm used in this demo is simple – it chooses the attendees who most recently enable his/her local video. Application developers can adapt this algorithm to dynamically choose which videos are featured during the meeting. Check out the demo code in the master branch on the GitHub repository amazon-chime-sdk-smart-video-sending-demo.
Role-based Smart Video Sending solution
Role-based Smart Video Sending can be added and allocated to a role in a meeting, such as an instructor or facilitator. They can then select the attendee video streams that are shared. Using role-based logic, the instructor is able to control live which attendee videos are shared in the meeting. This includes enabling pagination of different groups of attendees as well as customizing the frequency, selection and number of videos streamed throughout the meeting. Application of this logic can be used to enable teachers to select different groups of students to progressively share their video. Panel facilitators can also dynamically select and share the video of different speakers and participants during a virtual Q and A session. This logic also enables configuration or limitation of the number of video streams shared in a meeting. This is to manage participant interaction and bandwidth, for example by limiting to only a group of four attendee video streams shared at a time. An example of implementation role-based logic can be found in the role-based-video-sending branch on the same GitHub repository.
Instructor view – before acceptance of student’s video sending
Student view – instructor’s video + local preview video
Instructor view – after acceptance of student’s video sending
Student view – instructor’s video + local video (accepted by instructor)
The backend stack follows a standard serverless architecture. It uses Amazon API Gateway to route to the AWS Lambda functions that access Amazon DyanamoDB for persistent video sharing state management. It also uses Amazon Chime API to manage video meetings. Finally, it adopts Amazon API Gateway WebSocket APIs to support -server interaction.
In this solution, we provide an AWS CloudFormation template for developers to set up the necessary resources within their own AWS account.
- Install Node.
- Install version 2 of the AWS CLI.
- Install the AWS SAM CLI.
- Log into your AWS account with an IAM role that has the AdministratorAccess policy.
- Use the us-east-1 (N. Virginia) region of your AWS account.
Deploying the demo
The solution app is hosted on GitHub as amazon-chime-sdk-smart-video-sending-demo. Clone the application repository using the following command in the terminal:
git clone https://github.com/aws-samples/amazon-chime-sdk-smart-video-sending-demo.git
The following script creates an Amazon S3 bucket and AWS CloudFormation stack containing an AWS Lambda and API Gateway to run the demo. Replace the arguments with the names of your choosing. Note that the bucket name should be lower case and globally unique.
node ./deploy.js -r us-east-1 -b <YOUR-S3-BUCKET-NAME> -s <YOUR-CLOUDFORMATION-STACK-NAME>
After the script finishes running, it will output a URL in the terminal. The URL can be opened in a browser to access the Smart Video Sending meeting application.