Constructor
new UITextDisplayer(video, videoContainer, config)
Constructor.
Parameters:
Name | Type | Description |
---|---|---|
video |
HTMLMediaElement | |
videoContainer |
HTMLElement | |
config |
shaka.extern.TextDisplayerConfiguration |
- Implements:
- Source:
Members
currentCuesMap_ :Map.<!shaka.text.Cue, !{cueElement: !HTMLElement, regionElement: HTMLElement, wrapper: !HTMLElement}>
Maps cues to cue elements. Specifically points out the wrapper element of
the cue (e.g. the HTML element to put nested cues inside).
Type:
- Map.<!shaka.text.Cue, !{cueElement: !HTMLElement, regionElement: HTMLElement, wrapper: !HTMLElement}>
- Source:
regionElements_ :Map.<string, !HTMLElement>
Type:
- Map.<string, !HTMLElement>
- Source:
resizeObserver_ :ResizeObserver
Type:
- ResizeObserver
- Source:
Methods
convertLengthValue_(lengthValue, cuenon-null, videoContainer) → {string}
Converts length value to an absolute value in pixels.
If lengthValue is already an absolute value it will not
be modified. Relative lengthValue will be converted to an
absolute value in pixels based on Computed Cell Size
Parameters:
Name | Type | Description |
---|---|---|
lengthValue |
string | |
cue |
shaka.text.Cue | |
videoContainer |
HTMLElement |
- Source:
Returns:
- Type
- string
getAbsoluteLengthInPixels_(value, cuenon-null, videoContainer) → {string}
Returns computed absolute length value in pixels based on cell
and a video container size
Parameters:
Name | Type | Description |
---|---|---|
value |
number | |
cue |
shaka.text.Cue | |
videoContainer |
HTMLElement |
- Source:
Returns:
- Type
- string
getLengthValueInfo_(lengthValuenullable) → {?{ value: number, unit: string }}
Returns info about provided lengthValue
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
lengthValue |
string |
<nullable> |
- Source:
Returns:
- Type
- ?{ value: number, unit: string }
Example
100px => { value: 100, unit: 'px' }
inheritProperty_(parentsnon-null, cb) → {T}
Inherits a property from the parent Cue elements. If the value is falsy,
it is assumed to be inherited from the parent. This returns null if the
value isn't found.
Parameters:
Name | Type | Description |
---|---|---|
parents |
Array.<!shaka.text.Cue> | |
cb |
function(!shaka.text.Cue):?T |
- Source:
Returns:
- Type
- T
append(cuesnon-null)
Append given text cues to the list of cues to be displayed.
Parameters:
Name | Type | Description |
---|---|---|
cues |
Array.<!shaka.text.Cue> | Text cues to be appended. |
- Implements:
- Source:
computeCuePositionAlignment_(cuenon-null)
Compute cue position alignment
See https://www.w3.org/TR/webvtt1/#webvtt-cue-position-alignment
Parameters:
Name | Type | Description |
---|---|---|
cue |
shaka.text.Cue |
- Source:
configure(config)
Sets the TextDisplayer configuration.
Parameters:
Name | Type | Description |
---|---|---|
config |
shaka.extern.TextDisplayerConfiguration |
- Implements:
- Source:
createCue_(cuenon-null, parentsnon-null)
Creates the object for a cue.
Parameters:
Name | Type | Description |
---|---|---|
cue |
shaka.text.Cue | |
parents |
Array.<!shaka.text.Cue> |
- Source:
generateRegionId_(region)
Compute a unique internal id:
Regions can reuse the id but have different dimensions, we need to
consider those differences
Parameters:
Name | Type | Description |
---|---|---|
region |
shaka.text.CueRegion |
- Source:
getRegionElement_(cuenon-null) → {HTMLElement}
Get or create a region element corresponding to the cue region. These are
cached by ID.
Parameters:
Name | Type | Description |
---|---|---|
cue |
shaka.text.Cue |
- Source:
Returns:
- Type
- HTMLElement
isElementUnderTextContainer_()
- Source:
isTextVisible() → {boolean}
Returns true if text is currently visible.
- Implements:
- Source:
Returns:
- Type
- boolean
remove(startTime, endTime) → {boolean}
Remove all cues that are fully contained by the given time range (relative
to the presentation).
endTime
will be greater to equal to
startTime
. remove
should only return
false
if the displayer has been destroyed. If the displayer
has not been destroyed remove
should return true
.
Parameters:
Name | Type | Description |
---|---|---|
startTime |
number | |
endTime |
number |
- Implements:
- Source:
Returns:
- Type
- boolean
setCaptionStyles_(cueElementnon-null, cuenon-null, parentsnon-null, hasWrapper)
Parameters:
Name | Type | Description |
---|---|---|
cueElement |
HTMLElement | |
cue |
shaka.text.Cue | |
parents |
Array.<!shaka.text.Cue> | |
hasWrapper |
boolean |
- Source:
setTextVisibility(on)
Set text visibility.
Parameters:
Name | Type | Description |
---|---|---|
on |
boolean |
- Implements:
- Source:
updateCaptions_(forceUpdateopt)
Display the current captions.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
forceUpdate |
boolean |
<optional> |
false |
- Source:
updateCuesRecursive_(cuesnon-null, containernon-null, currentTime, parentsnon-null)
Parameters:
Name | Type | Description |
---|---|---|
cues |
Array.<!shaka.text.Cue> | |
container |
HTMLElement | |
currentTime |
number | |
parents |
Array.<!shaka.text.Cue> |
- Source: