Skip to content
Cloud Recording for Your iOS Agora Video Chat featured

Cloud Recording for Your iOS Agora Video Chat

By Author: Max Cobb In Developer

Agora Cloud Recording makes it easy for a developer to record and store the videos from their real-time engagement application. We’ll look at how to add cloud recording to a React Native video chat app. By the end of this tutorial, you’ll be able to record and save video calls from your application to an Amazon S3 bucket for later access.


  • An Agora developer account (see How to Get Started)
  • An AWS account
  • A Heroku account or another service to deploy the back end
  • An iOS device with minimum iOS 13.0 and Xcode 12
  • A basic understanding of iOS development
  • CocoaPods


Cloud Recording for Your iOS Agora Video Chat screenshot 1
Figure 1: Project Architecture

We’ll be deploying a Golang server to handle requests from our React Native app using the REST API. The Golang server will internally manage calling the Agora Cloud Recording service, which stores the result in an Amazon S3 bucket.

If you haven’t deployed a back-end service or used Golang before, don’t worry. We’ll walk through the entire process together.

Agora Setup

  1. Create a project: Once you have an Agora account, click the Project Management tab in the console. Click the Create button. Enter a name for your project. Select Secured Mode while creating the project.
  2. Enable cloud recording: Click the View usage button and select the option to enable cloud recording.
  3. Get app credentials: Copy the App ID and the App Certificate from the same page to a text file. We’ll use these later.
  4. Get customer credentials: Visit the RESTful API page and click the Add Secret button. Copy the Customer ID and the Customer Secret to a text file.

AWS Setup

Once you’ve created an AWS account, we need to create an Amazon S3 bucket to store our video recordings and an IAM user to access our bucket. If you already have this set up, feel free to skip this section:

  1. Go to your AWS IAM Console and create a user. Add the AmazonS3FullAccess policy with Programmatic Access.
  2. Copy your AWS Access Key and Secret Key to the text file.
  3. Create an Amazon S3 bucket and copy the bucket name to your text file. To find your region number (for your AWS region), go to the table and click the Amazon S3 tab. For example, if you’re using the US_EAST_1 region, your bucket number is 0.

Deploying Our Back End

The back end being used for this project can be found here.

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. Visit this link for more information.

  1. Create an account on Heroku if you haven’t done so already.
  2. Click this link to use the 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.

Building Our App

We’ll be using the Agora UIKit for iOS to make the video calling implementation simpler. If you’re new to the Agora UIKit library or the Agora platform, I’d recommend reading through the following blog before getting started:

Cloud Recording for Your iOS Agora Video Chat screenshot 2

We’ll start from the branch blog-start from this repo to get started. This branch has the basic video calling implemented. It just needs the cloud recording and token fetching added in the placeholders.

Getting the Boilerplate

Make sure you have satisfied the prerequisites for creating and building an iOS app. Git clone or download the ZIP file from the blog-start branch. In the project directory, execute pod install to install the right CocoaPods.

Adding Credentials

Open ViewController.swift and enter your back-end URL in the urlBase property, as well as your Agora App ID. The channel name will be set to "test", but it can be any alphanumeric string.

Joining the Channel

This project uses Agora UIKit for iOS, and we need to add some code for fetching the token using the endpoints used in this specific back end:

Starting the Recording

Using the same service as the token server, we can start recording using the endpoint /api/start/call with a POST call. We also need to store the rid, sid and recUid from the response:

Stopping the Recording

To stop recording, we send a POST request to the /api/stop/call endpoint of the back end with the channel, rid, sid, and recUid in the body:

Recording Status

Let’s create a function to check the status of our recording and log it to the console:

For information on what the status response shows, check out the RESTful API documentation.


That’s it — now you have an app that uses Agora Cloud Recording to store your videos. You can find out how to merge the resulting video fragments here. You can find more information about cloud recording here.

To see and the completed project, clone or download the main branch of the example repository, as well as launching the server.

For more information about building applications using SDKs, take a look at the Agora Video Call Quickstart Guide and Agora API Reference.

I also invite you to join the Agora Developer Slack community.