Ever since the pandemic started, two major things that I have been doing are attending meetings and immediately forgetting about them. This always made me wish that our video calling platform had a recording feature. If you ever have been in the same situation, then hold on as we walk you through the process of building your video chat application with its own cloud recording function.
The Agora SDK simplifies the process of building your own video chat application and adds cloud recording functionality so that you can record your video chats to various cloud platforms like AWS, Qiniu Cloud, Alibaba Cloud, Tencent Cloud, and Kingsoft Cloud.
So gear up and get coding!
- Clone this repo and checkout to the design branch, as the base project to work on.
- An Agora developer account (see How to Get Started).
- An AWS account.
- Heroku or any other service to deploy the back end.
- Android Studio.
This project has three major steps:
- Environment: This involves enabling the feature on your Agora account and setting up a client-server and an S3 account.
- Server: The code is written in GoLang.
- Client: An Android application built on the basic video chat project.
Environment Setup — AWS
Once you’ve created an AWS account, create an S3 bucket that stores all your video recordings.
- Go to your AWS IAM Console, create a user, and make sure that you add the
AmazonS3FullAccess policywith Programmatic Access.
2. Copy your AWS Access Key and Secret Key to a text file.
3. Create an AWS S3 bucket. Give it an appropriate name, and copy the name to your clipboard so that we can use it later. If you already have a bucket, you can skip this step.
4. Find your region number (which depends on your AWS server region), by going to this table and clicking the Amazon S3 tab.
Before deploying our back end we need the following variables. (It’s time to use our text file.) We’ll be using the Heroku one-click deploy to make it super simple to get our back end up and running. You can use any other service as well:
Note: RECORDING_VENDOR=1 for AWS. Click this link for more information.
- Create an account on Heroku if you haven’t done so already.
- Click this link to use Heroku one-click deploy.
- Enter your variables and click the Deploy App button at the bottom of the page.
- Wait a few minutes. Once the deployment is complete, save your back-end URL in a text file, which we’ll use in the app.
We will begin by cloning this repo and then checkout to the design branch, which demonstrates a video calling application using the Agora Android SDK. If you want to know more about setting up the video call, see this guide.
Once you have your token server up and running, you need to take care of three functions:
- Get RTC Token: Used to fetch a token from the back end, this token value is used whenever a user tries to enter a channel. A token ensures a safe and secure mode of authentication so that only users with this unique token value can join a call.
Call this function before the
joinChannel() method so that you can pass the token and uid you received from the
- Start Recording: Sends a POST request with the
channelNamein the body. Once we get a response, update the state of
- Stop Recording: Sends a POST request with
recUidin the body. In the response, you will get a success or error message based on the parameters you passed.
You can now run the sample app and test it for yourself. By running the app and recording the call for some time, you will find the recordings getting added to your S3 bucket in fragments.
You can get the complete code for this application here.
To learn more about the Agora Android SDK and other use cases, see the developer guide here.
You can also have a look at the complete documentation for the functions discussed above and many more here.
And I invite you to join the Agora Developer Slack Community.