Skip to main content

Modify Layout

You can modify the recording layout during stream mixing.

Note

This API cannot modify configurations for MCU-based stream mixing recordings.

Service Activation

Cloud Recording is a paid value-added service.

  • In the development environment, you can experience Cloud Recording for free. Log in to the Console and navigate to the Cloud Recording page to activate the service and view your free trial quota.
  • In the production environment, prepayment is required to activate the service.

Before using the Cloud Recording API, ensure you've activated the service in the Console and completed relevant configurations. Note that the recording trigger method must be set to Manual to control recording via API. See Configure Cloud Recording Service for details.

Request Method

POST: https://data center domain/rtc/record/config.json

Signature Rules: All requests to RC server APIs require signature validation. Refer to API Request Signature.

Request Body Parameters

The HTTP request body contains a JSON object with the following structure:

ParameterTypeRequiredDescription
sessionIdStringYesThe session ID of the current call. Obtain this sessionId through RC server callbacks. See Room Status Update Callback.
mixLayoutNumberYesVideo layout mode for stream mixing. Options:
1: Custom layout
2: Floating layout
3: Adaptive layout
Default: Floating layout. See Understanding Stream Mixing Layouts.
renderModeNumberYesVideo scaling mode. Options:
1: Crop to fill (may trim video source)
2: Letterbox (may show black bars)
Default: Letterbox.
hostUserIdStringYesUser ID for the main view.
- Floating layout: Renders this user's video as the background.
- Adaptive layout: Renders this user's video in the top-left corner.
- Custom layout: Optional.
hostStreamIdStringYesStream ID for the main view.
- Floating layout: Renders this stream as the background.
- Adaptive layout: Renders this stream in the top-left corner.
- Custom layout: Optional.
input.videoArrayYesConfigures position and size for each video sub-window in the mixed layout.
input.video[i].userIdStringYesUser ID for the sub-window.
input.video[i].streamIdStringYesStream ID for the sub-window.
input.video[i].xNumberYesFloat. Sub-window's normalized x-coordinate (left offset / videoResolution width).
input.video[i].yNumberYesFloat. Sub-window's normalized y-coordinate (top offset / videoResolution height).
input.video[i].widthNumberYesFloat. Sub-window's normalized width (sub-window width / videoResolution width).
input.video[i].heightNumberYesFloat. Sub-window's normalized height (sub-window height / videoResolution height).

Request Example

POST /rtc/record/config.json HTTP/1.1
Host: api.rong-api.com
App-Key: uwd1c0sxdlx2
Timestamp: 1585127132438
Nonce: 14314
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Room-Id: room1
Content-Type: application/json

{
"sessionId":"aaa",
"renderMode":1,
"mixLayout":1,
"hostUserId":"abc",
"hostStreamId":"111_RongCloudRTC",
"input":{
"video":[
{
"userId":"111",
"streamId":"111_RongCloudRTC",
"x":0,
"y":0,
"width":0.5,
"height":0.5
},
{
"userId":"2222",
"streamId":"2222_RongCloudRTC",
"x":0.5,
"y":0.5,
"width":0.5,
"height":0.5
}
]
}
}

Response

FieldTypeDescription
codeNumberStatus code. 200 indicates success.
errorMessageStringError message.
recordIdStringUnique recording task ID. Used for callbacks or file segmentation correlation.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
"code":200,
"errorMessage":"Success",
"recordId":"b8bed381888091ff4e6a42d6f3b8782a"
}