All Products
Search
Document Center

:AddStudioLayout

最終更新日:May 30, 2024

Configures a layout for a virtual studio.

Usage notes

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes AddStudioLayout

The operation that you want to perform. Set the value to AddStudioLayout.

CasterId String Yes a2b8e671-2fe5-4642-a2ec-bf93880e****

The ID of the production studio.

Important 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 Name column.
LayoutName String Yes Test layout

The name of the layout.

LayoutType String Yes studio

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.
CommonConfig String No {"ChannelId":"RV01" }

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

Important This parameter is required only if you set LayoutType to common.
BgImageConfig String No { "Id":"k12kj31****", "MaterialId":"f080575eb5f4427684fc0715159a****" }

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

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

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

Important This parameter is required only if you set LayoutType to studio.
MediaInputConfigList String No [ { "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]" } ]

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

Important This parameter is optional and is valid only if you set LayoutType to studio.
LayerOrderConfigList String No [ { "Type":"media", "Id":"k12kj31****" }, { "Type":"media", "Id":"k12kj31****" } ]

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.

CommonConfig

Field

Type

Example

Description

ChannelId

String

RV01

The 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

Field

Type

Example

Description

Index

Integer

1

The 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.

ChannelId

String

RV01

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

Color

String

green

The color gamut for chroma key. Valid values:

blue

green

auto: automatic recognition

complex: background replacement

PositionX

Float

0.1

The x-coordinate of the material. Valid values: 0 to 1.

The upper-left corner is used as the coordinate origin for the material.

PositionY

Float

0.2

The y-coordinate of the material. Valid values: 0 to 1.

The upper-left corner is used as the coordinate origin for the material.

HeightNormalized

Float

0.4

The 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.

Field

Type

Example

Description

Id

String

k12kj31****

The unique ID of the multimedia material.

Index

Integer

1

The 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.

ChannelId

String

RV01

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

ImageMaterialId

String

lkajsdfsa8fd89asd8****

The ID of the image in ApsaraVideo VOD.

FillMode

String

none

The fill type. Set this parameter to none.

PositionRefer

String

topLeft

The coordinate origin for the material. Set this parameter to topLeft to specify the upper-left corner as the coordinate origin.

WidthNormalized

Float

0.4

The 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.

HeightNormalized

Float

0.4

The 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.

PositionNormalized

Float

[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

Field

Type

Example

Description

Type

String

media

The type of the resource. Valid values:

background: the background material

media: the multimedia material

Id

String

k12kj31****

The unique ID of the resource.

Response parameters

Parameter

Type

Example

Description

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

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

RequestId String 5c6a2a0d-f228-4a64-af62-20e91b9676b3

The request ID.

Example

Sample requests

http(s)://live.aliyuncs.com/?Action=AddStudioLayout
&CasterId=a2b8e671-2fe5-4642-a2ec-bf93880e****
&LayoutName=Test layout
&LayoutType=studio
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AddStudioLayoutResponse>
    <LayoutId>445409ec-7eaa-461d-8f29-4bec2eb9****</LayoutId>
    <RequestId>5c6a2a0d-f228-4a64-af62-20e91b9676b3</RequestId>
</AddStudioLayoutResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

For a list of error codes, see Service error codes.