A TextEngine plugin that parses TTML files.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
ArrayBuffer | ||
segmentStartTime |
number |
<nullable> |
|
segmentEndTime |
number |
<nullable> |
- Source:
Throws:
Returns:
- Type
- Array.<!TextTrackCue>
Classes
Members
-
(private, static, constant, non-null) percentValues_ :RegExp
-
Type:
- RegExp
- Source:
Example
50% 10%
-
(private, static, constant, non-null) timeColonFormat_ :RegExp
-
Type:
- RegExp
- Source:
Example
00:00:40 or 00:40
-
(private, static, constant, non-null) timeColonFormatFrames_ :RegExp
-
Type:
- RegExp
- Source:
Example
00:00:40:07 (7 frames) or 00:00:40:07.1 (7 frames, 1 subframe)
-
(private, static, constant, non-null) timeColonFormatMilliseconds_ :RegExp
-
example 01:02:43.0345555 or 02:43.03
Type:
- RegExp
- Source:
-
(private, static, constant, non-null) timeFramesFormat_ :RegExp
-
Type:
- RegExp
- Source:
Example
75f or 75.5f
-
(private, static, constant, non-null) timeHMSFormat_ :RegExp
-
Type:
- RegExp
- Source:
Example
3.45h, 3m or 4.20s
-
(private, static, constant, non-null) timeTickFormat_ :RegExp
-
Type:
- RegExp
- Source:
Example
50t or 50.5t
Methods
-
(private, static) addStyle_(cuenon-null, region, styles)
-
Adds applicable style properties to a cue
Parameters:
Name Type Description cue
VTTCue region
Element styles
Array.<Element> - Source:
-
(private, static) getElementFromCollection_(node, attributeName, collection) → {Element}
-
Selects an element from |collection| whose id matches |attributeName| from |node|.
Parameters:
Name Type Description node
Node attributeName
string collection
Array.<Element> - Source:
Returns:
region- Type
- Element
-
(private, static) getInheritedAttribute_(elementnullable, attributeName) → (nullable) {string}
-
Traverses upwards from a given node until a given attribute is found
Parameters:
Name Type Attributes Description element
Node <nullable>
attributeName
string - Source:
Returns:
region- Type
- string
-
(private, static) getLeafNodes_(element) → (non-null) {Array.<Node>}
-
Gets leaf nodes of the xml node tree. Ignores the text, br elements and the spans positioned inside paragraphs
Parameters:
Name Type Description element
Node - Source:
Returns:
- Type
- Array.<Node>
-
(private, static) getStyleAttribute_(region, styles, attribute) → (nullable) {string}
-
Finds a specified attribute in ttml and returns its value if the attribute was found.
Parameters:
Name Type Description region
Element styles
Array.<Element> attribute
string - Source:
Returns:
- Type
- string
-
(private, static) parseColonTimeWithFrames_(rateInfonon-null, text) → (nullable) {number}
-
Parses a TTML colon formatted time containing frames
Parameters:
Name Type Description rateInfo
shaka.media.TtmlTextParser.RateInfo_ text
string - Source:
Returns:
- Type
- number
-
(private, static) parseCue_(element, rateInfonon-null, styles, regions) → {TextTrackCue}
-
Parses an xml Element node into a Cue Element.
Parameters:
Name Type Description element
Node | Element rateInfo
shaka.media.TtmlTextParser.RateInfo_ styles
Array.<Element> regions
Array.<Element> - Source:
Returns:
ret- Type
- TextTrackCue
-
(private, static) parseFramesTime_(rateInfonon-null, text) → (nullable) {number}
-
Parses a TTML time in frame format
Parameters:
Name Type Description rateInfo
shaka.media.TtmlTextParser.RateInfo_ text
string - Source:
Returns:
- Type
- number
-
(private, static) parseTickTime_(rateInfonon-null, text) → (nullable) {number}
-
Parses a TTML time in tick format
Parameters:
Name Type Description rateInfo
shaka.media.TtmlTextParser.RateInfo_ text
string - Source:
Returns:
- Type
- number
-
(private, static) parseTime_(text, rateInfonon-null) → (nullable) {number}
-
Parses a TTML time from the given word.
Parameters:
Name Type Description text
string rateInfo
shaka.media.TtmlTextParser.RateInfo_ - Source:
Returns:
ret- Type
- number
-
(private, static) parseTimeFromRegex_(regexnon-null, text) → (nullable) {number}
-
Parses a TTML time with a given regex. Expects regex to be some sort of a time-matcher to match hours, minutes, seconds and milliseconds
Parameters:
Name Type Description regex
RegExp text
string - Source:
Returns:
- Type
- number