Skip to main content

You are viewing Agora Docs forBetaproducts and features. Switch to Docs

Web page recording

Overview

This guide includes the key steps in using the Cloud Recording RESTful API to make a web page recording.

Agora Cloud Recording supports three recording modes:

  • Individual recording
  • Composite recording
  • Web page recording

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.

In web page recording mode, you can also convert the content and audio of the page into a media stream and push it to the CDN during the recording process.

Prerequisites

  • If you want to use web page recording along with other cloud recording functions, such as individual recording or screenshot capturing, Agora suggests that you use a separate App ID for web page recording for more independent resource management.
  • You need to provide a web application that can be accessed through a URL, so that the content can be recorded. (The hosts and the audience can use web or other platforms.)
  • Your web application should support Chrome.
  • The web page content is displayed completely in one screen, that is, no scrolling is needed.
  • If you want to record every operation of the host on the screen, you need to sync the operations in your web application.

Implement a Web Page Recording

Get a resource ID

Before recording, call the acquire method to apply for a resource ID. Note that you must set scene as 1.

An HTTP request example of acquire

  • Request URL:

_1
https://api.agora.io/v1/apps/<yourappid>/cloud_recording/acquire


_8
{
_8
"cname": "httpClient463224",
_8
"uid": "527841",
_8
"clientRequest": {
_8
"resourceExpiredHour": 24,
_8
"scene": 1
_8
}
_8
}

Start recording

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.

You cannot switch to a different recording mode once you start recording.

In web page recording mode, you can configure the following parameters in clientRequest:

ParameterDescriptionNote
storageConfigConfigures the third-party cloud storage.Required
recordingFileConfigConfigures the recorded files.Optional
extensionServiceConfigConfigures web page recording.Required

An HTTP request example of start

  • Request URL:

_1
https://api.agora.io/v1/apps/<yourappid>/cloud_recording/resourceid/<resourceid>/mode/web/start


_40
{
_40
"cname": "httpClient463224",
_40
"uid": "527841",
_40
"clientRequest": {
_40
"token": "<token if any>",
_40
"extensionServiceConfig": {
_40
"errorHandlePolicy": "error_abort",
_40
"extensionServices": [
_40
{
_40
"serviceName": "web_recorder_service",
_40
"errorHandlePolicy": "error_abort",
_40
"serviceParam": {
_40
"url": "https://xxxxx",
_40
"audioProfile": 0,
_40
"videoWidth": 1280,
_40
"videoHeight": 720,
_40
"maxRecordingHour": 3
_40
}
_40
}
_40
]
_40
},
_40
"recordingFileConfig": {
_40
"avFileType": [
_40
"hls",
_40
"mp4"
_40
]
_40
},
_40
"storageConfig": {
_40
"vendor": 2,
_40
"region": 3,
_40
"bucket": "xxxxx",
_40
"accessKey": "xxxxx",
_40
"secretKey": "xxxxx",
_40
"fileNamePrefix": [
_40
"directory1",
_40
"directory2"
_40
]
_40
}
_40
}
_40
}

Stop recording

The charging will continue until the web page recording stops. You should set a reasonable maxRecordingHour based on the actual business scenario or actively stop the web page recording.

When a recording finishes, call stop to leave the channel and stop recording. To use Agora Cloud Recording again, you need to call the acquire method for a new resource ID.

An HTTP request example of stop

  • The request URL is:

_1
http://api.agora.io/v1/apps/<yourappid>/cloud_recording/resourceid/<resourceid>/sid/<sid>/mode/web/stop


_5
{
_5
"cname": "httpClient463224",
_5
"uid": "527841",
_5
"clientRequest": {}
_5
}

Implement Pushing Stream to the CDN during a Web Page Recording

Get a resource ID

Before starting the process, call the acquire method to apply for a resource ID. Note that you must set scene as 1.

An HTTP request example of acquire

  • Request URL:

_1
https://api.agora.io/v1/apps/<yourappid>/cloud_recording/acquire


_8
{
_8
"cname": "httpClient463224",
_8
"uid": "527841",
_8
"clientRequest": {
_8
"resourceExpiredHour": 24,
_8
"scene": 1
_8
}
_8
}

Start a process

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.

You cannot switch to a different recording mode once you start recording.

In web page recording mode, you can configure the following parameters in clientRequest:

ParameterDescriptionNote
storageConfigConfigures the third-party cloud storage.Required
recordingFileConfigConfigures the recorded files.Optional
extensionServiceConfigConfigures web page recording.Required

An HTTP request example of start

  • Request URL:

_1
https://api.agora.io/v1/apps/<yourappid>/cloud_recording/resourceid/<resourceid>/mode/web/start


_51
{
_51
"cname": "httpClient463224",
_51
"uid": "527841",
_51
"clientRequest": {
_51
"token": "<token>",
_51
"extensionServiceConfig": {
_51
"extensionServices": [
_51
{
_51
"serviceName": "web_recorder_service",
_51
"errorHandlePolicy": "error_abort",
_51
"serviceParam": {
_51
"url": "https://xxxxx",
_51
"audioProfile": 0,
_51
"videoWidth": 1280,
_51
"videoHeight": 720,
_51
"maxRecordingHour": 3,
_51
"maxVideoDuration": 200
_51
}
_51
},
_51
{
_51
"serviceName": "rtmp_publish_service",
_51
"errorHandlePolicy": "error_ignore",
_51
"serviceParam": {
_51
"outputs": [
_51
{
_51
"rtmpUrl": "rtmp://xxx"
_51
}
_51
]
_51
}
_51
}
_51
]
_51
},
_51
"recordingFileConfig": {
_51
"avFileType": [
_51
"hls",
_51
"mp4"
_51
]
_51
},
_51
"storageConfig": {
_51
"vendor": 2,
_51
"region": 3,
_51
"bucket": "xxxxx",
_51
"accessKey": "xxxxx",
_51
"secretKey": "xxxxx",
_51
"fileNamePrefix": [
_51
"directory1",
_51
"directory2"
_51
]
_51
}
_51
}
_51
}

Stop the process

When a recording and stream pushing finishes, call stop to leave the channel and stop recording. To use Agora Cloud Web Page Recording again, you need to call the acquire method for a new resource ID.

An HTTP request example of stop

  • The request URL is:

_1
http://api.agora.io/v1/apps/<yourappid>/cloud_recording/resourceid/<resourceid>/sid/<sid>/mode/web/stop


_5
{
_5
"cname": "httpClient463224",
_5
"uid": "527841",
_5
"clientRequest": {}
_5
}

Recorded files

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.

Pricing

Web page recording mode is free to use by November 1, 2021. See Pricing for Web Page Recording for details.

Considerations

Application restrictions

  • The recorded web page should not contain any video that has a resolution higher than 1920 × 1080.
  • The resolution of the videos generated by the web page recording is up to 1920 × 1080.
  • The recorded web page should not use WebGL.
  • The downlink bitrate of your web application should not exceed 10 Mbps, and the uplink bitrate should not exceed 2 Mbps.
  • Ensure that your web application does not consume excessive CPU memory and network bandwidth and that your application is used legally.
  • If you enable the autoplay property for a video element in the recorded web page, the recording service can play the video without any user interaction. However, if you disable the autoplay property, the video cannot be played automatically, and the recording service cannot record the content of the video.
  • The recorded webpage should not be redirected to a different domain, and should avoid any other types of redirection. If the webpage requires login, complete the login first before the recording session starts.
  • You can use the web page load timeout detection function to prevent the recorded content from being inconsistent with the expected content caused by the web page load timeout.

RESTful API requests

  • Recording starts approximately five seconds after you send a request. We recommend you send the request in advance to ensure that everything you want to record is captured.
  • Web page recording does not support the update and updateLayout methods.
  • If the URL you specify in the 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.

Other considerations

  • During a recording, when the length of the recorded file reaches around the value of maxVideoDuration, or when the size of the file exceeds around 2 GB, the recording service automatically creates another MP4 file.
  • In a web page recording, the recording service can be considered a client of your web application.
    • If the URL you specify in the 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.
    • If your application displays a user list, we recommend you hide the recording server from the list to avoid confusion among other users.
vundefined