Adds a subtitle template.
Operation description
Instructions
- This interface supports adding live caption template configurations, with templates configurable to describe caption content, layout, and more.
- After adding caption templates, you also need to call the AddLiveAIProduceRules interface to add caption rules. Restarting the stream will then enable captions in the broadcast.
- Real-time captions are currently supported in Beijing, Shanghai, Singapore, Indonesia, and Saudi regions.
Notice The real-time caption feature is currently in beta testing. Each user can add up to 300 caption templates.
QPS Limit
The QPS limit for this interface per user is 60 requests/second. Exceeding this limit will result in API throttling, which may impact your services. Please use judiciously. For more information, refer to QPS Limitations.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
live:AddLiveAISubtitle | create | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
SubtitleName | string | Yes | The name of the subtitle template. The name can contain only digits, letters, and hyphens (-). The name cannot start with a hyphen. | sub01 |
SrcLanguage | string | Yes | The source language. Valid values:
| zh-CN |
DstLanguage | string | No | The target language. Valid values:
| zh-CN |
FontColor | string | No | The font color, which is an RGBA value. | 0xFFFFFF |
FontName | string | No | The font. Valid values:
| KaiTi |
BgColor | string | No | The background color of the subtitles, which is an RGBA value. | 0xFF0000 |
PositionNormalized | array | Yes | The position of the subtitles. The value is a pair of coordinates for which the origin of the x and y axes is the lower-left corner of the screen. | |
float | Yes | The position of the subtitles. The value is a pair of coordinates for which the origin of the x and y axes is the lower-left corner of the screen. | [0.32,0.27] | |
ShowSourceLan | boolean | No | Specifies whether to display the source language. Default value: false. | true |
MaxLines | integer | No | The number of displayed lines. | 2 |
WordPerLine | integer | Yes | The number of words displayed per line. Valid values: integers from 1 to 500. | 20 |
FontSizeNormalized | float | Yes | The font size. Valid values: [0,1]. | 0.037 |
BorderWidthNormalized | float | No | The font weight. Valid values: [0,1]. | 0.05 |
BgWidthNormalized | float | No | The background size of the subtitles. Valid values: [0,1]. | 0.09 |
CopyFrom | string | No | The subtitle template that you copy. Set the value to the name of the subtitle template. | sub01 |
Description | string | No | The custom description of the subtitle template. The description can be up to 128 characters in length and can contain letters, digits, and special characters. | live AI subtitle template |
Width | string | No | The preview width. Unit: pixels. | 1280 |
Height | string | No | The preview height. Unit: pixels. The following specifications of preview width × preview height are supported:
| 720 |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "5c6a2a0df228-4a64-af62-20e91b96****",
"SubtitleId": "445409ec-7eaa-461d-8f29-4bec2eb9****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter | %s. | Parameter error |
400 | MissingParameter | %s. | Missing parameter |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-12-04 | The Error code has changed | View Change Details |