This guide includes the key steps in using the Cloud Recording RESTful API to make an individual recording. For more information, see Agora Cloud Recording RESTful API Quickstart.
Agora Cloud Recording supports three recording modes:
In individual recording mode, the audio and video of each UID in a channel are recorded in separate files.
For example, if a channel has two users and you choose to record both audio and video, Agora Cloud Recording generates two M3U8 files and several TS/WebM files for each user to store the audio and video separately, as is shown in the following diagram.
After merging the files using the Audio & Video File Merging script, each user's audio and video are stored in one MP4 file.
Before recording, call the acquire
method to apply for a resource ID.
acquire
Request URL:
https://api.agora.io/v1/apps/<yourappid>/cloud_recording/acquire
Content-type
: application/json;charset=utf-8
Authorization
: Basic authorization. For more information, see How to pass the basic HTTP authentication.
Request body:
{
"cname": "https://xxxxx",
"uid": "527841",
"clientRequest":{
"resourceExpiredHour": 24,
"scene": 0
}
}
To enable individual recording mode, set mode
to individual
when calling start
. Use recordingConfig
to configure individual recording, and use storageConfig
to configure your third-party cloud storage.
In individual recording mode, you can configure the following parameters in clientRequest
:
Parameter | Description | Note |
---|---|---|
token |
The dynamic key used for the channel to record. | Required if the channel uses a token |
recordingConfig |
Configures stream subscription, transcoding, and the profile of the output audio and video. | Required |
recordingFileConfig |
Configures the recorded files. | Optional |
storageConfig |
Configures the third-party cloud storage. | Required |
start
https://api.agora.io/v1/apps/<yourappid>/cloud_recording/resourceid/<resourceid>/mode/individual/start
Content-type
: application/json;charset=utf-8
Authorization
: Basic authorization. For more information, see How to pass the basic HTTP authentication. {
"uid": "527841",
"cname": "httpClient463224",
"clientRequest": {
"token": "<token if any>",
"recordingConfig": {
"maxIdleTime": 30,
"streamTypes": 2,
"channelType": 0,
"videoStreamType": 1,
"subscribeVideoUids": ["123","456"],
"subscribeAudioUids": ["123","456"],
"subscribeUidGroup": 0
},
"storageConfig": {
"accessKey": "xxxxxxf",
"region": 3,
"bucket": "xxxxx",
"secretKey": "xxxxx",
"vendor": 2,
"fileNamePrefix": ["directory1","directory2"]
}
}
}
In individual recording mode, the audio and video profiles of the recorded file are as follows:
The recorded files vary according to the recorded content. See the table below.
Recorded content | Settings | Recorded files |
---|---|---|
Audio only | Set streamTypes as 0 |
One M3U8 file and several TS/WebM files for each UID. The TS/WebM files store the audio. |
Video only | Set streamTypes as 1 |
One M3U8 file and several TS/WebM files for each UID. The TS/WebM files store the video. |
Audio and video | Set streamTypes as 2 (default) |
Two M3U8 files and several TS/WebM files for each UID. The TS/WebM files store the audio and video separately. |
If you choose the VP8 codec when recording a Web call in individual recording mode, Agora Cloud Recording generates WebM files instead of TS files. Otherwise, Agora Cloud Recording generates TS files.
For detailed information about the naming conventions of the recorded files, see Manage Recorded Files.