Package com.brightcove.player.captioning
Class TTMLParser
java.lang.Object
com.brightcove.player.captioning.TTMLParser
Implementation of a parser which understands much of the DFXP TTML specification (though not all). Specifically,
these items are recognized:
- Region element definitions
- Style element definitions
- Basic body structure with with P tags wrapped in top-level divs which contain spans, br's and unspanned text
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAll XML attributes recognized in a TTML document.static classNamespaces specified by TTML specification.static classAll tags recognized in a TTML document. -
Method Summary
Modifier and TypeMethodDescriptionstatic intparseTimeValue(String value) Deprecated.static longparseTimeValueLong(String value) Parses a string representing a time code position within a video following the format: HH:MM:ss.mmm or HH:MM:ss:mm Where the following values are expected: HH - a 2 digit hours value, zero padded MM - a 2 digit minutes value, zero padded ss - a 2 digit seconds value, zero padded mmm - a 2 or 3 digit milliseconds value, zero padded The parsed value is converted to an integer representing the total number of milliseconds represented by this time code expression, relative to the start of a video timeline.static TTMLDocumentparseXml(InputStream inputStream, String encoding) Parses the givenInputStreamusing the specified encoding.static TTMLDocumentParses the givenReaderinto aTTMLDocument.
-
Method Details
-
parseXml
public static TTMLDocument parseXml(InputStream inputStream, String encoding) throws org.xmlpull.v1.XmlPullParserException, IOException Parses the givenInputStreamusing the specified encoding.- Parameters:
inputStream- the stream containing the content to parseencoding- the character encoding- Returns:
- a parsed
TTMLDocument - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOException
-
parseXml
public static TTMLDocument parseXml(Reader reader) throws org.xmlpull.v1.XmlPullParserException, IOException Parses the givenReaderinto aTTMLDocument.- Parameters:
reader- the reader containing the content to parse- Returns:
- a parsed
TTMLDocument - Throws:
org.xmlpull.v1.XmlPullParserExceptionIOException
-
parseTimeValue
Deprecated.Parses a string representing a time code position within a video following the format: HH:MM:ss.mmm or HH:MM:ss:mm Where the following values are expected:- HH - a 2 digit hours value, zero padded
- MM - a 2 digit minutes value, zero padded
- ss - a 2 digit seconds value, zero padded
- mmm - a 2 or 3 digit milliseconds value, zero padded
- Parameters:
value- the time code expression to be parsed- Returns:
- the value, in milliseconds, parsed by the given input expression
-
parseTimeValueLong
Parses a string representing a time code position within a video following the format: HH:MM:ss.mmm or HH:MM:ss:mm Where the following values are expected:- HH - a 2 digit hours value, zero padded
- MM - a 2 digit minutes value, zero padded
- ss - a 2 digit seconds value, zero padded
- mmm - a 2 or 3 digit milliseconds value, zero padded
- Parameters:
value- the time code expression to be parsed- Returns:
- the value, in milliseconds, parsed by the given input expression
-