Constructor
new Cue(startTime, endTime, payload)
Parameters:
Name | Type | Description |
---|---|---|
startTime |
number | |
endTime |
number | |
payload |
string |
- 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 |
white | string | |
bg_lime |
lime | string | |
bg_cyan |
cyan | string | |
bg_red |
red | string | |
bg_yellow |
yellow | string | |
bg_magenta |
magenta | string | |
bg_blue |
blue | string | |
bg_black |
black | 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 |
white | string | |
lime |
lime | string | |
cyan |
cyan | string | |
red |
red | string | |
yellow |
yellow | string | |
magenta |
magenta | string | |
blue |
blue | string | |
black |
black | 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:
timeFormat_
- 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
- Source:
backgroundImage :string
The URL of the background image, e.g. "data:[mime type];base64,[data]".
Type:
- string
- Source:
border :string
The border around this cue as a CSS border.
Type:
- string
- Source:
cellResolution :{columns: number, rows: number}
The number of horizontal and vertical cells into which the Root Container
Region area is divided.
Type:
- {columns: number, rows: number}
- Source:
color :string
Text color as a CSS color, e.g. "#FFFFFF" or "white".
Type:
- string
- Source:
displayAlign :shaka.text.Cue.displayAlign
Vertical alignments of the cues within their extents.
'BEFORE' means displaying the captions at the top of the text display
container box, 'CENTER' means in the middle, 'AFTER' means at the bottom.
Type:
- Source:
endTime :number
The end time of the cue in seconds, relative to the start of the
presentation.
Type:
- number
- Source:
fontSize :string
Text font size in px or em (e.g. '100px'/'100em').
Type:
- string
- 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
- Source:
letterSpacing :string
Text letter spacing as a CSS letter-spacing value.
Type:
- string
- Source:
line :number
The offset from the display box in either number of lines or
percentage depending on the value of lineInterpretation.
Type:
- number
- Source:
lineAlign :shaka.text.Cue.lineAlign
Line alignment of the cue box.
Start alignment means the cue box’s top side (for horizontal cues), left
side (for vertical growing right), or right side (for vertical growing
left) is aligned at the line.
Center alignment means the cue box is centered at the line.
End alignment The cue box’s bottom side (for horizontal cues), right side
(for vertical growing right), or left side (for vertical growing left) is
aligned at the line.
Type:
- 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
- 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
- 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:
- Source:
linePadding :string
Text line padding as a CSS line-padding value.
Type:
- string
- Source:
nestedCues :Array.<!shaka.text.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:
- Array.<!shaka.text.Cue>
- Source:
opacity :number
Opacity of the cue element, from 0-1.
Type:
- number
- 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
- Source:
position :number
The indent (in percent) of the cue box in the direction defined by the
writing direction.
Type:
- number
- Source:
region :shaka.text.CueRegion
The region to render the cue into. Only supported on top-level cues,
because nested cues are inline elements.
Type:
- Source:
rubyTag :string
Used to indicate the type of ruby tag that should be used when rendering
the cue. Valid values: ruby, rp, rt.
Type:
- string
- Source:
size :number
Size of the cue box (in percents), where 0 means "auto".
Type:
- number
- Source:
startTime :number
The start time of the cue in seconds, relative to the start of the
presentation.
Type:
- number
- Source:
textCombineUpright :string
Text combine upright as a CSS text-combine-upright value.
Type:
- string
- Source:
textDecoration :Array.<!shaka.text.Cue.textDecoration>
Text decoration. A combination of underline, overline
and line through. Empty array means no decoration.
Type:
- Array.<!shaka.text.Cue.textDecoration>
- Source:
textShadow :string
Text shadow color as a CSS text-shadow value.
Type:
- string
- Source:
textStrokeColor :string
Text stroke color as a CSS color, e.g. "#FFFFFF" or "white".
Type:
- string
- Source:
textStrokeWidth :string
Text stroke width as a CSS stroke-width value.
Type:
- string
- Source:
wrapLine :boolean
Whether or not line wrapping should be applied to the cue.
Type:
- boolean
- Source:
Methods
addDefaultTextColor(stylesnon-null)
Add default color
Parameters:
Name | Type | Description |
---|---|---|
styles |
Map.<string, !shaka.text.Cue> |
- Source:
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
escapeInvalidChevrons_(inputnon-null) → {string}
This method converts invalid > chevrons to HTML entities.
It also removes < chevrons as per spec.
Parameters:
Name | Type | Description |
---|---|---|
input |
string |
- Source:
Returns:
- Type
- string
generateCueFromElement_(elementnon-null, rootCuenon-null, stylesnon-null)
Parameters:
Name | Type | Description |
---|---|---|
element |
shaka.extern.xml.Node | |
rootCue |
shaka.text.Cue | |
styles |
Map.<string, !shaka.text.Cue> |
- Source:
getOrDefault_(value, defaultValue)
Parameters:
Name | Type | Description |
---|---|---|
value |
string | |
defaultValue |
string |
- Source:
lineBreak(start, end) → {shaka.text.Cue}
Parameters:
Name | Type | Description |
---|---|---|
start |
number | |
end |
number |
- Source:
Returns:
- Type
- shaka.text.Cue
mergeStyle_(cuenon-null, refCue)
Merges values created in parseStyle_
Parameters:
Name | Type | Description |
---|---|---|
cue |
shaka.text.Cue | |
refCue |
shaka.text.Cue |
- Source:
parseCuePayload(cuenon-null, stylesopt, non-null)
Parses cue payload, searches for styling entities and, if needed,
modifies original payload and creates nested cues to better represent
styling found in payload. All changes are done in-place.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cue |
shaka.text.Cue | ||
styles |
Map.<string, !shaka.text.Cue> |
<optional> |
- Source:
replaceKaraokeStylePayload_(payload) → {string}
Converts karaoke style tag to be valid for xml parsing
For example,
input: Text <00:00:00.450> time <00:00:01.450> 1
output: Text
time
1
Parameters:
Name | Type | Description |
---|---|---|
payload |
string |
- Source:
Returns:
processed payload
- Type
- string
replaceVoiceStylePayload_(payload) → {string}
Converts voice style tag to be valid for xml parsing
For example,
input: Test
output: Test
Parameters:
Name | Type | Description |
---|---|---|
payload |
string |
- Source:
Returns:
processed payload
- Type
- string
clone() → {shaka.text.Cue}
Create a copy of the cue with the same properties.
- Source:
Returns:
- Type
- shaka.text.Cue