All Products
Search
Document Center

:AddLiveAISubtitle

Last Updated:Dec 05, 2024

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

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:AddLiveAISubtitlecreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
SubtitleNamestringYes

The name of the subtitle template. The name can contain only digits, letters, and hyphens (-). The name cannot start with a hyphen.

sub01
SrcLanguagestringYes

The source language. Valid values:

  • en-US: English
  • zh-CN: Chinese
  • ru-RU: Russian
zh-CN
DstLanguagestringNo

The target language. Valid values:

  • en-US: English
  • zh-CN: Chinese
  • es-ES: Spanish
  • ru-RU: Russian
zh-CN
FontColorstringNo

The font color, which is an RGBA value.

0xFFFFFF
FontNamestringNo

The font. Valid values:

  • KaiTi (default)
  • AlibabaPuHuiTi-Regular
  • AlibabaPuHuiTi-Bold
  • AlibabaPuHuiTi-Light
  • NotoSansHans-Regular
  • NotoSansHans-Bold
  • NotoSansHans-Light
KaiTi
BgColorstringNo

The background color of the subtitles, which is an RGBA value.

0xFF0000
PositionNormalizedarrayYes

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.

floatYes

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]
ShowSourceLanbooleanNo

Specifies whether to display the source language. Default value: false.

true
MaxLinesintegerNo

The number of displayed lines.

2
WordPerLineintegerYes

The number of words displayed per line. Valid values: integers from 1 to 500.

20
FontSizeNormalizedfloatYes

The font size. Valid values: [0,1].

0.037
BorderWidthNormalizedfloatNo

The font weight. Valid values: [0,1].

0.05
BgWidthNormalizedfloatNo

The background size of the subtitles. Valid values: [0,1].

0.09
CopyFromstringNo

The subtitle template that you copy. Set the value to the name of the subtitle template.

sub01
DescriptionstringNo

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
WidthstringNo

The preview width. Unit: pixels.

1280
HeightstringNo

The preview height. Unit: pixels. The following specifications of preview width × preview height are supported:

  • Landscape low definition 360p (640×360)
  • Portrait low definition 360p (360×640)
  • Landscape standard definition 480p (854×480)
  • Portrait standard definition 480p (480×854)
  • Landscape high definition 720p (1280×720)
  • Portrait high definition 720p (720×1280)
  • Landscape ultra-high definition 1080p (1920×1080)
  • Portrait ultra-high definition 1080p (1080×1920)
720

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

5c6a2a0df228-4a64-af62-20e91b96****
SubtitleIdstring

The ID of the subtitle template.

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

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter%s.Parameter error
400MissingParameter%s.Missing parameter

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

Change history

Change timeSummary of changesOperation
2024-12-04The Error code has changedView Change Details