Start recording
After getting a resource ID, call the start
method to begin cloud recording. The Cloud Recording service does the following after you call start
:
- Subscribes to the audio and video streams in the channel according to
recordingConfig
. - Processes the subscribed media streams, such as generating recorded files in the specified file format, taking video screenshots, or uploading recorded files to an extension service.
- Uploads the recorded files or screenshots to your third-party cloud storage according to
storageConfig
.
The HTTP method and endpoint of start
:
- Method: POST
- Endpoint: /v1/apps/<appid>/cloud_recording/resourceid/<resourceid>/mode/<mode>/start
The request frequency limit is 10 requests per second for each Agora account. Contact Agora technical support if you need to raise the limit.
HTTP request
The following parameters are required in the URL.
Parameter | Type | Description |
---|---|---|
appid | String | Your App ID. |
resourceid | String | The resource ID requested by the acquire method. |
mode | String | One of the following three recording modes:
|
The following parameters are required in the request body.
Parameter | Type | Description |
---|---|---|
cname | String |
|
uid | String | A string containing the user ID of the recording client. Must be the same uid used in the acquire method. |
clientRequest | JSON | A specific client request that requires the following parameters: token : String. The dynamic key used for the channel to record. Ensure that you set this parameter if App Certificate is enabled for your application. See Authenticate Your Users with Tokens.recordingConfig : JSON. Configurations for subscribing to media streams.recordingFileConfig : JSON. Configurations for the recorded files.snapshotConfig : JSON. Video screenshot configurations.storageConfig : JSON. Third-party cloud storage configurations.extensionServiceConfig : JSON. Configurations for third-party extension services. Currently supports ApsaraVideo for VoD and web page recording. |
Application configuration
appsCollection
is a JSON Object for configuring how the application services are combined and applied. It contains the following fields:
combinationPolicy
: (Optional) JSON Object. The combination method of various Cloud Recording applications.default
: (Default) String. Use this method for all application services except for Postpone Audio Mixing.postpone_transcoding
: Use this method if you use Postpone Audio Mixing and Postpone Transcoding.
Recording configuration
recordingConfig
is a JSON object for configuring how the Cloud Recording service subscribes to the media streams in the channel. recordingConfig
has the following fields:
-
channelType
: Number. The channel profile. Agora Cloud Recording must use the same channel profile as the Agora Video SDK. Otherwise, issues may occur.0
: (Default) Communication profile.1
: Live broadcast profile.
-
streamTypes
: (Optional) Number. The type of the media stream to subscribe to:0
: Subscribes to audio streams only.1
: Subscribes to video streams only.2
: (Default) Subscribes to both audio and video streams.
-
streamMode
: (Optional) String. The output mode of the media stream in individual recording mode. -
default
: Default mode. The Cloud Recording service transcodes the audio stream during recording and generates a M3U8 audio index file and a M3U8 video index file. -
standard
: Standard mode. Agora recommends that you use this mode. The Cloud Recording service transcodes the audio stream during recording and generates a M3U8 audio index file, a M3U8 video index file and a combined M3U8 audio and video index file. If VP9 encoding is used on the web side, a combined MPD audio and video index file are generated. When using the standard mode to generate MPD files, the player compatibility is as follows:- macOS: Movist/Chrome (47.0.2526.111+)
- Windows: Media Player/KM Player/VLC Player/Chrome (49.0.2623+)
- Linux: FFplay
-
original
: Original encoding mode, which takes effect only whenstreamTypes
is0
. The Cloud Recording service does not transcode the audio stream during recording and generates a M3U8 audio index file. The following table compares various aspects of the three modes ofstreamMode
:streamMode Description Index file generated Slice file generated Video encoded Audio encoded Features supported default
Default mode. One M3U8 audio index file and one M3U8 video index file are generated per user ID. Multiple TS audio slice files and multiple TS video slice files are generated per user ID. Does not transcode. Transcodes. Individual Recording, Capturing Screenshots, ApsaraVideo for VoD (VoD). standard
Standard mode. One M3U8 audio index file, one M3U8 video index file, and one combined M3U8 audio and video index file are generated per user ID. If VP9 encoding is used on the web side, a combined MPD audio and video index file is generated per user ID. Multiple TS audio slice files and multiple TS video slice files are generated per user ID.If VP9 encoding is used on the web side, multiple WebM audio slice files and multiple WebM video slice files are generated per user ID. Does not transcode. Transcodes. Individual Recording and Capturing Screenshots. original
Original encoding mode, which takes effect only when streamTypes
is0
.One M3U8 audio index file is generated per user ID. Multiple TS audio slice files per user ID. Not applicable. Does not transcode. Individual Audio Non-transcoding Recording and Postpone Audio Mixing. -
decryptionMode
: (Optional) Number. The decryption mode, which corresponds to the encryption mode set by the Agora Native/Web SDK. When the channel is encrypted, Agora Cloud Recording usesdecryptionMode
to enable the built-in decryption function.0
: (Default) None.1
: AES_128_XTS. 128-bit AES encryption, XTS mode.2
: AES_128_ECB. 128-bit AES encryption, ECB mode.3
: AES_256_XTS. 256-bit AES encryption, XTS mode.4
: SM4_128_ECB. 128-bit SM4 encryption, ECB mode.5
: AES_128_GCM. 128-bit AES encryption, GCM mode.6
: AES_256_GCM. 256-bit AES encryption, GCM mode.7
: AES_128_GCM2. 128-bit AES encryption, GCM mode. Compared to AES_128_GCM encryption mode, AES_128_GCM2 encryption mode is more secure and requires you to set the secret and salt.
-
8
: AES_256_GCM2. 256-bit AES encryption, GCM mode. Compared to AES_256_GCM encryption mode, AES_256_GCM2 encryption mode is more secure and requires you to set the secret and salt. -
secret
: (Optional) String. The decryption password when decryption mode is enabled. IfdecryptionMode
is not0
, you need to set this value. -
salt
: (Optional) Base64 encoding, 32-bit bytes. The decryption salt that needs to be set for the GCM2 encryption mode. IfdecryptionMode
is7
or8
, you need to set this value. -
audioProfile
: (Optional) Number. The profile of the output audio stream, including the sample rate, bitrate, encoding mode, and the number of channels. You cannot set this parameter in individual recording mode.0
: (Default) Sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 48 Kbps.1
: Sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 128 Kbps.2
: Sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 192 Kbps.
-
videoStreamType
: (Optional) Number. The type of the video stream to subscribe to.0
: (Default) Subscribes to the high-quality stream.1
: Subscribes to the low-quality stream.
-
maxIdleTime
: (Optional) Number. Agora Cloud Recording automatically stops recording and leaves the channel when there is no user in the recording channel after a time period (30 seconds by default) set by this parameter. The value range is from 5 to 2,592,000 (30 days). Once the recording stops, the recording service generates new recorded files if you callstart
for the second time.- In a communication channel, the recording service does not recognize a channel as an idle channel, so long as the channel has users, regardless of whether they send stream or not.
- If a live broadcast channel has an audience without a host for a set time (
maxIdleTime
), the recording service automatically stops and leaves the channel.
-
transcodingConfig
: (Optional) JSON. The video transcoding configuration. You cannot set this parameter in individual recording mode. If you set this parameter, ensure that you setwidth
,height
,fps
, andbitrate
. Refer to Set the Video Profile for detailed information about settingtranscodingConfig
.width
: Number. The width of the mixed video (pixels). The default value is 360.width
should not exceed 1920, andwidth
*height
should not exceed 1920 * 1080; otherwise, an error occurs.height
: Number. The height of the mixed video (pixels). The default value is 640.height
should not exceed 1920, andwidth
*height
should not exceed 1920 * 1080; otherwise, an error occurs.fps
: Number. The video frame rate (fps). The default value is 15.bitrate
: Number. The video bitrate (Kbps). The default value is 500.maxResolutionUid
: (Optional) String. WhenmixedVideoLayout
is set as2
(vertical layout), you can specify the user ID of the large video window by this parameter. It is a 32-bit unsigned integer within the range between 1 and (232-1).mixedVideoLayout
: (Optional) Number. The video mixing layout. 0, 1, and 2 are the predefined layouts. If you set this parameter as 3, you need to set the layout by thelayoutConfig
parameter.0
: (Default) Floating layout. The first user in the channel occupies the full canvas. The other users occupy the small regions on top of the canvas, starting from the bottom left corner. The small regions are arranged in the order of the users joining the channel. This layout supports one full-size region and up to four rows of small regions on top with four regions per row, comprising 17 users.1
: Best fit layout. This is a grid layout. The number of columns and rows and the grid size vary depending on the number of users in the channel. This layout supports up to 17 users.2
: Vertical layout. One large region is displayed on the left edge of the canvas, and several smaller regions are displayed along the right edge of the canvas. The space on the right supports up to 2 columns of small regions with 8 regions per column. This layout supports up to 17 users. WhenmixedVideoLayout
is set as2
, you can specify the user ID of the large video window bymaxResolutionUid
.3
: Customized layout. Set thelayoutConfig
parameter to customize the layout.
backgroundColor
: (Optional) String. The background color of the video canvas. Supports RGB color codes that start with a hashtag(#) followed by six hexadecimal numbers. The default value is"#000000"
, the black color.backgroundImage
: (Optional) String. The URL address of the background image of the video canvas. The display mode of the background image is cropped mode. In cropped mode, the recording service uniformly scales the image until it fills the visible boundaries (cropped). One dimension of the image may have clipped contents.defaultUserBackgroundImage
: (Optional) String. The URL address of the default background image of the user regions. After you set this parameter, the user region switches to the background image 3.5 seconds after a user stops sending the video stream; if you set a different background image for a specific user ID, this setting is overridden for that user ID.layoutConfig
: (Optional) JSONArray. An array of the configuration of each user's region. Supports 17 users at most. Each user's region configuration is a JSON object with the following parameters:uid
: (Optional) String. The string contains the user ID of the user displaying the video in the region. If this parameter is not specified, the configurations apply in the order of the users joining the channel.x_axis
: Float. The relative horizontal position of the top-left corner of the region. The value is between 0.0 (leftmost) and 1.0 (rightmost), and is accurate to six decimal places.y_axis
: Float. The relative vertical position of the top-left corner of the region. The value is between 0.0 (top) and 1.0 (bottom), and is accurate to six decimal places.width
: Float. The relative width of the region. The value is between 0.0 and 1.0, and is accurate to six decimal places.height
: Float. The relative height of the region. The value is between 0.0 and 1.0, and is accurate to six decimal places.alpha
: (Optional) Float. The transparency of the image. The value is between 0.0 (transparent) and 1.0 (opaque), and is accurate to six decimal places. The default value is 1.0.render_mode
: (Optional) Number. The video display mode:0
: (Default) Cropped mode. Uniformly scales the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.1
: Fit mode. Uniformly scales the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black.
backgroundConfig:
(Optional) JSONArray. The array contains the background configuration for specific user IDs.uid
: String. User ID (user ID).image_url
: String. The URL address of the background image of the user ID. After you set the background image, the user region switches to the background image 3.5 seconds after the user stops sending the video stream.render_mode
: (Optional) Number. The display mode.0
: (Default) Cropped mode. Uniformly scales the image until it fills the visible boundaries (cropped). One dimension of the image may have clipped contents.1
: Fit mode. Uniformly scales the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black.
In the above background image settings, the URL supports the HTTP and HTTPS protocols, and the background image supports the JPG and BMP formats. The size of the image should not exceed 6MB. The settings take effect only after the recording service successfully downloads the picture. Settings may be overridden if their priorities are low. See Set the background color or background image for details.
-
subscribeAudioUids
: (Optional) JSONArray. An array of the user IDs (user IDs) of the users whose audio you want to subscribe. If you want to subscribe to all user IDs, you do not need to set this parameter. The length of the array should not exceed 32 user IDs. Agora recommends that you do not set the array as empty. Once you set the parameter, do not setstreamTypes
inrecordingConfig
as1
. See Set up subscription lists for details. -
unSubscribeAudioUids
: (Optional) JSONArray. An array of the user IDs (user IDs) of the users whose audio you do not want to subscribe. Once you set this parameter, the recording service subscribes to the audio of all user IDs except the specified ones. The length of the array should not exceed 32 user IDs. Agora recommends that you do not set the array as empty. Once you set the parameter, do not setstreamTypes
inrecordingConfig
as1
. See Set up subscription lists for details. -
subscribeVideoUids
: (Optional) JSONArray. An array of the user IDs (user IDs) of the users whose video you want to subscribe. If you want to subscribe to all user IDs, you do not need to set this parameter. The length of the array should not exceed 32 user IDs. Agora recommends that you do not set the array as empty. Once you set the parameter, do not setstreamTypes
inrecordingConfig
as0
. See Set up subscription lists for details. -
unSubscribeVideoUids
: (Optional) JSONArray. An array of the user IDs (user IDs) of the users whose video you do not want to subscribe. Once you set this parameter, the recording service subscribes to the video of all user IDs except the specified ones. The length of the array should not exceed 32 user IDs. Agora recommends that you do not set the array as empty. Once you set the parameter, do not setstreamTypes
inrecordingConfig
as0
. See Set up subscription lists for details.
If you set up a subscription list for audio, but not for video, then Agora Cloud Recording will not subscribe to any video streams. If you set up a subscription list for video, but not for audio, then Agora Cloud Recording will not subscribe to any audio streams.
-
subscribeUidGroup
: (Optional) Number. The estimated maximum number of subscribed users. You must set this parameter in individual mode. For example, ifsubscribeVideoUids
is["100","101","102"]
andsubscribeAudioUids
is["101","102","103"]
, the number of subscribed users is 4.0
: 1 to 2 user IDs1
: 3 to 7 user IDs2
: 8 to 12 user IDs3
: 13 to 17 user IDs
-
4
: 17 to 32 user IDs -
5
: 32 to 49 user IDs
Transcoding configuration
transcodeOptions
is a JSON Object for configuring how the Cloud Recording service transcodes the recording files. It is applicable to Postpone Audio mixing and contains the following fields:
container
: (Optional) JSON, transcoding profile:format
: String. Format of output audio file. It can be set tomp3
,m4a
, oraac
. The default value ismp3
.
transConfig
: (Required) JSON. Transcoding configuration:transMode
: String. Transcoding mode. It can only be set toaudioMix
.
audio
: JSON. Audio profile of the output recording file:sampleRate
: String. Audio sample rate (Hz). It can be set to48000
,32000
, or16000
. The default value is48000
.bitrate
: String. Audio bitrate (Kbps). It can only be set to the default value of48000
.channels
: String. The number of channels. It can be set to1
or2
. The default value is2
.
Configurations for the recorded files
recordingFileConfig
is a JSON Object for configuring recorded files. You cannot set both recordingFileConfig
and snapshotConfig
at the same time, otherwise an error will occur. recordingFileConfig
includes the following fields:
avFileType
: (Optional) JSONArray. An array of strings. Sets the format of the recorded files.
"hls"
: (Default) M3U8 and TS files."mp4"
: MP4 files. This value is for composite recording (mix
) and web page recording (web
) only. For composite recording, when the length of the recorded file reaches approximately 2 hours, or when the size of the file exceeds approximately 2 GB, the recording service automatically creates an additional MP4 file. For web page recording, when the length of the recorded file reachesmaxVideoDuration
, the recording service automatically creates an additional MP4 file.
You must set "mp4"
together with "hls"
(otherwise, the recording service returns error code 2
). After the recording is over, you will get both MP4 and HLS files.
Snapshot configuration
Agora supports only taking screenshots in a recording process or recording and taking screenshots in a recording process.
snapshotConfig
is a JSON object for configuring how Cloud Recording takes screenshots. Pay attention to the following parameters, as incorrect settings result in errors or failure to capture screenshots.
- In the URL of your request,
mode
must beindividual
. - If you are recording and taking screenshots in a recording process, the
recordingFileConfig
parameter is required; if you are only taking screenshots in a recording process, you cannot setrecordingFileConfig
parameter. streamTypes
must be1
or2
.- If you have set
subscribeAudioUid
, you must also setsubscribeVideoUids
.
snapshotConfig
includes the following fields:
captureInterval
: (Optional) Integer. The time interval (in seconds) between two successive screenshots.captureInterval
should be within the range [1, 3600]. The default value is10
.fileType
: JSONArray. File format of the screenshots.fileType
can only take["jpg"]
, setting screenshots to the JPG format.
Cloud storage configuration
storageConfig
is a JSON object that configures the third-party cloud storage with the following fields.
-
vendor
: Number. The third-party cloud storage vendor.0
: Qiniu Cloud1
: Amazon S32
: Alibaba Cloud3
: Tencent Cloud4
: Kingsoft Cloud5
: Microsoft Azure6
: Google Cloud7
: Huawei Cloud8
: Baidu AI Cloud
-
region
: Number. The region information specified for the third-party cloud storage. The recording service only supports regions in the following lists:In order to improve the success rate and real-time performance when uploading recording files, if you set the
region
of the cloud recording service in theacquire
method, make sure that the region of the third-party cloud storage corresponds to the same geographical region. For example, if the region of the cloud recording service is set toNA
(North America), the third-party cloud storage needs to be set to a location within North America.- Third-party cloud storage is Qiniu Cloud (
vendor
= 0):0
: East China1
: North China2
: South China3
: North America4
: Southeast Asia
- Third-party cloud storage is Amazon S3 (
vendor
= 1):0
: US_EAST_11
: US_EAST_22
: US_WEST_13
: US_WEST_24
: EU_WEST_15
: EU_WEST_26
: EU_WEST_37
: EU_CENTRAL_18
: AP_SOUTHEAST_19
: AP_SOUTHEAST_210
: AP_NORTHEAST_111
: AP_NORTHEAST_212
: SA_EAST_113
: CA_CENTRAL_114
: AP_SOUTH_115
: CN_NORTH_116
: CN_NORTHWEST_117
: US_GOV_WEST_120
:AP_NORTHEAST_321
:EU_NORTH_122
:ME_SOUTH_123
:US_GOV_EAST_124
: AP_SOUTHEAST_325
: EU_SOUTH_126
: AWS_REGION_NUM
- Third-party cloud storage is Alibaba Cloud (
vendor
= 2):0
: CN_Hangzhou1
: CN_Shanghai2
: CN_Qingdao3
: CN_Beijing4
: CN_Zhangjiakou5
: CN_Huhehaote6
: CN_Shenzhen7
: CN_Hongkong8
: US_West_19
: US_East_110
: AP_Southeast_111
: AP_Southeast_212
: AP_Southeast_313
: AP_Southeast_514
: AP_Northeast_115
: AP_South_116
: EU_Central_117
: EU_West_118
: EU_East_119
:AP_Southeast_620
:CN_Heyuan21
:CN_Guangzhou22
:CN_Chengdu For details, see Alibaba Cloud Documentation.
- Third-party cloud storage is Tencent Cloud (
vendor
= 3):0
:AP_Beijing_11
:AP_Beijing2
:AP_Shanghai3
:AP_Guangzhou4
:AP_Chengdu5
:AP_Chongqing6
:AP_Shenzhen_FSI7
:AP_Shanghai_FSI8
:AP_Beijing_FSI9
:AP_Hongkong10
:AP_Singapore11
:AP_Mumbai12
:AP_Seoul13
:AP_Bangkok14
:AP_Tokyo15
:NA_Siliconvalley16
:NA_Ashburn17
:NA_Toronto18
:EU_Frankfurt19
:EU_Moscow
- Third-party cloud storage is Kingsoft Cloud (
vendor
= 4):0
:CN_Hangzhou1
:CN_Shanghai2
:CN_Qingdao3
:CN_Beijing4
:CN_Guangzhou5
:CN_Hongkong6
:JR_Beijing7
:JR_Shanghai8
:NA_Russia_19
:NA_Singapore_1
- Third-party cloud storage is Microsoft Azure (
vendor
= 5), theregion
parameter has no effect, if it is set or not. - Third-party cloud storage is Google Cloud (
vendor
= 6), theregion
parameter has no effect, if it is set or not. - Third-party cloud storage is Huawei Cloud (
vendor
= 7):0
:CN_North_11
:CN_North_42
:CN_East_23
:CN_East_34
:CN_South_15
:CN_Southwest_26
:AP_Southeast_17
:AP_Southeast_28
:AP_Southeast_39
:AF_South_110
:SA_Argentina_111
:SA_Peru_112
:NA_Mexico_113
:SA_Brazil_114
:LA_South_215
:SA_Chile_1
- Third-party cloud storage is Huawei Cloud (
vendor
= 7):0
:CN_North_11
:CN_North_42
:CN_East_23
:CN_East_34
:CN_South_15
:CN_Southwest_26
:AP_Southeast_17
:AP_Southeast_28
:AP_Southeast_39
:AF_South_110
:SA_Argentina_111
:SA_Peru_112
:NA_Mexico_113
:SA_Brazil_114
:LA_South_215
:SA_Chile_1
- Third-party cloud storage is Baidu AI Cloud (
vendor
= 8):0
:Beijing1
:Baoding2
:Suzhou3
:Guangzhou4
:Hongkong5
:Singapore6
:Wuhan7
:Shanghai
- Third-party cloud storage is Qiniu Cloud (
-
bucket
: String. The bucket name of the third-party cloud storage. -
accessKey
: String. The access key of the third-party cloud storage. Agora suggests that you use a write-only access key. -
secretKey
: String. The secret key of the third-party cloud storage. -
fileNamePrefix
: (Optional) JSONArray. An array of strings. Sets the path of the recorded files in the third-party cloud storage. For example, iffileNamePrefix
=["directory1","directory2"]
, Agora Cloud Recording will add the prefix "directory1/directory2/
" before the name of the recorded file, that is,directory1/directory2/xxx.m3u8
. The prefix's length, including the slashes, should not exceed 128 characters. The string itself should not contain symbols such as slash, underscore, or parenthesis. The supported characters are as follows:- The 26 lowercase English letters: a to z
- The 26 uppercase English letters: A to Z
- The 10 numbers: 0 to 9
-
extensionParams
: (Optional) JSON Object. The third-party cloud storage service encrypts and labels the uploaded recording files according toextensionParams
, which contains the following fields:sse
:Encryption mode. The third-party cloud storage service encrypts the uploaded recording file according to the encryption mode. This field is only applicable to Amazon S3. See official Amazon S3 documentation for details. It can be set to:kms
: KMS encryption.aes256
: AES256 encryption.
tag
: Tag content. The third-party cloud storage service tags the uploaded recording file according to the tag content. This field is only applicable to Alibaba Cloud and Amazon S3. See Alibaba Cloud official documentation and Amazon S3 official documentation for details.
Extension service configuration
extensionServiceConfig
is a JSON Object for extension service configurations. Extension services are a collection of applications that process the media streams generated from the Agora Video SDK. One example extension service is VoD service.
extensionServiceConfig
has the following fields:
errorHandlePolicy
: (Optional) String. Error handling policy. You can only set it to the default value,"error_abort"
, which means that once an error occurs to an extension service, all other non-extension services, such as stream subscription, also stop.apiVersion
: (Optional) String. The version of the Cloud Recording RESTful API. The default value is"v1"
.extensionServices
: JSONArray. An array of the configuration for each extension service.
Currently you cannot configure more than one extension service per recording session.
ApsaraVideo for VoD
When using ApsaraVideo for VoD, extensionServicesextensionServices
includes the following fields:
serviceName
: String. The name of the extension service. To use ApsaraVideo for VoD, set it as"aliyun_vod_service"
.errorHandlePolicy
: (Optional) String. Error handling policy. You can only set it to the default value,"error_abort"
, which means that if an error occurs to the current extension service, other extension services also stop.serviceParam
: JSON. Configurations for an extension service. To use ApsaraVideo for VoD, configure as follows:accessKey
: String. Corresponds to theAccessKeyId
in the AccessKey of Alibaba Cloud. For details, see Alibaba Cloud's documentation.secretKey
: String. Corresponds to theAccessKeySecret
in the AccessKey of Alibaba Cloud. For details, see Alibaba Cloud's documentation.regionId
: String. The service region. For details, see Alibaba Cloud's documentation.apiData
: JSON. Configurations for ApsaraVideo for VoD.videoData
: JSON. Video configurations. See Alibaba Cloud's documentation for details about the following parameters:title
: String. The title of the video.description
: (Optional) String. The description of the video.coverUrl
: (Optional) String. The URL of the custom video thumbnail.cateId
: (Optional) String. The ID of the video category. The ID must be an integer.tags
: (Optional) String. The tags of the video.templateGroupId
: (Optional) String. The ID of the transcoding template group.userData
: (Optional) String. The custom configurations.storageLocation
: (Optional) String. The bucket.workflowId
: (Optional) String. The ID of the workflow.
Currently only composite recording is supported.
Web page recording
When using web page recording, extensionServices
includes the following fields:
serviceName
: String. The name of the extension service. To use web page recording, set it as "web_recorder_service
".errorHandlePolicy
: (Optional) String. Error handling policy. Currently you can only set it to the default value,"error_abort"
, which means that if an error occurs to the current extension service, other extension services also stop.serviceParam
: JSON. Configurations for an extension service. To use web page recording, configure as follows:url
:String. Sets the address of the web page to record.videoBitrate
:(Optional) Number. Sets the bitrate of the video (Kbps). The value range is [50,8000]. The default value ofvideoBitrate
varies according to the resolution of the output video:- If the resolution of the output video is greater than or equal to 1280 × 720, the default value of
videoBitrate
is 2000. - If the resolution of the output video is less than 1280 × 720, the default value of
videoBitrate
is 1500.
- If the resolution of the output video is greater than or equal to 1280 × 720, the default value of
videoFps: (Optional)
Number. Sets the frame rate of the video (fps). The value range is [5,60]. The default value is 15.audioProfile
:Number. Sets the sample rate, encoding mode, number of audio channels, and bitrate.0
: (Default) Sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 48 Kbps.1
: Sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 128 Kbps.2
: Sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 192 Kbps.
videoWidth
:Number. Sets the width of the video (pixels). The value range is [480,1920]. The product ofvideoWidth
andvideoHeight
should not exceed 2,073,600 (1920 × 1080).videoHeight
:Number. Sets the height of the video (pixels). The value range is [480,1920]. The product ofvideoWidth
andvideoHeight
should not exceed 2,073,600 (1920 × 1080).maxRecordingHour
: Number. Sets the maximum recording length (hours). If the limit is exceeded, the recording stops automatically. The value range is [1,720]. Agora recommend that you set a value smaller than the value ofresourceExpiredHour
specified in theacquire
method. The charging will continue until the web page recording stops. You should set a reasonablemaxRecordingHour
based on the actual business scenario or actively stop the web page recording.maxVideoDuration
: (Optional) Number. Sets the maximum duration (in minutes) of the MP4 slice file generated by the web page recording. The value range is [30,240], and the default value is 120 minutes. During a web page recording, when the length of the recorded file reaches aroundmaxVideoDuration
, the recording service creates another MP4 slice file.onhold
: (Optional) Bool. Sets whether to pause the web page recording when starting the web page recording task.true
:Pauses the web page recording when starting the web page recording task. After the web page recording task is started, the web page recording is paused immediately. The recording service opens and renders the page to be recorded, but does not generate a slice file.- (Default)
false
: Starts the web page recording task and continue web page recording.
Agora recommends that you use the
onhold
parameter as follows: When calling thestart
method, set theonhold
parameter totrue
, start and pause the web page recording, determine the appropriate time to start the web page recording, and call theupdate
method and set theonhold
parameter tofalse
to continue the web page recording. If you need to continuously call theupdate
method to pause or resume page recording, call it after receiving the last HTTP response ofupdate
; otherwise the actual result may be inconsistent with your expectation.
readyTimeout
: (optional) Number. Sets the web page loading timeout limit, in seconds.The value range is [0,60].- 0 or null, which means the web page loading status is not detected.
- An integer greater than or equal to 1, which sets the web page load timeout limit.
If you set
readyTimeout
to less than 0 or a non-integer, an error code2
is received.
Push media stream to the CDN during a web page recording
When pushing media stream to the CDN during a web page recording, extensionServices
includes fields of web page recording and streaming. The fields of streaming are as follows:
serviceName
: String. The name of the extension service. To use web page recording, set it as "rtmp_publish_service".errorHandlePolicy
: (Optional) String. Error handling policy. Currently you can only set it to the default value, "error_ignore", which means that if an error occurs to the current extension service, other extension services are not affected.serviceParam
: JSON. Configurations for an extension service. To push media stream to the CDN during a web page recording, configure as follows:outputs
:JSON Array. Configure as follows:rtmpUrl
:String. The CDN address which you want to push stream to.
Request example
- The request URL is:
Content-type
isapplication/json;charset=utf-8
.Authorization
is basic HTTP authentication, see RESTful API authentication for details.- The request body:
Audio and video recording in a channel
VoD service
Capturing snapshots only
Capturing snapshots and recording
Web page recording
Push media stream to the CDN during a web page recording
Individual audio non-transcoding recording
Individual audio non-transcoding recording and postpone audio mixing
Postpone transcoding
HTTP response
If the returned HTTP status code is 200
, it means the request was successful, and the response body contains the following fields:
code
: Number. Status code.resourceId
: String. The resource ID for cloud recording. The resource ID is valid for five minutes.sid
: String. The recording ID. The unique identification of the current recording.