Abstract

This document defines a Level 2 API for exposing parsed and formatted Timed Text Markup Language (TTML) content to Web Applications.

Status of This Document

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.

Table of Contents

1. Introduction

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.

2. Use Cases

This section is non-normative.

This section describes common use cases for the TTML API Level 2.

2.1 User Agent Rendering of Parsed TTML Content

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.

2.2 Web Application Rendering of Parsed TTML Content

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.

2.3 Web Application Use of Parsed TTML Content Metadata

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.

3. Definitions

3.1 Terminology

[TBS]
To Be Supplied.

3.2 External Definitions

This specification relies upon the certain concepts and APIs defined in other specifications as follows:

DOM
The concepts throw, and XML document, the interfaces Document, DocumentFragment, and Element, and and the exception SyntaxError. [DOM4]
HTML
The concepts interactive browsers, media-resource-specific text track, non-interactive browsers, and structured clone, showing mode, text track, text track's list of cues, and user agent, and the interfaces TextTrack and TextTrackCue. [HTML5]
TTML
The concepts TTML content, TTML intermediate synchronic document, and TTML media time. [TTML1]
TTML API Level 1
The interface RawTTMLCue. [TTML1API]
WebIDL
The generic semantics that apply to IDL specifications. [WEBIDL]

4. Conformance

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.

5. Dependencies

6. API Definitions

6.1 TTMLCue Interface

[Constructor(double startTime, double endTime, Document? content)]
interface TTMLCue : RawTTMLCue {
                attribute boolean  deferUpdates;
    [SameObject]
    readonly    attribute Document ttml;
    DocumentFragment getCueAsHTML ();
};

6.1.1 Attributes

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:

  1. if the current value is the same as the new value, then return;
  2. if the current value is false and the new value is true, then set the current value to true and begin deferring rendering updates;
  3. if the current value is 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
Obtain a reference to a live copy of an XML document that represents the current content of the cue.

6.1.2 Methods

getCueAsHTML
Obtain a reference to a (non-live) structured clone of the HTML rendition that represents the content of the cue at the time of the immediately preceding completed rendering update.
No parameters.
Return type: DocumentFragment

6.1.3 Constructors

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:

  • The value of content.contentType is either "application/ttml+xml" or "application/xml".
  • The value of content.documentElement is not null.
  • The value of content.documentElement.namespaceURI is "http://www.w3.org/ns/ttml".
  • The value of content.documentElement.localName is "tt".

Otherwise, set the cue's content to a structured clone of content.

A. References

A.1 Normative references

[DOM4]
A. van Kesteren et al., Eds. W3C DOM4, W3C Working Draft, URL: http://www.w3.org/TR/2013/WD-dom-20131107/
[HTML5]
R. Berjon et al., Eds. HTML 5.1 Nightly, W3C Editor's Draft, URL: http://www.w3.org/html/wg/drafts/html/master/Overview.html
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Internet RFC 2119. URL: http://www.ietf.org/rfc/rfc2119.txt
[TTML1]
G. Adams et al., Eds. Timed Text Markup Language 1 (TTML1) (Second Edition), W3C Recommendation, URL: http://www.w3.org/TR/2013/REC-ttml1-20130924/
[TTML1API]
G. Adams et al., Eds. TTML API Level 1, W3C Editor's Draft, URL: http://dvcs.w3.org/hg/ttml/raw-file/default/ttml1-api/Overview.html
[TTML2]
G. Adams et al., Eds. Timed Text Markup Language 2 (TTML2), W3C Editor's Draft, URL: http://dvcs.w3.org/hg/ttml/raw-file/default/ttml2/spec/ttml2.html
[WEBIDL]
C. McCormack et al., Eds. HTML 5.1 Nightly, W3C Editor's Draft, URL: http://dev.w3.org/2006/webapi/WebIDL/