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

Data Structures

class  TXPlayerSubtitleRenderModel
 

Detailed Description

Subtitle Rendering Parameters.


Data Structure Documentation

◆ TXPlayerSubtitleRenderModel

class TXPlayerSubtitleRenderModel
+ Inheritance diagram for TXPlayerSubtitleRenderModel:

Properties

int canvasWidth
 
int canvasHeight
 
NSString * familyName
 
float fontSize
 
float fontScale
 
uint32_t fontColor
 
float outlineWidth
 
uint32_t outlineColor
 
BOOL isBondFontStyle
 
float lineSpace
 
float startMargin
 
float endMargin
 
float verticalMargin
 

Property Documentation

◆ canvasHeight

- (int) canvasHeight
readwritenonatomicassign

◆ canvasWidth

- (int) canvasWidth
readwritenonatomicassign

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 these two parameters are set, paramFlags must be set to TXPlayerSubtitleRenderParamFlagCanvasWidth and TXPlayerSubtitleRenderParamFlagCanvasHeight. If not set, the player will take the size of the current video as the size of the rendering canvas.

◆ endMargin

- (float) endMargin
readwritenonatomicassign

The margin along the subtitle text direction has different meanings according to different writing directions. 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 (5%) of the video height. If endMargin is set, paramFlags must be set to TXPlayerSubtitleRenderParamFlagEndMargin.

◆ familyName

- (NSString*) familyName
readwritenonatomiccopy

Font family name iOS defaults to "Helvetica". Be careful not to confuse it with the font name, for example, "Helvetica-Bold" is the font name, and its family Helvetica. familyName is not controlled by paramFlags, if the string is not empty, it is considered to be set.

◆ fontColor

- (uint32_t) fontColor
readwritenonatomicassign

Font color, ARGB format If fontColor is set, paramFlags must be set to TXPlayerSubtitleRenderParamFlagOutlineColor If not set, the default is white opaque

◆ fontScale

- (float) fontScale
readwritenonatomicassign

If not set, use fontSize.

Font scaling ratio vtt css dedicated Use fontScale to multiply the font-size: em value set by vtt and then adapt to the video width If fontScale is set, paramFlags must be set to TP_SUBTITLE_PARAM_FLAG_FONT_SCALE The final font pixel is fontScale * vtt em * 16 * canvas width(video width) / default width(491) fontScale defaults to 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;)

◆ fontSize

- (float) fontSize
readwritenonatomicassign

Font size. If fontSize is set, canvasWidth and canvasHeight must be set, otherwise the internal does not know what size to use as a reference to render the font If fontSize is set, paramFlags must be set to TPSubtitleRenderParamFlagFontSize If fontSize is not set, the default font size will be used internally

◆ isBondFontStyle

- (BOOL) isBondFontStyle
readwritenonatomicassign

Font style, whether it is bold.

◆ lineSpace

- (float) lineSpace
readwritenonatomicassign

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

◆ outlineColor

- (uint32_t) outlineColor
readwritenonatomicassign

Stroke color, ARGB format If outlineColor is set, paramFlags must be set to TPSubtitleRenderParamFlagOutlineColor If not set, the default is black and opaque

◆ outlineWidth

- (float) outlineWidth
readwritenonatomicassign

Stroke width If outlineWidth is set, canvasWidth and canvasHeight must be set, otherwise the internal does not know what size to use as a reference to render the stroke If outlineWidth is set, paramFlags must be set to TPSubtitleRenderParamFlagOutlineWidth If not set, the default stroke width will be used internally

◆ startMargin

- (float) startMargin
readwritenonatomicassign

The following startMargin, endMargin and yMargin define the drawing area of the subtitle, if not set, use the settings in the subtitle file, if the subtitle file is not defined, use the default. 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                                         |
  --------------------------------------------------------------------------------------------

The margin along the subtitle text direction has different meanings according to different writing directions. 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 the height of the video (5%) If startMargin is set, paramFlags must be set to TXPlayerSubtitleRenderParamFlagStartMargin

◆ verticalMargin

- (float) verticalMargin
readwritenonatomicassign

The margin of the vertical subtitle text direction has different meanings according to different writing directions. 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 the vertical and right-to-left writing direction, 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 the vertical and left-to-right writing direction, yMargin indicates the distance from the left side of the subtitle to the left side of the video screen. For example, if yMargin=0.05, the margin is 0.05 times (5%) of the video width. If verticalMargin is set, paramFlags must be set to TXPlayerSubtitleRenderParamFlagVerticalMargin.