Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.
This document defines a Level 2 API for exposing parsed and formatted Timed Text Markup Language (TTML) content to Web Applications.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document is an editor's draft that has no official standing.
This document was published by the Timed Text Working Group as an Editor's Draft. If you wish to make comments regarding this document, please send them to public-tt@w3.org (subscribe, archives). All comments are welcome.
Publication as an Editor's Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This section is non-normative.
This document defines a Level 2 API for exposing parsed and formatted Timed Text Markup Language (TTML) content to Web Applications. The parsed form of TTML is exposed as a DOM representation of a TTML intermediate synchronic document. The formatted form of TTML is exposed as an HTML document fragment that encodes a renderable representation of the parsed form.
This section is non-normative.
This section describes common use cases for the TTML API Level 2.
When a text track is in the showing mode and the text track's list of cues includes an instance of TTMLCue
,
then a user agent attempts to render the cue using the HTML document fragment associated with the cue.
When a text track is not in the showing mode and the text track's list of cues includes an instance of TTMLCue
,
then a Web Application may render the cue, for example, by making direct use of the cue's parsed form or by using the cue's formatted HTML form.
When a text track is not in the showing mode and the text track's list of cues includes an instance of TTMLCue
,
then a Web Application may access parsed TTML metadata contained in the TTML DOM representation exposed by the cue.
This specification relies upon the certain concepts and APIs defined in other specifications as follows:
Document
,
DocumentFragment
, and
Element
, and
and the exception
SyntaxError
.
[DOM4]TextTrack
and
TextTrackCue
.
[HTML5]RawTTMLCue
.
[TTML1API]As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL in this specification are to be interpreted as described in [RFC2119].
An HTML user agent that claims to support the rendering of any profile of [TTML1] or claims to support any profile of [TTML2], or any subsequent version thereof, MUST implement support for the TTML Level 2 API defined herein, and, if it renders TTML content in any fashion or exposes TTML content to Web Applications in any fashion, then it also MUST render or expose that content to Web Applications using this API.
[Constructor(double startTime, double endTime, Document? content)]
interface TTMLCue : RawTTMLCue {
attribute boolean deferUpdates;
[SameObject]
readonly attribute Document ttml;
DocumentFragment getCueAsHTML ();
};
deferUpdates
of type boolean, Access deferred update flag of cue.
Upon read, return true
if rendering updates are being deferred; otherwise, return false
.
Upon write, perform the following ordered steps:
false
and the new value is true
, then set the current value to true
and
begin deferring rendering updates;true
and the new value is false
, then set the current value to false
and
asynchronously perform a rendering update.ttml
of type Document, readonly getCueAsHTML
DocumentFragment
TTMLCue
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
startTime | double |
✘ | ✘ |
A TTML media time relative cue starting time, as further defined by
startTime [HTML5].
|
endTime | double |
✘ | ✘ |
A TTML media time relative cue ending time, as further defined by
endTime [HTML5].
|
content | Document |
✔ | ✘ |
A Document representing a TTML intermediate synchronic document.
|
If the startTime
argument is less than zero, then throw a SyntaxError
exception.
If the endTime
argument is less than zero, then throw a SyntaxError
exception.
If the endTime
argument is less than startTime
, then set the cue's end time to startTime
.
If the content
argument is null
, then the constructed cue object represents
a cue with no content. Otherwise, if any of the following constraints are not true, then
throw a SyntaxError
exception:
content.contentType
is either "application/ttml+xml
" or "application/xml
".content.documentElement
is not null
.
content.documentElement.namespaceURI
is "http://www.w3.org/ns/ttml
".
content.documentElement.localName
is "tt
".
Otherwise, set the cue's content to a structured clone of content
.