Skip to content
Cloud Recording for Android Video Chat - Social Featured

Cloud Recording for Android Video Chat

By Author: Meherdeep Thakur In Developer

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!

Prerequisites

  • 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.

Project Overview

This project has three major steps:

  1. Environment: This involves enabling the feature on your Agora account and setting up a client-server and an S3 account.
  2. Server: The code is written in GoLang.
  3. 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.

  1. Go to your AWS IAM Console, create a user, and make sure that you add the AmazonS3FullAccess policy with Programmatic Access.
Cloud Recording for Android Video Chat - Screenshot #1

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.

Server Setup

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:

APP_ID=
APP_CERTIFICATE=
RECORDING_VENDOR=
RECORDING_REGION=
BUCKET_NAME=
BUCKET_ACCESS_KEY=
BUCKET_ACCESS_SECRET=
CUSTOMER_ID=
CUSTOMER_CERTIFICATE=

Note: RECORDING_VENDOR=1 for AWS. Click this link for more information.

  1. Create an account on Heroku if you haven’t done so already.
  2. Click this link to use Heroku one-click deploy.
  3. Enter your variables and click the Deploy App button at the bottom of the page.
  4. 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.

Client Setup

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.
getToken()

Call this function before the joinChannel() method so that you can pass the token and uid you received from the getToken() function.

getToken()
joinChannel()
  • Start Recording: Sends a POST request with the channelName in the body. Once we get a response, update the state of rid, sid, and recUid.
startRecording()
  • Stop Recording: Sends a POST request with channelName, rid, sid, and recUid in the body. In the response, you will get a success or error message based on the parameters you passed.
stopRecording()

Conclusion

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.

Other Resources

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.