This guide includes the key steps in using the Cloud Recording RESTful API to make a web page recording. For more information, see Agora Cloud Recording RESTful API Quickstart.
Agora Cloud Recording supports three recording modes:
In web page recording mode, the content and audio of a specified web page are recorded in a single file.
You can use web page recording to reproduce scenarios such as online classes and video conferences. For example, if your web application integrates both the Agora SDK and a third-party whiteboard SDK, web page recording can record everything on the web page instead of only the audio and video streams.
You can also record from a specific perspective. For example, if you want to record an online class from the teacher's perspective, you can develop a web page that contains every operation that the teacher performs and record that web page.
Before recording, call the acquire
method to apply for a resource ID. Note that you must set scene
as 1
.
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": "httpClient463224",
"uid": "527841",
"clientRequest":{
"resourceExpiredHour": 24,
"scene": 1
}
}
To enable web page recording mode, set mode
to web
when calling start
. Use extensionServiceConfig
to configure web page recording, and use storageConfig
to configure your third-party cloud storage.
In web page recording mode, you can configure the following parameters in clientRequest
:
Parameter | Description | Note |
---|---|---|
storageConfig |
Configures the third-party cloud storage. | Required |
recordingFileConfig |
Configures the recorded files. | Optional |
extensionServiceConfig |
Configures web page recording. | Required |
start
Request URL:
https://api.agora.io/v1/apps/<yourappid>/cloud_recording/resourceid/<resourceid>/mode/web/start
Content-type:
application/json;charset=utf-8
Authorization:
Basic authorization. For more information, see How to pass the basic HTTP authentication.
Request body:
{
"cname":"httpClient463224",
"uid":"527841",
"clientRequest":{
"token": "<token if any>",
"extensionServiceConfig": {
"errorHandlePolicy": "error_abort",
"extensionServices":[{
"serviceName":"web_recorder_service",
"errorHandlePolicy": "error_abort",
"serviceParam": {
"url": "https://xxxxx",
"audioProfile":0,
"videoWidth":1280,
"videoHeight":720,
"maxRecordingHour":72
}
}]
},
"recordingFileConfig":{
"avFileType":[
"hls",
"mp4"
]
},
"storageConfig":{
"vendor":2,
"region":3,
"bucket":"xxxxx",
"accessKey":"xxxxx",
"secretKey":"xxxxx",
"fileNamePrefix":[
"directory1",
"directory2"
]
}
}
}
A web page recording session generates one M3U8 file and multiple TS files. Depending on the value of avFileType
, the recording session may also generate one or more MP4 files. For detailed information about the naming conventions of the recorded files, see Manage Recorded Files.
Windows.close
when a sub iframe fails to load, which will cause the recording service to stop and exit.update
and updateLayout
methods.start
method cannot be accessed, the recording service exits automatically after the start
call. To ensure that the recording service starts successfully, see Best Practices in Integrating Cloud Recording.start
method automatically enables the client to publish streams, the browser engine started by the recording server becomes a video sender. As a result, the recording server's video may be displayed as empty in the video panel of your application.