All Products
Search
Document Center

ApsaraVideo Live:AddStudioLayout

Last Updated:Nov 14, 2024

Configures a layout for a virtual studio.

Operation description

You can call this operation to configure a common layout or a studio layout for a virtual studio.

QPS limit

You can call this operation up to 10 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
live:AddStudioLayoutcreate
*Caster
acs:live:*:{#accountId}:caster/{#CasterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
CasterIdstringYes

The ID of the production studio.

Note The production studio must be a virtual studio that you create in advance. You can use the ApsaraVideo Live console or call the CreateCaster operation to create a virtual studio.
  • If the production studio was created by calling the CreateCaster operation, check the value of the response parameter CasterId to obtain the ID.
  • If the production studio was created by using the ApsaraVideo Live console, obtain the ID on the Production Studio Management page. To go to the page, log on to the ApsaraVideo Live console and click Production Studios in the left-side navigation pane.
Note You can find the ID of the production studio in the Instance ID/Name column.
a2b8e671-2fe5-4642-a2ec-bf93880e****
LayoutNamestringYes

The name of the layout.

Test layout
LayoutTypestringYes

The type of the layout. Valid values:

  • common: If you set this parameter to common, you must specify the CommonConfig parameter.
  • studio: If you set this parameter to studio, you must specify the BgImageConfig and ScreenInputConfigList parameters. The MediaInputConfigList parameter is optional.
studio
CommonConfigstringNo

The common layout configurations. The value is a JSON string. For more information, see CommonConfig.

Note This parameter is required only if you set LayoutType to common.
{"ChannelId":"RV01" }
BgImageConfigstringNo

The background material configurations. The value is a JSON string. For more information, see BgImageConfig.

Note This parameter is required only if you set LayoutType to studio.
{ "Id":"k12kj31****", "MaterialId":"f080575eb5f4427684fc0715159a****" }
ScreenInputConfigListstringNo

The input configurations for chroma key. The value is a JSON string. For more information, see ScreenInputConfig.

Note This parameter is required only if you set LayoutType to studio.
[ { "Index":"1", "ChannelId":"RV01", "Color":"green", "PositionX":"0.1", "PositionY":"0.2", "HeightNormalized":"0.4" } ]
MediaInputConfigListstringNo

The multimedia input configurations. The value is a JSON string. For more information, see MediaInputConfig.

Note This parameter is optional and is valid only if you set LayoutType to studio.
[ { "Id":"k12kj31****", "Index":"1", "ChannelId":"RV01", "FillMode":"none", "PositionRefer":"topLeft", "WidthNormalized":"0.4", "HeightNormalized":"0.4", "PositionNormalized":"[0.1, 0.2]" }, { "Id":"k12kj31****", "Index":"2", "ImageMaterialId":"lkajsdfsa8fd89asd8****", "FillMode":"none", "PositionRefer":"topLeft", "WidthNormalized":"0.6", "HeightNormalized":"0.4", "PositionNormalized":"[0.1, 0.2]" } ]
LayerOrderConfigListstringNo

The layer sorting configurations. The value is a JSON string. For more information, see layerOrderConfig. You can sort layers of background and multimedia materials. The chroma key layer cannot be sorted. A layer that is in the front of the code is placed behind other layers in the layout.

[ { "Type":"media", "Id":"k12kj31****" }, { "Type":"media", "Id":"k12kj31****" } ]

CommonConfig

FiledTypeExampleDescription
ChannelIdStringRV01The ID of the channel that you want to bind to the video resource.

BgImageConfig

Note You can specify either ImageUrl or MaterialId. | Field | Type | Example | Description | | --------------- | ------ | --------------------- | -------------------------- | | Id | String | k12kj31**** | The unique ID of the material. | | ImageUrl | String | http://aliyundoc.com | The URL of the material. | | MaterialId | String | f080575eb5f4427684fc0715159a**** | The ID of the material in ApsaraVideo VOD. |

ScreenInputConfig

FiledTypeExampleDescription
IndexInteger1The sequence number of the chroma key source. This parameter is displayed on the frontend but not used in the operation logic. The value must be a positive integer.
ChannelIdStringRV01The ID of the channel that you want to bind to the video resource.
ColorStringgreenThe color gamut for chroma key. Valid values:
blue
green
auto: automatic recognition
complex: background replacement
PositionXFloat0.1The x-coordinate of the material. Valid values: 0 to 1.The upper-left corner is used as the coordinate origin for the material.
PositionYFloat0.2The y-coordinate of the material. Valid values: 0 to 1.The upper-left corner is used as the coordinate origin for the material.
HeightNormalizedFloat0.4The normalized value of the height. The value specifies the ratio of the height of the keyed portrait to the height of the background. Valid values: 0 to 1.

MediaInputConfig

  • If the multimedia material is a video, specify ChannelId.
  • If the multimedia material is an image, specify ImageMeterialId.
  • ChannelId and ImageMeterialId are mutually exclusive. You can specify only one of them.
FiledTypeExampleDescription
IdStringk12kj31****The unique ID of the multimedia material.
IndexInteger1The sequence number of the multimedia material. This parameter is displayed on the frontend but not used in the operation logic. The value must be a positive integer.
ChannelIdStringRV01The ID of the channel that you want to bind to the video resource.
ImageMaterialIdStringlkajsdfsa8fd89asd8****The ID of the image in ApsaraVideo VOD.
FillModeStringnoneThe fill type. Set this parameter to none.
PositionReferStringtopLeftThe coordinate origin for the material. Set this parameter to topLeft to specify the upper-left corner as the coordinate origin.
WidthNormalizedFloat0.4The normalized value of the material width. The value specifies the ratio of the material width to the width of the background. Valid values: 0 to 1.
HeightNormalizedFloat0.4The normalized value of the material height. The value specifies the ratio of the material height to the height of the background. Valid values: 0 to 1.
PositionNormalizedFloat[0.1, 0.2]The normalized value of the position of the material, in the format of [x,y]. Valid values of x and y: 0 to 1.For example, [0.1,0.2] indicates that the material is horizontally offset by 10% and vertically offset by 20% towards the upper-left corner.

LayerOrderConfig

FiledTypeExampleDescription
TypeStringmediaThe type of the resource. Valid values:background: the background materialmedia: the multimedia material
IdStringk12kj31****The unique ID of the resource.

Response parameters

ParameterTypeDescriptionExample
object
LayoutIdstring

The ID of the layout. You can use the ID as a request parameter in the following operations: DeleteStudioLayout, ModifyStudioLayout, and DescribeStudioLayouts.

445409ec-7eaa-461d-8f29-4bec2eb9****
RequestIdstring

The request ID.

5c6a2a0d-f228-4a64-af62-20e91b96****

Examples

Sample success responses

JSONformat

{
  "LayoutId": "445409ec-7eaa-461d-8f29-4bec2eb9****",
  "RequestId": "5c6a2a0d-f228-4a64-af62-20e91b96****"
}

Error codes

HTTP status codeError codeError message
400MissingParameter%s
400InvalidParameter.Malformed%s
400InvalidCasterId.Malformed%s
400InvalidUserId.Malformed%s
400InvalidPositionNormalized.Malformed%s
400InvalidHeightOrWidthNormalized%s
401IllegalOperation%s
404InvalidCaster.NotFound%s
500InternalError%s

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history