Video Chat using Amazon Kinesis Video Streams and WebRTC

Peter Eskandar
3 min readDec 9, 2020

Hi all,

Today I wanted to share with you a simple Demo App that I’ve created while preparing for AWS DevOps Certification.

The Demo App is fully made in JavaScript and mainly based on Kinesis Video Streams integrated with WebRTC Client.

The idea of creating this App was the need to use as many AWS services as possible to be better prepared for the certification exam.

This is the list of AWS services that I’ve used while creating the APP :

  • AWS Code Commit (for the source code)
  • AWS CodeBuild (to build the DockerFile and push the image to ECR)
  • AWS CodePipeline
  • Cognito (to allow unauthenticated users to be able to interact with AWS Service, for example : the AWS Kinesis video streams)
  • ECR (as repository for docker images)
  • ECS Fargate (for the application deployment)
  • AWS ALB (load balancing fargate service)
  • Route53 (for domain registration)

The App allows video calls between One Master and Multiple Viewers, in other words the Master can make video and audio calls with all connected Viewers but Viewers can see only the Master as shown in the image below :

a screenshot while testing the Demo App

for the authentication part with Cognito, you need to update this script webRTC/authentication.js by adding your Cognito IDENTITY_POOL_ID and the role ARN which the users will assume to be able to interact with Kinesis.

async function getUserCredentials(formValues) {     
// cognito identity pool --> unauthorized access
const IDENTITY_POOL_ID = "Your identity pool id"; AWS.config.region = formValues.region;
AWS.config.credentials = await new AWS.CognitoIdentityCredentials({IdentityPoolId: IDENTITY_POOL_ID, RoleArn: 'unauthenticated users assume role ARN'}); }

TensorFlow & BodyPix :

Right now I’m working on the integration of Tensorflow & BodyPix for a real-time person segmentation to be able to add the blur background effect during the video calls, as show below :

How to use the Demo App :

to able to use the App, please follow the steps below :

  1. clone the git repository
  2. update webRTC/authentication.js as mentioned above
  3. create a Signaling Channel on AWS Kinesis Video Streams (you will need it while starting your app)
  4. build the DockerFile and run it, or open directly the index.html file
  5. insert the AWS Region in which you are operating and then insert the Signaling Channel Name you’ve already created. Now you can start your Master
  6. Open another browser tab, repeat step 5 and start your Viewer
  7. you can start multiple Viewers and only one Master
  8. enjoy the video call :)

Thanks a lot

--

--