Start a cloud recording task

Updated

Starts a cloud recording task with an acquired resource ID.

POST
https://api.sd-rtn.com/v1/apps/{appid}/cloud_recording/resourceid/{resourceid}/mode/{mode}/start

After receiving a resource ID from acquire, call this endpoint within five minutes to start cloud recording.

Note

After calling start, check that the recording service has started successfully. See Integration best practices.

Path Parameters

appidstring
Required

The App ID of your project.

  • For web page recording mode, enter the App ID for which the cloud recording service is enabled.
  • For individual and composite recording modes, use the same App ID as the channel to be recorded. Ensure that the cloud recording service has been enabled for this App ID.
resourceidstring
Required

The resource ID obtained from the acquire endpoint.

modestring
Required

The recording mode:

  • individual: Individual recording mode.
  • mix: Composite recording mode.
  • web: Web page recording mode.

Header Parameters

Content-Typestring

application/json.

Request Body

application/json

cnamestring
Required

The name of the channel to record. Must match the cname used in the acquire request.

uidstring
Required

The UID used by the cloud recording service in the channel. Must match the uid used in the acquire request.

clientRequestobject
Required

Set this field to improve availability and optimize load balancing.

Note

Values must be valid and consistent with the startParameter in the acquire request body; otherwise the start request returns an error.

tokenstring

A dynamic key used for authentication. Required if your project has enabled the App Certificate. See Token authentication for details.

Only required in individual recording and composite recording modes. Cloud recording does not support token updates, so ensure the token validity period is longer than your expected recording duration to prevent the task from exiting the channel prematurely.

storageConfigobject
Required

Configuration for third-party cloud storage.

recordingConfigobject

Configuration for recorded audio and video streams. Set this object in individual and composite recording modes.

recordingFileConfigobject

Configuration for recorded files.

Note

Cannot be set when taking screenshots only. Required in all other cases including individual recording (without transcoding, with transcoding, or simultaneous recording and screenshots), composite recording, and web page recording.

snapshotConfigobject

Screenshot capture settings. Only applicable in individual recording mode.

  • Screenshots can be taken separately or simultaneously with recording. See Capture screenshots.
  • If the recording service or the recording upload service malfunctions, the screenshot may fail. Recording is not affected if the screenshot malfunctions.
  • streamTypes must be 1 or 2. If subscribeAudioUids is set, subscribeVideoUids must also be set.
extensionServiceConfigobject

Configuration for extended services. Only applicable in web page recording mode.

Response

  • If the returned status code is 200, the request was successful.

  • If the returned status code is not 200, the request failed. See Response status codes for troubleshooting.

Response Body

The request succeeded. To confirm that the recording service started successfully, follow the integration best practices.

cnamestring

The name of the channel to be recorded.

The name of the channel being recorded.

uidstring

The UID used by the cloud recording service in the RTC channel.

resourceIdstring

The cloud recording resource ID. Valid for five minutes; re-request from acquire if expired.

The resource ID used by cloud recording.

sidstring

The recording ID. Uniquely identifies a recording session. Generated after the cloud recording service starts successfully.

The recording ID, identifying the current recording session.

Response

See Page load timeout detection.

Response example

{
    "code": 7,
    "reason": "already started"
  }

Authorization

This endpoint requires authentication.

basicAuth

Request examples

curl --request POST \    --url https://api.sd-rtn.com/v1/apps/{appid}/cloud_recording/resourceid/{resourceid}/mode/{mode}/start \    --header 'Authorization: Basic <credentials>' \    --header 'Content-Type: application/json' \    --data '{    "cname": "<your_channel_name>",    "uid": "527841",    "clientRequest": {      "recordingConfig": {        "channelType": 1,        "streamTypes": 2,        "streamMode": "default",        "videoStreamType": 0,        "maxIdleTime": 30,        "subscribeAudioUids": ["123", "456"],        "subscribeVideoUids": ["123", "456"],        "subscribeUidGroup": 0      },      "recordingFileConfig": {        "avFileType": ["hls"]      },      "storageConfig": {        "vendor": 2,        "region": 3,        "bucket": "xxxxx",        "accessKey": "xxxxx",        "secretKey": "xxxxx",        "fileNamePrefix": ["directory1", "directory2"]      }    }  }'

Response example

{  "cname": "string",  "uid": "string",  "resourceId": "string",  "sid": "string"}