Setting Room Stream Mixing Layout
Feature Description
App admins can use this API to set the specified room's stream mixing layout visual.
Note:
To use this capability, the prerequisite is: When you need to create a room, turn on the room's stream mixing capability, that is, set IsUnlimitedRoomEnabled to true, corresponding to the room created by the TUILiveKit Video Room add-on on the SDK side.
All the anchors involved in stream mixing must be on the seat.
API Call Description
Sample Request URL
https://xxxxxx/v4/live_engine_http_srv/set_mix_stream?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
Request Parameters
The following table only lists the parameters involved in modification when calling this API and their descriptions. For more parameter details, please see REST API Introduction.
Parameters | Description |
xxxxxx | Domain name corresponding to the country/region where your SDKAppID is located: China: console.tim.qq.com Singapore: adminapisgp.im.qcloud.com US: adminapiusa.im.qcloud.com |
v4/live_engine_http_srv/set_mix_stream | Request API |
sdkappid | Create an assigned SDKAppID for the Live application |
identifier | |
usersig | The generated signature of the App administrator account. For specific operations, see Generating UserSig |
random | Enter a random 32-bit unsigned integer in the range of [0,4294967295] |
contenttype | The request format has a fixed value of json |
Maximum Calling Frequency
20 times/second.
Sample Request Packet
Basic form
{"RoomId":"mix1","LayoutMode":1000,"VideoEncode":{"Width":720,"Height":1280},"LayoutInfo":{"LayoutList":[{"LocationX":630,"LocationY":0,"ImageWidth":90,"ImageHeight":160,"RoomId":"mix1","Member_Account":"brennanli","StreamType":0,"ZOrder":1}],"MaxUserLayout":{"RoomId":"mix1","Member_Account":"brennanli","StreamType":1,"ZOrder":0}}}
Request Packet Fields
Field | Type | Required | Description |
RoomId | String | Required | room ID, up to 48 bytes |
LayoutMode | Integer | Required | Layout mode, defaults to 0 0 means the default 9-grid view 1000 means custom mode. In custom mode, fields such as VideoEncode and LayoutInfo need to be set |
VideoEncode | Object | Optional | Resolution information, defaulting to 720P: Valid in custom mode In 9-grid view, if there is only one anchor in the room, bypass forwarding will be performed. Filling in this parameter is invalid |
Width | Integer | Optional | Video resolution width |
Height | Integer | Optional | High video resolution |
LayoutInfo | Object | Optional | Mixed stream layout information, this field is valid only in custom mode |
LayoutList | Array | Optional | Mixed stream anchor layout information, this field is valid only in custom mode |
MaxUserLayout | Object | Optional | Large screen in floating window during screen sharing, this field is valid only in custom mode |
Field descriptions of elements in LayoutList
Field | Type | Required | Description |
LocationX | Integer | Required | The anchor's position on the x-axis in the picture |
LocationY | Integer | Required | The anchor's position on the y-axis in the picture |
ImageWidth | Integer | Required | The width of the anchor in the picture |
ImageHeight | Integer | Required | The height of the anchor in the picture |
Member_Account | String | Required | Anchor Account Id |
StreamType | Integer | Required | Stream type: 0 indicates camera stream 1 indicates screen sharing stream |
ZOrder | Integer | Required | Anchor visual hierarchy: 0 refers to the bottom-level |
RoomId | String | Required | The room id corresponding to the anchor |
Field description of MaxUserLayout
Field | Type | Required | Description |
Member_Account | String | Required | Anchor Account Id |
StreamType | Integer | Required | Stream type: 0 indicates camera stream 1 indicates screen sharing stream |
ZOrder | Integer | Required | Anchor visual hierarchy: 0 refers to the bottom-level |
RoomId | String | Required | The room id corresponding to the anchor |
Sample Response Package Body
Basic form
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"RequestId": "Id-8c9858f01e954611ae2d4c1b1ed7d583-O-Seq-52720"}
Response Packet Fields
Field | Type | Description |
ActionStatus | String | Request processing result. OK indicates successful processing. FAIL indicates failure |
ErrorCode | Integer | Error code, 0 indicates success, non-zero indicates failure |
ErrorInfo | String | Error message |
RequestId | String | Unique request ID. It is returned for each request. RequestId is required for locating a problem |
Error Code Description
Unless a network error (such as 502 error) occurs, the HTTP return code of this API is 200. The actual error code and error information are indicated by ErrorCode and ErrorInfo in the response packet body.
The private error codes of this API are as follows:
Error Code | Description |
100001 | Internal server error, please retry |
100002 | Invalid parameter. Check whether the request is correct according to the error description |
100006 | The room type required is the Live room type |
100004 | Room does not exist or is dissolved |
100007 | The paid plan fails to satisfy |
100422 | Too many requests in a short time, subject to frequency control. The total mixing operations of each sdkappid are limited to 20 per second |
100424 | Mix stream task does not exist. Retry |
100427 | The mixing operation in this room is too fast. Please try again later |