LiteAVSDK
Tencent Cloud TRTC SDK, is a high availability components serving tens of thousands of enterprise customers, which is committed to helping you to minimize your research and development costs.
TXSubtitleRenderModel

Data Structures

class  TXSubtitleRenderModel
 

Detailed Description

Subtitle Rendering Parameters.


Data Structure Documentation

◆ com::tencent::liteav::txcplayer::model::TXSubtitleRenderModel

class com::tencent::liteav::txcplayer::model::TXSubtitleRenderModel
Data Fields
int canvasHeight

canvasWidth and canvasHeight are the size of the subtitle rendering canvas, The ratio of canvasWidth and canvasHeight must be consistent with the aspect ratio of the video, otherwise the rendered font will be deformed. If not set, the player will take the size of the current video as the size of the rendering canvas.

int canvasWidth

canvasWidth and canvasHeight are the size of the subtitle rendering canvas, The ratio of canvasWidth and canvasHeight must be consistent with the aspect ratio of the video, otherwise the rendered font will be deformed. If not set, the player will take the size of the current video as the size of the rendering canvas.

float endMargin

Margins along the subtitle text direction have different meanings depending on the writing direction. endMargin is a ratio value, the value range is [0, 1], that is, the ratio relative to the size of the video screen. For the horizontal writing direction, endMargin indicates the distance between the right side of the subtitle and the right side of the video screen, for example, endMargin=0.05, the margin is 0.05 times (5%) of the video width. For the vertical writing direction (whether from right to left or from left to right), endMargin indicates the distance between the bottom of the subtitle and the bottom of the video screen. For example, if endMargin=0.05, the margin is 0.05 times the height of the video (5%).

String familyName

font family name Android defaults to "Roboto" familyName is not controlled by paramFlags, if the string is not empty, it is considered to be set, and if it is empty, it is considered not to be set.

int fontColor

Font color, ARGB format If not set, the default is white opaque (0xFFFFFFFF)

float fontScale

font scaling vtt css only Use fontScale to multiply the font-size: em value set by vtt and then adapt to the video width The final font pixels are fontScale * vtt em * 16 * canvas width(video width) / default width(491) The default fontScale is 1.0, when the video width is 491 pixels, the Chinese font size is set to 16 pixels, and the font size in the vtt file is set to 1em(font-size: 1.00em;) refer to https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-size#ems fontSize if not set

float fontSize

font size If fontSize is set, canvasWidth and canvasHeight must be set, otherwise the internals don't know what size to use as a reference to render the font. If fontSize is not set, the default font size will be used internally.

boolean isBondFontStyle

Whether it is bold, the default is normal font.

float lineSpace

line spacing If lineSpace is set, canvasWidth and canvasHeight must be set. If not set, the default line spacing will be used internally.

int outlineColor

Stroke color, ARGB format. If not set, the default is black opaque (0xFF000000).

float outlineWidth

Stroke width. If not set, the default stroke width will be used internally.

float startMargin

The following startMargin, endMargin and yMargin define the drawing area of the subtitle. If not set, the settings in the subtitle file will be used. If the subtitle file is not defined, the default will be used. Note: Once startMargin, endMargin and yMargin are set, and the subtitle file also defines one or more of these parameters, the corresponding parameters in the subtitle file will be overwritten. The diagram below depicts the meaning of these parameters in the horizontal writing direction, please use the notes of each parameter to understand.

 -----------------------------------------------------------------------
|                                                                      |
|                                                                      |
|                                                                      |
|                        _________________________                     |
|----- startMargin -----|  This is subtitle text  |------endMargin-----|
|                       |_________________________|                    |
|                                    | yMargin                         |
 -----------------------------------------------------------------------

Margins along the subtitle text direction have different meanings depending on the writing direction. startMargin is a ratio value, the value range is [0, 1], that is, the ratio relative to the size of the video screen. For the horizontal writing direction, startMargin indicates the distance from the left side of the subtitle to the left side of the video screen. For example, if startMargin=0.05, the margin is 0.05 times (5%) of the video width. For the vertical writing direction (whether from right to left or from left to right), startMargin indicates the distance between the top of the subtitle and the top of the video screen. For example, if startMargin=0.05, the margin is 0.05 times (5%) the height of the video.

float verticalMargin

Margins in the vertical subtitle text direction have different meanings depending on the writing direction. yMargin is a ratio value, the value range is [0, 1], that is, the ratio relative to the size of the video screen. For the horizontal writing direction, yMargin indicates the distance between the bottom of the subtitle and the bottom of the video screen. For example, if yMargin=0.05, the margin is 0.05 times (5%) of the video height. For vertical and right-to-left writing directions, yMargin indicates the distance between the right side of the subtitle and the right side of the video screen. For example, if yMargin=0.05, the margin is 0.05 times (5%) of the video width. For vertical and left-to-right writing directions, yMargin indicates the distance between the left side of the subtitle and the left side of the video screen, for example, yMargin=0.05, the margin is 0.05 times (5%) of the video width.