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:
Parameter | Type | Required | Description |
---|---|---|---|
sessionId | String | Yes | The session ID of the current call. Obtain this sessionId through RC server callbacks. See Room Status Update Callback. |
mixLayout | Number | Yes | Video layout mode for stream mixing. Options: 1: Custom layout 2: Floating layout 3: Adaptive layout Default: Floating layout. See Understanding Stream Mixing Layouts. |
renderMode | Number | Yes | Video scaling mode. Options: 1: Crop to fill (may trim video source) 2: Letterbox (may show black bars) Default: Letterbox. |
hostUserId | String | Yes | User 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. |
hostStreamId | String | Yes | Stream 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.video | Array | Yes | Configures position and size for each video sub-window in the mixed layout. |
input.video[i].userId | String | Yes | User ID for the sub-window. |
input.video[i].streamId | String | Yes | Stream ID for the sub-window. |
input.video[i].x | Number | Yes | Float. Sub-window's normalized x-coordinate (left offset / videoResolution width). |
input.video[i].y | Number | Yes | Float. Sub-window's normalized y-coordinate (top offset / videoResolution height). |
input.video[i].width | Number | Yes | Float. Sub-window's normalized width (sub-window width / videoResolution width). |
input.video[i].height | Number | Yes | Float. 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
Field | Type | Description |
---|---|---|
code | Number | Status code. 200 indicates success. |
errorMessage | String | Error message. |
recordId | String | Unique 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"
}