Skip to content
Permalink
Browse files

[giow] (0) Captions - Stage 6: ground work for loading tracks dynamic…

…ally.

git-svn-id: http://svn.whatwg.org/webapps@5076 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed May 5, 2010
1 parent 9ea8a7f commit 2b105f95a5594b823257ca17e82eca1413738138
Showing with 496 additions and 278 deletions.
  1. +174 −106 complete.html
  2. +174 −106 index
  3. +148 −66 source
<li><a href=#timed-tracks><span class=secno>4.8.10.10 </span>Timed tracks</a>
<ol>
<li><a href=#timed-track-model><span class=secno>4.8.10.10.1 </span>Timed track model</a></li>
<li><a href=#timed-track-processing-model><span class=secno>4.8.10.10.2 </span>Timed track processing model</a></li>
<li><a href=#sourcing-in-band-timed-tracks><span class=secno>4.8.10.10.3 </span>Sourcing in-band timed tracks</a></li>
<li><a href=#sourcing-websrt-timed-tracks><span class=secno>4.8.10.10.4 </span>Sourcing WebSRT timed tracks</a></li>
<li><a href=#timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</a></li>
<li><a href=#cue-events><span class=secno>4.8.10.10.6 </span>Event definitions</a></ol></li>
<li><a href=#sourcing-in-band-timed-tracks><span class=secno>4.8.10.10.2 </span>Sourcing in-band timed tracks</a></li>
<li><a href=#sourcing-websrt-timed-tracks><span class=secno>4.8.10.10.3 </span>Sourcing WebSRT timed tracks</a></li>
<li><a href=#timed-track-api><span class=secno>4.8.10.10.4 </span>Timed track API</a></li>
<li><a href=#cue-events><span class=secno>4.8.10.10.5 </span>Event definitions</a></ol></li>
<li><a href=#websrt><span class=secno>4.8.10.11 </span>WebSRT</a>
<ol>
<li><a href=#syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</a></li>
// timed tracks
readonly attribute <a href=#mediatrack>MediaTrack</a>[] <span title=dom-media-tracks>tracks</span>;
<a href=#mutablemediatrack>MutableMediaTrack</a> <span title=dom-media-addTrack>addTrack</span>(in DOMString label, in DOMString kind, in DOMString language);
};

interface <dfn id=mediatrack>MediaTrack</dfn> {
readonly attribute DOMString <span title=dom-MediaTrack-kind>kind</span>;
readonly attribute DOMString <span title=dom-MediaTrack-label>label</span>;
readonly attribute DOMString <span title=dom-MediaTrack-language>language</span>;

const unsigned short <span title=dom-MediaTrack-TRACK_OFF>TRACK_OFF</span> = 0;
const unsigned short <span title=dom-MediaTrack-TRACK_HIDDEN>TRACK_HIDDEN</span> = 1;
const unsigned short <span title=dom-MediaTrack-TRACK_SHOWING>TRACK_SHOWING</span> = 2;
readonly attribute unsigned short <span title=dom-MediaTrack-mode>mode</span>;

readonly attribute <a href=#mediacuelist>MediaCueList</a> <span title=dom-MediaTrack-cues>cues</span>;
readonly attribute <a href=#mediacuelist>MediaCueList</a> <span title=dom-MediaTrack-activeCues>activeCues</span>;
readonly attribute <a href=#function>Function</a> <span title=dom-MediaTrack-onentercue>onentercue</span>;
readonly attribute <a href=#function>Function</a> <span title=dom-MediaTrack-onexitcue>onexitcue</span>;
};

interface <dfn id=mutablemediatrack>MutableMediaTrack</dfn> : <a href=#mediatrack>MediaTrack</a> {
void <span title=dom-MutableMediaTrack-addCue>addCue</span>(in <a href=#mediacue>MediaCue</a> cue);
void <span title=dom-MutableMediaTrack-removeCue>removeCue</span>(in <a href=#mediacue>MediaCue</a> cue);
};

interface <dfn id=mediacuelist>MediaCueList</dfn> {
readonly attribute unsigned long <span title=dom-MediaCueList-length>length</span>;
getter <a href=#mediacue>MediaCue</a> (in unsigned long index);
<a href=#mediacue>MediaCue</a> getCueById(in DOMString id);
};

[Constructor(in DOMString id, in float startTime, in float endTime, in DOMString settings, in DOMString text, in optional boolean pauseOnExit)]
interface <dfn id=mediacue>MediaCue</dfn> {
readonly attribute <a href=#mediatrack>MediaTrack</a> <span title=dom-MediaCue-track>track</span>;
readonly attribute DOMString <span title=dom-MediaCue-id>id</span>;

readonly attribute float <span title=dom-MediaCue-startTime>startTime</span>;
readonly attribute float <span title=dom-MediaCue-endTime>endTime</span>;
readonly attribute boolean <span title=dom-MediaCue-pauseOnExit>pauseOnExit</span>;

readonly attribute DOMString <span title=dom-MediaCue-direction>direction</span>;
readonly attribute boolean <span title=dom-MediaCue-snapToLines>snapToLines</span>;
readonly attribute long <span title=dom-MediaCue-linePosition>linePosition</span>;
readonly attribute long <span title=dom-MediaCue-textPosition>textPosition</span>;
readonly attribute long <span title=dom-MediaCue-size>size</span>;
readonly attribute DOMString <span title=dom-MediaCue-alignment>alignment</span>;

readonly attribute DOMString <span title=dom-MediaCue-voice>voice</span>;
DOMString <span title=dom-MediaCue-getCueAsSource()>getCueAsSource</span>();
<a href=#documentfragment>DocumentFragment</a> <span title=dom-MediaCue-getCueAsHTML()>getCueAsHTML</span>();
};</pre>

<p>The <dfn id=media-element-attributes>media element attributes</dfn>, <code title=attr-media-src><a href=#attr-media-src>src</a></code>, <code title=attr-media-preload><a href=#attr-media-preload>preload</a></code>, <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>, <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code>, and <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code>, apply to all <a href=#media-element title="media element">media elements</a>. They are defined in

</dd>

<dt><dfn id=timed-track-readiness-state title="timed track readiness state">A readiness state</dfn>

<dd>

<p>One of the following:</p>

<dl><dt><dfn id=timed-track-not-loaded title="timed track not loaded">Not loaded</dfn>

<dd>

<p>Indicates that the timed track is known to exist (e.g. it has
been declared with a <code><a href=#the-track-element>track</a></code> element), but its cues
have not been obtained.</p>

</dd>

<dt><dfn id=timed-track-loading title="timed track loading">Loading</dfn>

<dd>

<p>Indicates that the timed track is loading and there have been
no fatal errors encountered so far. Further cues might still be
added to the track.</p>

</dd>

<dt><dfn id=timed-track-loaded title="timed track loaded">Loaded</dfn>

<dd>

<p>Indicates that the timed track has been loaded with no fatal
errors. No new cues will be added to the track except if the
<a href=#timed-track>timed track</a> corresponds to a
<code>MutableTimedTrack</code> object.</p>

</dd>

<dt><dfn id=timed-track-failed-to-load title="timed track failed to load">Failed to load</dfn>

<dd>

<p>Indicates that the timed track was enabled, but when the user
agent attempted to obtain it, this failed in some way
(e.g. <a href=#url>URL</a> could not be <a href=#resolve-a-url title="resolve a
url">resolved</a>, network error, unknown timed track
format). Some or all of the cues are likely missing and will not
be obtained.</p>

</dd>

</dl><p>The <a href=#timed-track-readiness-state title="timed track readiness state">readiness
state</a> of a <a href=#timed-track>timed track</a> changes dynamically as
the track is obtained.</p>

</dd>

<dt><dfn id=timed-track-mode title="timed track mode">A mode</dfn>

<dd>

<p>One of the following:</p>

<dl><dt><dfn id=timed-track-disabled title="timed track disabled">Disabled</dfn>

<dd>

<p>Indicates that the timed track is not active. Other than for
the purposes of exposing the track in the DOM, the user agent is
ignoring the timed track. No cues are active, no events are
fired, and the user agent will not attempt to obtain the track's
cues.</p>

</dd>

<dt><dfn id=timed-track-hidden title="timed track hidden">Hidden</dfn>

<dd>

<p>Indicates that the timed track is active, but that the user
agent is not actively displaying the cues. If no attempt has yet
been made to obtain the track's cues, the user will perform such
an attempt momentarily. The user agent is maintaining a list of
which cues are active, and events are being fired
accordingly.</p>

</dd>

<dt><dfn id=timed-track-showing title="timed track showing">Showing</dfn>

<dd>

<p>Indicates that the timed track is active. If no attempt has
yet been made to obtain the track's cues, the user will perform
such an attempt momentarily. The user agent is maintaining a
list of which cues are active, and events are being fired
accordingly. In addition, for timed tracks whose <a href=#timed-track-kind title="timed track kind">kind</a> is <code title=dom-mediatrack-kind-subtitles><a href=#dom-mediatrack-kind-subtitles>subtitles</a></code> or <code title=dom-mediatrack-kind-captions><a href=#dom-mediatrack-kind-captions>captions</a></code>, the cues
are being displayed over the video as appropriate; for timed
tracks whose <a href=#timed-track-kind title="timed track kind">kind</a> is <code title=dom-mediatrack-kind-descriptions><a href=#dom-mediatrack-kind-descriptions>descriptions</a></code>,
the user agent is making the cues available to the user in a
non-visual fashion; and for timed tracks whose <a href=#timed-track-kind title="timed track kind">kind</a> is <code title=dom-mediatrack-kind-chapters><a href=#dom-mediatrack-kind-chapters>chapters</a></code>, the user
agent is making available to the user a mechanism by which the
user can navigate to any point in the <a href=#media-resource>media
resource</a> by selecting a cue.</p>

</dd>

</dl></dd>

<dt><dfn id=timed-track-list-of-cues title="timed track list of cues">A list of zero or more cues</dfn>

<dd>

<p>A list of <a href=#timed-track-cue title="timed track cue">timed track cues</a>.</p>

<p>The <a href=#timed-track-list-of-cues title="timed track list of cues">list of cues of a
timed track</a> can change dynamically, in the case of a
<a href=#timed-track>timed track</a> corresponding to a
<code>MutableTimedTrack</code> object: individual cues can be
added or removed dynamically.</p>
timed track</a> can change dynamically, either because the
<a href=#timed-track>timed track</a> has <a href=#timed-track-not-loaded title="timed track not
loaded">not yet been loaded</a> or is still <a href=#timed-track-loading title="timed
track loading">loading</a>, or in the case of a <a href=#timed-track>timed
track</a> corresponding to a <code>MutableTimedTrack</code>
object, where individual cues can be added or removed
dynamically using the API.</p>

</dd>

HTML.</p>
</dd>

</dl><h6 id=timed-track-processing-model><span class=secno>4.8.10.10.2 </span>Timed track processing model</h6>

<p class=XXX>...fetching timed tracks
</dl><p>A <a href=#timed-track-cue>timed track cue</a> is immutable.</p>


<h6 id=sourcing-in-band-timed-tracks><span class=secno>4.8.10.10.3 </span>Sourcing in-band timed tracks</h6>
<h6 id=sourcing-in-band-timed-tracks><span class=secno>4.8.10.10.2 </span>Sourcing in-band timed tracks</h6>

<p>
<p class=XXX>...


<h6 id=sourcing-websrt-timed-tracks><span class=secno>4.8.10.10.4 </span>Sourcing WebSRT timed tracks</h6>
<h6 id=sourcing-websrt-timed-tracks><span class=secno>4.8.10.10.3 </span>Sourcing WebSRT timed tracks</h6>

<p class=XXX>...
<p class=XXX>...fetching timed tracks


<h6 id=timed-track-api><span class=secno>4.8.10.10.5 </span>Timed track API</h6>
<h6 id=timed-track-api><span class=secno>4.8.10.10.4 </span>Timed track API</h6>

<!--
// timed tracks on HTMLMediaElement:
// timed tracks
readonly attribute <span>MediaTrack</span>[] <span title="dom-media-tracks">tracks</span>;
<span>MutableMediaTrack</span> <span title="dom-media-addTrack">addTrack</span>(in DOMString label, in DOMString kind, in DOMString language);
-->

interface <dfn>MediaTrack</dfn> {
readonly attribute DOMString <span title="dom-MediaTrack-kind">kind</span>;
readonly attribute DOMString <span title="dom-MediaTrack-label">label</span>;
readonly attribute DOMString <span title="dom-MediaTrack-language">language</span>;
<pre class=idl>interface <dfn id=mediatrack>MediaTrack</dfn> {
readonly attribute DOMString <span title=dom-MediaTrack-kind>kind</span>;
readonly attribute DOMString <span title=dom-MediaTrack-label>label</span>;
readonly attribute DOMString <span title=dom-MediaTrack-language>language</span>;

const unsigned short <span title=dom-MediaTrack-NONE>NONE</span> = 0;
const unsigned short <span title=dom-MediaTrack-LOADING>LOADING</span> = 1;
const unsigned short <span title=dom-MediaTrack-LOADED>LOADED</span> = 2;
const unsigned short <span title=dom-MediaTrack-ERROR>ERROR</span> = 3;
readonly attribute unsigned short <span title=dom-MediaTrack-readyState>readyState</span>;
readonly attribute <a href=#function>Function</a> <span title=dom-MediaTrack-onload>onload</span>;
readonly attribute <a href=#function>Function</a> <span title=dom-MediaTrack-onerror>onerror</span>;

const unsigned short <span title="dom-MediaTrack-TRACK_OFF">TRACK_OFF</span> = 0;
const unsigned short <span title="dom-MediaTrack-TRACK_HIDDEN">TRACK_HIDDEN</span> = 1;
const unsigned short <span title="dom-MediaTrack-TRACK_SHOWING">TRACK_SHOWING</span> = 2;
readonly attribute unsigned short <span title="dom-MediaTrack-mode">mode</span>;
const unsigned short <span title=dom-MediaTrack-OFF>OFF</span> = 0;
const unsigned short <span title=dom-MediaTrack-HIDDEN>HIDDEN</span> = 1;
const unsigned short <span title=dom-MediaTrack-SHOWING>SHOWING</span> = 2;
attribute unsigned short <span title=dom-MediaTrack-mode>mode</span>;

readonly attribute <span>MediaCueList</span> <span title="dom-MediaTrack-cues">cues</span>;
readonly attribute <Span>MediaCueList</span> <span title="dom-MediaTrack-activeCues">activeCues</span>;
readonly attribute <span>Function</span> <span title="dom-MediaTrack-onentercue">onentercue</span>;
readonly attribute <span>Function</span> <span title="dom-MediaTrack-onexitcue">onexitcue</span>;
readonly attribute <a href=#mediacuelist>MediaCueList</a> <span title=dom-MediaTrack-cues>cues</span>;
readonly attribute <a href=#mediacuelist>MediaCueList</a> <span title=dom-MediaTrack-activeCues>activeCues</span>;
readonly attribute <a href=#function>Function</a> <span title=dom-MediaTrack-onentercue>onentercue</span>;
readonly attribute <a href=#function>Function</a> <span title=dom-MediaTrack-onexitcue>onexitcue</span>;
};

interface <dfn>MutableMediaTrack</dfn> : <span>MediaTrack</span> {
void <span title="dom-MutableMediaTrack-addCue">addCue</span>(in <span>MediaCue</span> cue);
void <span title="dom-MutableMediaTrack-removeCue">removeCue</span>(in <span>MediaCue</span> cue);
interface <dfn id=mutablemediatrack>MutableMediaTrack</dfn> : <a href=#mediatrack>MediaTrack</a> {
void <span title=dom-MutableMediaTrack-addCue>addCue</span>(in <a href=#mediacue>MediaCue</a> cue);
void <span title=dom-MutableMediaTrack-removeCue>removeCue</span>(in <a href=#mediacue>MediaCue</a> cue);
};

interface <dfn>MediaCueList</dfn> {
readonly attribute unsigned long <span title="dom-MediaCueList-length">length</span>;
getter <span>MediaCue</span> (in unsigned long index);
<span>MediaCue</span> getCueById(in DOMString id);
interface <dfn id=mediacuelist>MediaCueList</dfn> {
readonly attribute unsigned long <span title=dom-MediaCueList-length>length</span>;
getter <a href=#mediacue>MediaCue</a> (in unsigned long index);
<a href=#mediacue>MediaCue</a> getCueById(in DOMString id);
};

[Constructor(in DOMString id, in float startTime, in float endTime, in DOMString settings, in DOMString text, in optional boolean pauseOnExit)]
interface <dfn>MediaCue</dfn> {
readonly attribute <span>MediaTrack</span> <span title="dom-MediaCue-track">track</span>;
readonly attribute DOMString <span title="dom-MediaCue-id">id</span>;

readonly attribute float <span title="dom-MediaCue-startTime">startTime</span>;
readonly attribute float <span title="dom-MediaCue-endTime">endTime</span>;
readonly attribute boolean <span title="dom-MediaCue-pauseOnExit">pauseOnExit</span>;

readonly attribute DOMString <span title="dom-MediaCue-direction">direction</span>;
readonly attribute boolean <span title="dom-MediaCue-snapToLines">snapToLines</span>;
readonly attribute long <span title="dom-MediaCue-linePosition">linePosition</span>;
readonly attribute long <span title="dom-MediaCue-textPosition">textPosition</span>;
readonly attribute long <span title="dom-MediaCue-size">size</span>;
readonly attribute DOMString <span title="dom-MediaCue-alignment">alignment</span>;

readonly attribute DOMString <span title="dom-MediaCue-voice">voice</span>;
DOMString <span title="dom-MediaCue-getCueAsSource()">getCueAsSource</span>();
<span>DocumentFragment</span> <span title="dom-MediaCue-getCueAsHTML()">getCueAsHTML</span>();
};
-->
interface <dfn id=mediacue>MediaCue</dfn> {
readonly attribute <a href=#mediatrack>MediaTrack</a> <span title=dom-MediaCue-track>track</span>;
readonly attribute DOMString <span title=dom-MediaCue-id>id</span>;

readonly attribute float <span title=dom-MediaCue-startTime>startTime</span>;
readonly attribute float <span title=dom-MediaCue-endTime>endTime</span>;
readonly attribute boolean <span title=dom-MediaCue-pauseOnExit>pauseOnExit</span>;

readonly attribute DOMString <span title=dom-MediaCue-direction>direction</span>;
readonly attribute boolean <span title=dom-MediaCue-snapToLines>snapToLines</span>;
readonly attribute long <span title=dom-MediaCue-linePosition>linePosition</span>;
readonly attribute long <span title=dom-MediaCue-textPosition>textPosition</span>;
readonly attribute long <span title=dom-MediaCue-size>size</span>;
readonly attribute DOMString <span title=dom-MediaCue-alignment>alignment</span>;

readonly attribute DOMString <span title=dom-MediaCue-voice>voice</span>;
DOMString <span title=dom-MediaCue-getCueAsSource()>getCueAsSource</span>();
<a href=#documentfragment>DocumentFragment</a> <span title=dom-MediaCue-getCueAsHTML()>getCueAsHTML</span>();
};</pre>

<p class=XXX>domintro

</div>


<h6 id=cue-events><span class=secno>4.8.10.10.6 </span>Event definitions</h6>
<h6 id=cue-events><span class=secno>4.8.10.10.5 </span>Event definitions</h6>

<p class=XXX>...

0 comments on commit 2b105f9

Please sign in to comment.
You can’t perform that action at this time.