Imagine yourself being in the spotlight and giving a great presentation in front of your colleagues. The love and appreciation that you got from your presentation make you wish your video calling platform had a recording feature. Well, hold on as we walk you through the process of building your own video chat application with cloud recording.
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 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.
- Flutter SDK.
- VS Code or Android Studio.
- A basic understanding of Flutter development.
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: A Flutter application built on the basic video chat project.
Environment Setup — Agora
- Generate an App ID and token: From your Agora console, create a project and select the authentication mechanism as Secured Mode. Copy the App ID and token to your clipboard, as we’ll be using them later.
- Enable cloud recording: Click the Edit button next to your project and enable cloud recording from there.
- Get customer credentials: Visit the RESTful API page and click the Add Secret button. Copy the Customer ID and Customer Secret to a text file as well.
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.
- Copy your AWS Access Key and Secret Key to a text file.
- 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.
- Find your region number (depending 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:
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.
- 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.
Once you have your Heroku back end 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 pass the token and uid you received from the
await _getToken(); await _engine.joinChannel(token, widget.channelName, null, uid);
Start Recording: Sends a POST request with the
channelName in the body. Once we get a response, update the state of
Stop Recording: Sends a POST request with
recUid in 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 Flutter 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.
Want to build Real-Time Engagement apps?
If you have questions, please call us at 408-879-5885. We’d be happy to help you add voice or video chat, streaming and messaging into your apps.