tencent cloud

Mobile Live Video Broadcasting

Setting Room Stream Mixing Layout

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-04-09 11:37:21

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
The reserved domain for the country/region where the SDKAppID is located:
Others in China: console.tim.qq.com
Singapore: adminapisgp.im.qcloud.com
Silicon Valley: adminapiusa.im.qcloud.com
Jakarta: adminapiidn.im.qcloud.com
v4/live_engine_http_srv/set_mix_stream
Request API.
sdkappid
Create an assigned SDKAppID for the Live application.
identifier
Must be an App administrator account. For more details, see App Admin.
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

grid mode
{
"RoomId":"mix1",
"LayoutMode":0, //grid mode
"VideoEncode":{
"Width":720,
"Height":1280
}
}
custom mode
{
"RoomId":"mix1",
"LayoutMode":1000,
"VideoEncode":{
"Width":720,
"Height":1280
},
"LayoutInfo":{
"LayoutList":[
{
"LocationX":0,
"LocationY":0,
"ImageWidth":360,
"ImageHeight":1280,
"RoomId":"mix1",
"Member_Account":"brennanli",
"StreamType":0,
"ZOrder":1
},
{
"LocationX":360,
"LocationY":0,
"ImageWidth":360,
"ImageHeight":1280,
"RoomId":"mix1",
"Member_Account":"tandy",
"StreamType":0,
"ZOrder":1
},
{ // audio-only presentation without video display​​
"LocationX":0,
"LocationY":0,
"ImageWidth":0,
"ImageHeight":0,
"RoomId":"mix1",
"Member_Account":"faker",
"StreamType":0,
"ZOrder":1
},
]
}
}
floating
{
"RoomId":"mix1",
"LayoutMode":1000,
"VideoEncode":{
"Width":720,
"Height":1280
},
"LayoutInfo":{
"LayoutList":[
{
"LocationX":540,
"LocationY":960,
"ImageWidth":180,
"ImageHeight":320,
"RoomId":"mix1",
"Member_Account":"brennanli",
"StreamType":0,
"ZOrder":1
}
],
"MaxUserLayout":{
"RoomId":"mix1",
"Member_Account":"tandy",
"StreamType":0,
"ZOrder":0
}
}
}
screen sharing
{
"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, single-stream bypass relay, ​​multi-stream transcode mixing.
1000 means custom mode. In custom mode, fields such as VideoEncode and LayoutInfo need to be set, and all streams must always go through the mix-transcoding pipeline.
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.
For common error codes (60000 to 79999), see the Error Code document.
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.




도움말 및 지원

문제 해결에 도움이 되었나요?

피드백