CreateMixStream
Creates a stream mixing task.
Operation description
Cloud stream mixing is a paid feature. This feature is in public preview and is currently free of charge. Standard fees will apply after the public preview period. The end date of the public preview will be announced at a later date.
You can call this operation to create a stream mixing task. This operation supports both preset and custom layouts.
QPS limit
A single user can make up to 10 queries per second (QPS). Calls that exceed this limit are throttled. Throttling may affect your business operations. We recommend that you plan your calls accordingly.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
live:CreateMixStream |
create |
*Domain
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
No |
The region ID. |
cn-shanghai |
| DomainName |
string |
Yes |
The primary streaming domain. Important
Currently, only domain names in the China (Shanghai) and China (Beijing) regions are supported. |
example.com |
| LayoutId |
string |
Yes |
The layout ID. Valid values:
Note
For more information, see Preset stream mix layouts. |
MixStreamLayout-1-1 |
| InputStreamList |
string |
Yes |
The list of input streams. This is a JSON array. For more information, see InputStreamConfig below. |
[{"LayoutChildId":1,"ResourceType":"live","ResourceValue":"rtmp://example.net/live/f2139ec2b8d6a191068cd****ea9064d?auth_key=1600947017-0-0-0b5645fe35d21a65ab92b394bd4d****","LayoutConfig":{"FillMode":"fit","PositionRefer":"topLeft","FillPositionNormalized":[0,0],"FillSizeNormalized":[1,1]}}] |
| OutputConfig |
string |
Yes |
The output configuration. This is a JSON string. For more information, see OutputConfig below. |
{"AppName":"liveApp****","StreamName":"9a78fb3f5c508be0122746f677a3****","MixStreamTemplate":"lp_hd_v","ExpireDuration":"86400"} |
| CallbackConfig |
string |
No |
The webhook address. This is a JSON array. When an event occurs, the live service sends an HTTP POST request to this address. The request body contains the event details. |
{"CallbackUrl":"http://aliyundoc.com"} |
InputStreamConfig
| Name | Type | Description |
| ResourceType | String | The resource type. live: A live streaming URL. url: A file streaming URL. |
| ResourceValue | String | The resource URL. If ResourceType is set to live, this is a live streaming URL. The URL can use the RTMP, FLV, or HLS protocol. The Alibaba Real-Time Communication (ARTC) protocol is not supported. If ResourceType is set to url, this is a file streaming URL. |
| LayoutChildId | String | The ID of the layout pane. This ID also determines the stacking order (z-order) of the streams. |
| LayoutConfig | LayoutConfig[] | A JSON array that specifies the position, fill mode, and other layout information. This parameter is not required if you use a preset layout. If you set this parameter, the preset layout information corresponding to LayoutChildId is ignored. |
LayoutConfig
| Name | Type | Required | Description |
| FillSizeNormalized | JSON array of floating-point numbers | Yes | The size of the area to fill for this layer element. [w,h]: The values of w and h range from 0 to 1. The width and height are normalized. For example, [0.2,0.3] indicates that the width is 20% of the total width and the height is 30% of the total height. |
| FillPositionNormalized | Array of floating-point numbers | Yes | The normalized position of the fill area for this layer element. [x,y]: The values of x and y range from 0 to 1. For example, [0.1,0.1] indicates a horizontal offset of 10% and a vertical offset of 10% from the top-left corner. |
| PositionRefer | String | No | The reference point for the element's position coordinates. Set this parameter to topLeft. This value indicates the top-left corner. |
| FillMode | String | No | The fill mode for the element. none: No fill. fit: Scales the stream to fit the pane. The longest edge reaches the border, and black bars may be added to the shorter edge. fill: Scales the stream proportionally based on the larger of the width or height ratio, and then crops the stream to fill the entire pane. Set this parameter to fit. |
OutputConfig
| Name | Type | Required | Description |
| AppName | String | Yes | The name of the output application. Special characters such as # and ? are not supported. |
| StreamName | String | Yes | The name of the output stream. Special characters such as # and ? are not supported. |
| MixStreamTemplate | String | Yes | The ID of the output stream mix template. Pass only the template ID, such as lp_ld. Valid values: lp_ld (resolution: 640 × 360), lp_sd (resolution: 854 × 480), lp_hd (resolution: 1280 × 720), lp_ud (resolution: 1920 × 1080), lp_ld_v (resolution: 640 × 360), lp_sd_v (resolution: 854 × 480), lp_hd_v (resolution: 1280 × 720), lp_ud_v (resolution: 1920 × 1080) , lp_ld_v_optm (resolution: 640 × 360), lp_sd_v_optm (resolution: 854 × 480), lp_hd_v_optm (resolution: 1280 × 720), lp_ud_v_optm (resolution: 1920 × 1080). _v indicates a vertical screen template. _optm indicates a low-latency template. The values in parentheses indicate the resolution of the template. |
| ExpireDuration | Long | No | The expiration time of the task. Unit: seconds. Valid values: 1 to 31536000 (one year). If you do not set this parameter, the task expires and is deleted after seven days. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| MixStreamId |
string |
The ID of the stream mix task. Use this ID to query or delete the task. |
5b2a046e-74d7-385e-253f-8a5b87e4**** |
| RequestId |
string |
The request ID. |
0D715397-2E66-4AE1-694h-C546628AD145 |
Examples
Success response
JSON format
{
"MixStreamId": "5b2a046e-74d7-385e-253f-8a5b87e4****",
"RequestId": "0D715397-2E66-4AE1-694h-C546628AD145"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidUserId.Malformed | %s, please check userId. | The userId passed in is invalid, please check. |
| 400 | InvalidParameter.Malformed | There are invalid parameters: %s. | There are invalid parameters: %s. |
| 400 | MissingParameter | %s. | Missing parameter |
| 401 | IllegalOperation | %s, please check and try again later. | Operation not allowed, please check and try again. |
| 500 | InternalError | %s, please try again later. | Internal error, please try again later. |
| 403 | MixStreamAlreadyExist | %s, please check and try again later. | The confluence task already exists, please check and try again. |
| 403 | MixStreamNotExist | %s, please check and try again later. | The confluous task does not exist. Please check and try again. |
| 403 | UserQuotaExceed | Quota exceeded: %s. | Quota exceeded: %s. |
| 404 | InvalidDomainName.NotFound | %s, please check and try again later. | Domain name does not exist, please check and try again. |
See for a complete list.
Release notes
See Release Notes for a complete list.