Class: shaka.text.Cue

Constructor

new Cue(startTime, endTime, payload)

Parameters:
Name Type Description
startTime number
endTime number
payload string
Implements:
Source:

Members

defaultTextBackgroundColor :string

Default text background color according to https://w3c.github.io/webvtt/#default-text-background
Type:
  • string
Properties:
Name Value Type Description
bg_white #FFF string
bg_lime #0F0 string
bg_cyan #0FF string
bg_red #F00 string
bg_yellow #FF0 string
bg_magenta #F0F string
bg_blue #00F string
bg_black #000 string
Source:

defaultTextColor :string

Default text color according to https://w3c.github.io/webvtt/#default-text-color
Type:
  • string
Properties:
Name Value Type Description
white #FFF string
lime #0F0 string
cyan #0FF string
red #F00 string
yellow #FF0 string
magenta #F0F string
blue #00F string
black #000 string
Source:

direction :string

Type:
  • string
Properties:
Name Value Type Description
HORIZONTAL_LEFT_TO_RIGHT ltr string
HORIZONTAL_RIGHT_TO_LEFT rtl string
Source:

displayAlign :string

Vertical alignments of the cues within their extents. 'BEFORE' means displaying at the top of the captions container box, 'CENTER' means in the middle, 'AFTER' means at the bottom.
Type:
  • string
Properties:
Name Value Type Description
BEFORE before string
CENTER center string
AFTER after string
Source:

fontStyle :string

Type:
  • string
Properties:
Name Value Type Description
NORMAL normal string
ITALIC italic string
OBLIQUE oblique string
Source:

fontWeight :number

In CSS font weight can be a number, where 400 is normal and 700 is bold. Use these values for the enum for consistency.
Type:
  • number
Properties:
Name Value Type Description
NORMAL 400 number
BOLD 700 number
Source:

lineAlign :string

Type:
  • string
Properties:
Name Value Type Description
CENTER center string
START start string
END end string
Source:

lineInterpretation :number

Type:
  • number
Properties:
Name Value Type Description
LINE_NUMBER 0 number
PERCENTAGE 1 number
Source:

positionAlign :string

Type:
  • string
Properties:
Name Value Type Description
LEFT line-left string
RIGHT line-right string
CENTER center string
AUTO auto string
Source:

textAlign :string

Type:
  • string
Properties:
Name Value Type Description
LEFT left string
RIGHT right string
CENTER center string
START start string
END end string
Source:

textDecoration :string

Type:
  • string
Properties:
Name Value Type Description
UNDERLINE underline string
LINE_THROUGH lineThrough string
OVERLINE overline string
Source:

writingMode :string

Type:
  • string
Properties:
Name Value Type Description
HORIZONTAL_TOP_TO_BOTTOM horizontal-tb string
VERTICAL_LEFT_TO_RIGHT vertical-lr string
VERTICAL_RIGHT_TO_LEFT vertical-rl string
Source:

backgroundColor :string

Text background color as a CSS color, e.g. "#FFFFFF" or "white".
Type:
  • string
Implements:
Source:

backgroundImage :string

The URL of the background image, e.g. "data:[mime type];base64,[data]".
Type:
  • string
Implements:
Source:

border :string

The border around this cue as a CSS border.
Type:
  • string
Implements:
Source:

cellResolution :Object

The number of horizontal and vertical cells into which the Root Container Region area is divided.
Type:
  • Object
Implements:
Source:

color :string

Text color as a CSS color, e.g. "#FFFFFF" or "white".
Type:
  • string
Implements:
Source:

direction :shaka.text.Cue.direction

Text direction of the cue.
Type:
Implements:
Source:

displayAlign :shaka.text.Cue.displayAlign

Set the captions at the bottom of the text container by default.
Type:
Implements:
Source:

endTime :number

The end time of the cue in seconds, relative to the start of the presentation.
Type:
  • number
Implements:
Source:

fontFamily :string

Text font family.
Type:
  • string
Implements:
Source:

fontSize :string

Text font size in px or em (e.g. '100px'/'100em').
Type:
  • string
Implements:
Source:

fontStyle :shaka.text.Cue.fontStyle

Text font style. Normal, italic or oblique.
Type:
Implements:
Source:

fontWeight :shaka.text.Cue.fontWeight

Text font weight. Either normal or bold.
Type:
Implements:
Source:

id :string

Id of the cue.
Type:
  • string
Implements:
Source:

isContainer :boolean

If true, this represents a container element that is "above" the main cues. For example, the and
tags that contain the

tags in a TTML file. This controls the flow of the final cues; any nested cues within an "isContainer" cue will be laid out as separate lines.

Type:
  • boolean
Implements:
Source:

letterSpacing :string

Text letter spacing as a CSS letter-spacing value.
Type:
  • string
Implements:
Source:

line :number

The offset from the display box in either number of lines or percentage depending on the value of lineInterpretation.
Type:
  • number
Implements:
Source:

lineAlign :shaka.text.Cue.lineAlign

Line Alignment is set to start by default.
Type:
Implements:
Source:

lineBreak :boolean

Whether or not the cue only acts as a line break between two nested cues. Should only appear in nested cues.
Type:
  • boolean
Implements:
Source:

lineHeight :string

Separation between line areas inside the cue box in px or em (e.g. '100px'/'100em'). If not specified, this should be no less than the largest font size applied to the text in the cue.
Type:
  • string
Implements:
Source:

lineInterpretation :shaka.text.Cue.lineInterpretation

The way to interpret line field. (Either as an integer line number or percentage from the display box).
Type:
Implements:
Source:

linePadding :string

Text line padding as a CSS line-padding value.
Type:
  • string
Implements:
Source:

nestedCues :Array.<!shaka.extern.Cue>

Nested cues, which should be laid out horizontally in one block. Top-level cues are blocks, and nested cues are inline elements. Cues can be nested arbitrarily deeply.
Type:
Implements:
Source:

opacity :number

Opacity of the cue element, from 0-1.
Type:
  • number
Implements:
Source:

payload :string

The text payload of the cue. If nestedCues is non-empty, this should be empty. Top-level block containers should have no payload of their own.
Type:
  • string
Implements:
Source:

position :number

The indent (in percent) of the cue box in the direction defined by the writing direction.
Type:
  • number
Implements:
Source:

positionAlign :shaka.text.Cue.positionAlign

Position alignment of the cue.
Type:
Implements:
Source:

region :shaka.extern.CueRegion

The region to render the cue into. Only supported on top-level cues, because nested cues are inline elements.
Type:
Implements:
Source:

size :number

Size of the cue box (in percents), where 0 means "auto".
Type:
  • number
Implements:
Source:

startTime :number

The start time of the cue in seconds, relative to the start of the presentation.
Type:
  • number
Implements:
Source:

textAlign :shaka.text.Cue.textAlign

Alignment of the text inside the cue box.
Type:
Implements:
Source:

textDecoration :Array.<!shaka.text.Cue.textDecoration>

Text decoration. A combination of underline, overline and line through. Empty array means no decoration.
Type:
Implements:
Source:

textStrokeColor :string

Text stroke color as a CSS color, e.g. "#FFFFFF" or "white".
Type:
  • string
Implements:
Source:

textStrokeWidth :string

Text stroke width as a CSS stroke-width value.
Type:
  • string
Implements:
Source:

wrapLine :boolean

Whether or not line wrapping should be applied to the cue.
Type:
  • boolean
Implements:
Source:

writingMode :shaka.text.Cue.writingMode

Text writing mode of the cue.
Type:
Implements:
Source:

Methods

equal(cue1non-null, cue2non-null) → {boolean}

Check if two Cues have all the same values in all properties.
Parameters:
Name Type Description
cue1 shaka.text.Cue
cue2 shaka.text.Cue
Source:
Returns:
Type
boolean

lineBreak(start, end) → {shaka.text.Cue}

Parameters:
Name Type Description
start number
end number
Source:
Returns:
Type
shaka.text.Cue

clone() → {shaka.text.Cue}

Create a copy of the cue with the same properties.
Source:
Returns:
Type
shaka.text.Cue