All Products
Search
Document Center

ApsaraVideo Live:AddCasterComponent

Last Updated:Nov 14, 2024

Adds a component to a production studio.

Operation description

Before you call this operation to add a component to a production studio, you must first create the production studio and learn about the production studio layouts. You can call this operation to add three types of components: image, text, and subtitle. For information about how to create a production studio, see CreateCaster .

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.

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:AddCasterComponentcreate
*Caster
acs:live:*:{#accountId}:caster/{#CasterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
CasterIdstringYes

The ID of the production 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.
LIVEPRODUCER_POST-cn-0pp1czt****
ComponentNamestringNo

The component name. By default, the component name is the component ID.

text01
LocationIdstringYes

The location ID of the component. Each location ID can be assigned to only one component and must be in the RC[Number] format. The values specified by this parameter must be in ascending order, such as RC01 to RC99.

Note If the ComponentType parameter is set to caption, the LocationId parameter specifies the location ID of the video source referenced by the component.
RC01
ComponentTypestringYes

The component type. Valid values:

  • text: a text component. If you set ComponentType to text, you must also specify TextLayerContent.
  • image: an image component. If you set ComponentType to image, you must also specify ImageLayerContent.
  • caption: a caption component. If you set ComponentType to caption, you must also specify CaptionLayerContent.
text
EffectstringNo

The effect of the component. Valid values:

  • none (default)
  • animateH: horizontal scrolling
  • animateV: vertical scrolling
animateH
ComponentLayerstringYes

The information about the component layer, such as the size and layout. This parameter contains the following fields:

  • HeightNormalized: the normalized value of heights for the elements in the component layer
  • WidthNormalized: the normalized value of widths for the elements in the component layer
  • PositionNormalized: the normalized value of the coordinates of the component layer
  • PositionRefer: the reference coordinates of the component layer.

The value is a JSON string. Use upper camel case for field names.

{"HeightNormalized":"1","PositionRefer":"topRight","WidthNormalized":"0","PositionNormalized":["0.1","0.2"]}
LayerOrderstringNo

The layer stacking order of the component. Valid values:

  • cover
  • background
cover
TextLayerContentstringNo

The information about the text layer. This parameter contains the following fields:

Note This parameter is available and required only when the ComponentType parameter is set to text.
  • SizeNormalized: the normalized font size. The font size is set to font_size/output_height. The value range is [0,1]. If the font size calculated by the system based on the normalization method is greater than 1024, 1024 is used.
  • BorderWidthNormalized: the normalized value of the text border width. The normalized value is calculated based on the size of the text, that is, "BorderWidth/FontSize". The value range is [0,1]. If the value calculated based on the normalization method exceeds 16, 16 is used. The default value is 0.
  • FontName: the font name. For more information about the value, see Font description. The default value is KaiTi.
  • BorderColor: the color of the text border. Valid values: 0x000000 to 0xffffff. By default, this parameter is not set. In this case, the color of the text border is transparent.
  • Text: the content of the text. By default, this parameter is not set. In this case, the text contains no content.
  • Color: the color of the text. The default value is 0xff0000, which indicates that the text is in red.

The value is a JSON string. Use upper camel case for field names.

{"BorderWidthNormalized":"1","SizeNormalized":"0.2","Color":"0x000000","FontName":"KaiTi","BorderColor":"0x000000","Text":"hello world!"}
ImageLayerContentstringNo

The information about the image layer. This parameter contains the following fields:

Note This parameter is required when the ComponentType parameter is set to image.

MaterialId: the ID of the asset from the media asset library. The name that you set when you upload an asset is the ID of the asset.

The value is a JSON string. Use upper camel case for field names.

{"MaterialId":"6cf724c6ebfd4a59b5b3cec6f10d****"}
CaptionLayerContentstringNo

The information about the caption layer. This parameter contains the following fields:

Note This parameter is required when the ComponentType parameter is set to caption.
  • SizeNormalized: the normalized font size. The font size is set to font_size/output_height. The value range is [0,1] and accurate to two decimal places. If the font size calculated by the system based on the normalization method is greater than 1024, 1024 is used.
  • BorderWidthNormalized: the normalized value of the text border width, which is calculated based on the size of the text, namely "BorderWidth/FontSize". The value range is [0,1] and accurate to two decimal places. If the value calculated according to the normalization method exceeds 16, 16 is used. The default value is 0.
  • FontName: the font name. For more information about the value, see Font description. The default font name is KaiTi.
  • BorderColor: the color of the text border. Valid values: 0x000000 to 0xffffff. By default, this parameter is not set. In this case, the color of the text border is transparent.
  • LocationId: the channel ID of the source subtitle.
  • SourceLan: the source language of the audio in the source video. Valid values: en, cn, es, and ru, which indicate English, Chinese, Spanish, and Russian respectively. Default value: cn.
  • TargetLan: the target audio language in the source video. If you do not specify this field, speech recognition is used. If you specify this field, translation is used. Valid values: en, cn, es, and ru, which indicate English, Chinese, Spanish, and Russian respectively. Default value: cn.
  • ShowSourceLan: specifies whether to display the source language. Valid values: true: displays the source language. false: hides the source language. Default value: false.
  • Truncation: specifies whether to allow caption truncation. Valid values: true: specifies that the caption can be truncated. false: specifies that the caption cannot be truncated. Default value: false.
  • SourceLanPerLineWordCount: the number of words displayed in each line when the subtitle is in the source language. Default value: 20.
  • TargetLanPerLineWordCount: the number of words displayed in each line when the subtitle is in the destination language. Default value: 20.
  • SourceLanReservePages: the number of lines reserved when the subtitle is in the source language. This field takes effect only when the Truncation field is set to true. Default value: 2.
  • TargetLanReservePages: the number of lines reserved when the subtitle is in the destination language. This field takes effect only when the Truncation field is set to true. Default value: 2.

The value is a JSON string. Use upper camel case for field names.

{"BorderWidthNormalized":0.01,"SizeNormalized":0.05,"Color":"0x000000","LocationId":"RV01","SourceLan":"cn","FontName":"KaiTi","BorderColor":"0xffffff"}
HtmlLayerContentstringNo

The information about the HTML5 layer.

{"htmlUrl":http://caster.example.com}

Font description

FontValues of FontName
KaiTiKaiTi
Alibaba PuHuiTi-RegularAlibabaPuHuiTi-Regular
Alibaba PuHuiTi-BoldAlibabaPuHuiTi-Bold
Alibaba PuHuiTi-LightAlibabaPuHuiTi-Light
Source Han Sans-RegularNotoSansHans-Regular
Source Han Sans-BoldNotoSansHans-Bold
Source Han Sans-LightNotoSansHans-Light

Response parameters

ParameterTypeDescriptionExample
object
ComponentIdstring

The component ID. The value can be used as the value of a request parameter to query, modify, or delete a production studio.

21926b36-7dd2-4fde-ae25-51b5bc8e****
RequestIdstring

The request ID.

16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

Examples

Sample success responses

JSONformat

{
  "ComponentId": "21926b36-7dd2-4fde-ae25-51b5bc8e****",
  "RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F4CD8"
}

Error codes

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

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

Change history

Change timeSummary of changesOperation
No change history