Permalink
Browse files

[acgiowt] (0) Make the MediaController feature more easily implementa…

…ble.

git-svn-id: http://svn.whatwg.org/webapps@5975 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent e3adec6 commit 54096b47f3566785b13169cea94e725eb3c45d34 @Hixie Hixie committed Apr 8, 2011
Showing with 1,544 additions and 620 deletions.
  1. +506 −207 complete.html
  2. +506 −207 index
  3. +532 −206 source
View
713 complete.html
@@ -239,7 +239,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1>Web Applications 1.0</h1>
- <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 30 March 2011</h2>
+ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 8 April 2011</h2>
</hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -25747,7 +25747,7 @@ <h4 id=media-elements><span class=secno>4.8.10 </span>Media elements</h4>
readonly attribute <a href=#exclusivetracklist>ExclusiveTrackList</a> <a href=#dom-media-videotracks title=dom-media-videoTracks>videoTracks</a>;
<!--CONTROLLER-->
readonly attribute <a href=#texttrack>TextTrack</a>[] <a href=#dom-media-texttracks title=dom-media-textTracks>textTracks</a>;
- <a href=#mutabletexttrack>MutableTextTrack</a> <a href=#dom-media-addtrack title=dom-media-addTrack>addTrack</a>(in DOMString kind, in optional DOMString label, in optional DOMString language);
+ <a href=#mutabletexttrack>MutableTextTrack</a> <a href=#dom-media-addtexttrack title=dom-media-addTextTrack>addTextTrack</a>(in DOMString kind, in optional DOMString label, in optional DOMString language);
<!--KEEP-START w3c-html--><!--TT-->
};</pre>
@@ -26666,7 +26666,7 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the
<p>If either the <a href=#media-resource>media resource</a> or the address of
the <var title="">current media resource</var> indicate a
particular start time, then set the <a href=#initial-playback-position>initial playback
- position</a> to that time and then seek <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time. Ignore any
+ position</a> to that time and then <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time. Ignore any
resulting exceptions (if the position is out of range, it is
effectively ignored).</p>
@@ -26688,6 +26688,24 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the
element's <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> object.</p>
</li>
+
+ <li>
+
+ <p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current
+ media controller</a>, then: if the <a href=#initial-playback-position>initial playback
+ position</a>, relative to the <a href=#current-media-controller>current media
+ controller</a>'s timeline, is greater than the
+ <a href=#current-media-controller>current media controller</a>'s <a href=#media-controller-position>media controller
+ position</a>, then <a href=#seek-the-media-controller>seek the media controller</a>
+ to the <a href=#media-element>media element</a>'s <a href=#initial-playback-position>initial playback
+ position</a>, relative to the <a href=#current-media-controller>current media
+ controller</a>'s timeline; otherwise, <a href=#dom-media-seek title=dom-media-seek>seek</a> the <a href=#media-element>media
+ element</a> to the <a href=#media-controller-position>media controller position</a>,
+ relative to the <a href=#media-element>media element</a>'s timeline,
+ discarding any resulting exceptions.</p> <!-- i.e. "bring the
+ media element up to speed with its new media controller" -->
+
+ </li>
<!--CONTROLLER-->
<li>
@@ -27037,7 +27055,11 @@ <h5 id=offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets
<p>Can be set, to seek to the given time.<p>
<p>Will throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if there
- is no selected <a href=#media-resource>media resource</a>. Will throw an
+ is no selected <a href=#media-resource>media resource</a>
+<!--CONTROLLER-->
+ or if there is a <a href=#current-media-controller>current media controller</a>.
+<!--CONTROLLER-->
+ Will throw an
<code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception if the given time is not
within the ranges to which the user agent can seek.</p>
@@ -27136,7 +27158,13 @@ <h5 id=offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets
<p>The <dfn id=dom-media-currenttime title=dom-media-currentTime><code>currentTime</code></dfn>
attribute must, on getting, return the <a href=#current-playback-position>current playback
- position</a>, expressed in seconds. On setting, the user agent
+ position</a>, expressed in seconds. On setting,
+<!--CONTROLLER-->
+ if the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
+ controller</a>, then it must throw an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception; otherwise,
+<!--CONTROLLER-->
+ the user agent
must <a href=#dom-media-seek title=dom-media-seek>seek</a> to the new value
(which might raise an exception).</p>
@@ -27226,6 +27254,12 @@ <h5 id=offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets
indicates that the <a href=#media-element>media element</a> is to seek back to the
start of the <a href=#media-resource>media resource</a> upon reaching the end.</p>
+<!--CONTROLLER-->
+ <p>The <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute has no
+ effect while the element has a <a href=#current-media-controller>current media
+ controller</a>.</p>
+<!--CONTROLLER-->
+
<div class=impl>
<p>The <dfn id=dom-media-loop title=dom-media-loop><code>loop</code></dfn> IDL
@@ -27314,10 +27348,9 @@ <h5 id=the-ready-states><span class=secno>4.8.10.7 </span>The ready states</h5>
<dd>All the conditions described for the <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> state
are met, and, in addition, the user agent estimates that data is
being fetched at a rate where the <a href=#current-playback-position>current playback
- position</a>, if it were to advance at the rate given by the
- <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
- attribute, would not overtake the available data before playback
- reaches the end of the <a href=#media-resource>media resource</a>.</dd>
+ position</a>, if it were to advance at the <a href=#effective-playback-rate>effective
+ playback rate</a>, would not overtake the available data before
+ playback reaches the end of the <a href=#media-resource>media resource</a>.</dd>
</dl><div class=impl>
@@ -27490,6 +27523,14 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
normal playback mode, it is expected that the rate of playback
will be returned to the default rate of playback.</p>
+<!--CONTROLLER-->
+ <p>When the element has a <a href=#current-media-controller>current media controller</a>,
+ the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
+ attribute is ignored and the <a href=#current-media-controller>current media
+ controller</a>'s <code title=dom-MediaController-defaultPlaybackRate><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code>
+ is used instead.</p>
+<!--CONTROLLER-->
+
</dd>
<dt><var title="">media</var> . <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> [ = <var title="">value</var> ]</dt>
@@ -27500,6 +27541,14 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
<p>Can be set, to change the rate of playback.</p>
+<!--CONTROLLER-->
+ <p>When the element has a <a href=#current-media-controller>current media controller</a>,
+ the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>
+ attribute is ignored and the <a href=#current-media-controller>current media
+ controller</a>'s <code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> is
+ used instead.</p>
+<!--CONTROLLER-->
+
</dd>
<dt><var title="">media</var> . <code title=dom-media-played><a href=#dom-media-played>played</a></code></dt>
@@ -27551,22 +27600,46 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
playback has not <a href=#stopped-due-to-errors>stopped due to errors</a>,
<!--CONTROLLER-->
the element either has no <a href=#current-media-controller>current media controller</a> or
- has a <a href=#current-media-controller>current media controller</a> that is itself not a
- <a href=#blocked-media-controller>blocked media controller</a>,
+ has a <a href=#current-media-controller>current media controller</a> but is not <a href=#blocked-on-its-media-controller>blocked
+ on its media controller</a>,
<!--CONTROLLER-->
and the element is not a <a href=#blocked-media-element>blocked media element</a>.</p>
<p>A <a href=#media-element>media element</a> is said to have <dfn id=ended-playback>ended
- playback</dfn> when the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater, and
- either the <a href=#current-playback-position>current playback position</a> is the end of the
- <a href=#media-resource>media resource</a> and the <a href=#direction-of-playback>direction of
- playback</a> is forwards and the <a href=#media-element>media element</a> does
- not have a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute
- specified, or the <a href=#current-playback-position>current playback position</a> is the
- <a href=#earliest-possible-position>earliest possible position</a> and the <a href=#direction-of-playback>direction of
- playback</a> is backwards.</p>
-
- <p>The <dfn id=dom-media-ended title=dom-media-ended><code>ended</code></dfn>
+ playback</dfn> when:</p>
+
+ <ul><li>The element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater,
+ and
+
+ <li>
+
+ <p>Either:
+
+ <ul><li>The <a href=#current-playback-position>current playback position</a> is the end of the
+ <a href=#media-resource>media resource</a>, and
+
+ <li>The <a href=#direction-of-playback>direction of playback</a> is forwards, and
+
+ <li>
+<!--CONTROLLER-->
+ Either
+<!--CONTROLLER-->
+ the <a href=#media-element>media element</a> does not have a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified,
+<!--CONTROLLER-->
+ or the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
+ controller</a>.
+<!--CONTROLLER-->
+
+ </ul><p>Or:
+
+ <ul><li>The <a href=#current-playback-position>current playback position</a> is the
+ <a href=#earliest-possible-position>earliest possible position</a>, and
+
+ <li>The <a href=#direction-of-playback>direction of playback</a> is backwards.
+
+ </ul></li>
+
+ </ul><p>The <dfn id=dom-media-ended title=dom-media-ended><code>ended</code></dfn>
attribute must return true if the <a href=#media-element>media element</a> has
<a href=#ended-playback>ended playback</a> and the <a href=#direction-of-playback>direction of
playback</a> is forwards, and false otherwise.</p>
@@ -27613,14 +27686,18 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
playback</a> is forwards, then the user agent must follow these
steps:</p>
- <ol><li><p>If the <a href=#media-element>media element</a> has a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest possible
- position</a> of the <a href=#media-resource>media resource</a> and abort these
- steps.</li> <!-- v2/v3: We should fire a 'looping' event here
- to explain why this immediately fires a 'playing' event, otherwise
- the 'playing' event that fires from the readyState going from
- HAVE_CURRENT_DATA back to HAVE_FUTURE_DATA will seem inexplicable
- (since the normally matching 'ended' given below event doesn't fire
- in the loop case). -->
+ <ol><li><p>If the <a href=#media-element>media element</a> has a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified
+<!--CONTROLLER-->
+ and does not have a <a href=#current-media-controller>current media controller</a>,
+<!--CONTROLLER-->
+ then <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest
+ possible position</a> of the <a href=#media-resource>media resource</a> and
+ abort these steps.</li> <!-- v2/v3: We should fire a 'looping'
+ event here to explain why this immediately fires a 'playing' event,
+ otherwise the 'playing' event that fires from the readyState going
+ from HAVE_CURRENT_DATA back to HAVE_FUTURE_DATA will seem
+ inexplicable (since the normally matching 'ended' given below event
+ doesn't fire in the loop case). -->
<li><p>Stop playback.<p class=note>The <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code> attribute becomes
true.</li>
@@ -27642,7 +27719,7 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
<li><p>The user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</li>
- </ol><p>The <dfn id=dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
+ </ol><hr><p>The <dfn id=dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
attribute gives the desired speed at which the <a href=#media-resource>media
resource</a> is to play, as a multiple of its intrinsic
speed. The attribute is mutable: on getting it must return the last
@@ -27654,20 +27731,22 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
to the user">exposes a user interface to the user</a>.</p>
<p>The <dfn id=dom-media-playbackrate title=dom-media-playbackRate><code>playbackRate</code></dfn>
- attribute gives the speed at which the <a href=#media-resource>media resource</a>
- plays, as a multiple of its intrinsic speed. If it is not equal to
- the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>,
+ attribute gives the <a href=#effective-playback-rate>effective playback rate</a>
+<!--CONTROLLER-->
+ (assuming there is no <a href=#current-media-controller>current media controller</a> overriding it),
+<!--CONTROLLER-->
+ which is the speed at which the <a href=#media-resource>media resource</a> plays,
+ as a multiple of its intrinsic speed. If it is not equal to the
+ <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>,
then the implication is that the user is using a feature such as
fast forward or slow motion playback. The attribute is mutable: on
getting it must return the last value it was set to, or 1.0 if it
hasn't yet been set; on setting the attribute must be set to the new
- value, and the playback must change speed (if the element is
- <a href=#potentially-playing>potentially playing</a>).</p>
-
- <p>The <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> can
- be 0.0, in which case the <a href=#current-playback-position>current playback position</a>
- doesn't move, despite playback not being paused (<code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> doesn't become true, and the
- <code title=event-media-pause><a href=#event-media-pause>pause</a></code> event doesn't fire).</p>
+ value, and the playback will change speed
+<!--CONTROLLER-->
+ (if the element is <a href=#potentially-playing>potentially playing</a> and there is no
+ <a href=#current-media-controller>current media controller</a>).</p>
+<!--CONTROLLER-->
<p id=rateUpdate>When the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> or
<code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attributes
@@ -27677,7 +27756,16 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
event</a> named <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> at the <a href=#media-element>media
element</a>.</p>
- <p>The <dfn id=dom-media-played title=dom-media-played><code>played</code></dfn>
+<!--CONTROLLER-->
+ <p class=note>The <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> and
+ <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attributes
+ have no effect when the <a href=#media-element>media element</a> has a
+ <a href=#current-media-controller>current media controller</a>; the namesake attributes on
+ the <code><a href=#mediacontroller>MediaController</a></code> object are used instead in that
+ situation.</p>
+<!--CONTROLLER-->
+
+ <hr><p>The <dfn id=dom-media-played title=dom-media-played><code>played</code></dfn>
attribute must return a new static <a href=#normalized-timeranges-object>normalized
<code>TimeRanges</code> object</a> that represents the ranges of
the <a href=#media-resource>media resource</a>, if any, that the user agent has so
@@ -27770,30 +27858,36 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
</ol><hr><p>The
<!--CONTROLLER-->
- <var title="">effective playback rate</var> is not necessarily the
- element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>.
- When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
- controller</a>, its <var title="">effective playback rate</var>
- is the element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> multiplied by the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate-multiplier>media controller playback rate
- multiplier</a>. Otherwise, the
+ <dfn id=effective-playback-rate>effective playback rate</dfn> is not necessarily the element's
+ <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>. When a
+ <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
+ controller</a>, its <a href=#effective-playback-rate>effective playback rate</a> is the
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller playback
+ rate</a>. Otherwise, the
+<!--CONTROLLER-->
+ <a href=#effective-playback-rate>effective playback rate</a> is just the element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>.
+<!--CONTROLLER-->
+ Thus, the <a href=#current-media-controller>current media controller</a> overrides the
+ <a href=#media-element>media element</a>.
<!--CONTROLLER-->
- <var title="">effective playback rate</var> is just the
- element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>.</p>
+ </p>
- <p>If the <var title="">effective playback rate</var> is positive or
- zero, then the <dfn id=direction-of-playback>direction of playback</dfn> is forwards.
- Otherwise, it is backwards.</p>
+ <p>If the <a href=#effective-playback-rate>effective playback rate</a> is positive or zero,
+ then the <dfn id=direction-of-playback>direction of playback</dfn> is forwards. Otherwise, it
+ is backwards.</p>
<p id=media-playback>When a <a href=#media-element>media element</a> is
<a href=#potentially-playing>potentially playing</a> and its <code><a href=#document>Document</a></code> is a
<a href=#fully-active>fully active</a> <code><a href=#document>Document</a></code>, its <a href=#current-playback-position>current
- playback position</a> must increase monotonically at <var title="">effective playback rate</var> units of media time per unit
- time of wall clock time.</p> <!--XXX will change with bug 12339 -->
-
- <p class=note>If the <var title="">effective playback rate</var>
- is zero, the <a href=#current-playback-position>current playback position</a> doesn't
- move.</p>
+ playback position</a> must increase monotonically at
+ <a href=#effective-playback-rate>effective playback rate</a> units of media time per unit time
+ of wall clock time.</p> <!--XXX will change with bug 12339 -->
+
+ <p class=note>The <a href=#effective-playback-rate>effective playback rate</a> can be 0.0,
+ in which case the <a href=#current-playback-position>current playback position</a> doesn't
+ move, despite playback not being paused (<code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> doesn't become true, and the
+ <code title=event-media-pause><a href=#event-media-pause>pause</a></code> event doesn't
+ fire).</p>
<p class=note>This specification doesn't define how the user agent
achieves the appropriate playback rate &mdash; depending on the
@@ -27805,23 +27899,29 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
interpolate any frames.</p>
<p>When the <a href=#direction-of-playback>direction of playback</a> is backwards, any
- corresponding audio must be muted. When the <var title="">effective
- playback rate</var> is so low or so high that the user agent cannot
- play audio usefully, the corresponding audio must also be muted. If
- the <var title="">effective playback rate</var> is not 1.0, the user
- agent may apply pitch adjustments to the audio as necessary to
- render it faithfully.</p>
+ corresponding audio must be muted. When the <a href=#effective-playback-rate>effective playback
+ rate</a> is so low or so high that the user agent cannot play
+ audio usefully, the corresponding audio must also be muted. If the
+ <a href=#effective-playback-rate>effective playback rate</a> is not 1.0, the user agent may
+ apply pitch adjustments to the audio as necessary to render it
+ faithfully.</p>
<p><a href=#media-element title="media element">Media elements</a> that are
<a href=#potentially-playing>potentially playing</a> while not <a href=#in-a-document>in a
<code>Document</code></a> must not play any video, but should
play any audio component. Media elements must not stop playing just
because all references to them have been removed; only once a media
- element to which no references exist has reached a point where no
- further audio remains to be played for that element (e.g. because
- the element is paused, or because the end of the clip has been
- reached, or because its <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> is 0.0) may the
- element be garbage collected.</p>
+ element is in a state where no further audio could ever be played by
+ that element may the element be garbage collected.</p>
+
+<!--CONTROLLER-->
+ <p class=note>It is possible for an element to which no explicit
+ references exist to play audio, even if such an element is not still
+ actively playing: for instance, it could have a <a href=#current-media-controller>current media
+ controller</a> that still has references and can still be
+ unpaused, or it could be unpaused but stalled waiting for content to
+ buffer.</p>
+<!--CONTROLLER-->
<hr><p>When the <a href=#current-playback-position>current playback position</a> of a <a href=#media-element>media
element</a> changes (e.g. due to playback or seeking), the user
@@ -27858,14 +27958,14 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
<!--KEEP-START w3c-html--><!--TT-->
<li><p>If the time was reached through the usual monotonic increase
- of the current playback position during normal playback, and if the
- user agent has not fired a <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event at the
+ of the <a href=#current-playback-position>current playback position</a> during normal
+ playback, and if the user agent has not fired a <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event at the
element in the past 15 to 250ms and is not still running event
handlers for such an event, then the user agent must <a href=#queue-a-task>queue a
- task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
- element. (In the other cases, such as explicit seeks, relevant
- events get fired as part of the overall process of changing the
- current playback position.)</p>
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.
+ (In the other cases, such as explicit seeks, relevant events get
+ fired as part of the overall process of changing the <a href=#current-playback-position>current
+ playback position</a>.)</p>
<p class=note>The event thus is not to be fired faster than about
66Hz or slower than 4Hz (assuming the event handlers don't take
@@ -27884,11 +27984,11 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
steps.</li>
<li><p>If the time was reached through the usual monotonic increase
- of the current playback position during normal playback, and there
- are <a href=#text-track-cue title="text track cue">cues</a> in <var title="">other
- cues</var> that have both their <a href=#text-track-cue-active-flag>text track cue active
- flag</a> set and their <a href=#text-track-cue-pause-on-exit-flag>text track cue pause-on-exit
- flag</a> set, then immediately <a href=#dom-media-pause title=dom-media-pause>pause</a> the <a href=#media-element>media
+ of the <a href=#current-playback-position>current playback position</a> during normal
+ playback, and there are <a href=#text-track-cue title="text track cue">cues</a> in
+ <var title="">other cues</var> that have both their <a href=#text-track-cue-active-flag>text
+ track cue active flag</a> set and their <a href=#text-track-cue-pause-on-exit-flag>text track cue
+ pause-on-exit flag</a> set, then immediately <a href=#dom-media-pause title=dom-media-pause>pause</a> the <a href=#media-element>media
element</a>. <!-- "pause" can in theory call load(), but never
can it do so as part of this invokation, since we wouldn't be in
this algorithm if the media element was empty. So, no need to couch
@@ -28190,6 +28290,8 @@ <h6 id=tracklist-objects><span class=secno>4.8.10.10.1 </span><code><a href=#tra
readonly attribute unsigned long <a href=#dom-tracklist-length title=dom-TrackList-length>length</a>;
DOMString <a href=#dom-tracklist-getname title=dom-TrackList-getName>getName</a>(in unsigned long index);
DOMString <a href=#dom-tracklist-getlanguage title=dom-TrackList-getLanguage>getLanguage</a>(in unsigned long index);
+
+ attribute <a href=#function>Function</a> <a href=#handler-tracklist-onchange title=handler-TrackList-onchange>onchange</a>;
};
interface <dfn id=multipletracklist>MultipleTrackList</dfn> : <a href=#tracklist>TrackList</a> {
@@ -28316,6 +28418,11 @@ <h6 id=tracklist-objects><span class=secno>4.8.10.10.1 </span><code><a href=#tra
index <var title="">index</var>, if there is one. If there is not,
it must instead throw an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+ <p>Whenever a track is enabled or disabled, the user agent must
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-media-change>change</code> at the
+ <code><a href=#multipletracklist>MultipleTrackList</a></code> object.</p>
+
<hr><p>An <code><a href=#exclusivetracklist>ExclusiveTrackList</a></code> object represents a track list
where exactly one track is selected at a time.</p>
@@ -28329,6 +28436,24 @@ <h6 id=tracklist-objects><span class=secno>4.8.10.10.1 </span><code><a href=#tra
track was previously selected. If there is no track with index <var title="">index</var>, it must instead throw an
<code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+ <p>Whenever the selected track is changed, the user agent must
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-media-change>change</code> at the
+ <code><a href=#multipletracklist>MultipleTrackList</a></code> object.</p>
+
+ <hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
+ corresponding <a href=#event-handler-event-type title="event handler event type">event handler
+ event types</a>) that must be supported, as IDL attributes, by
+ all objects implementing the <code><a href=#tracklist>TrackList</a></code>
+ interface:</p>
+
+ <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
+ <tbody><tr><td><dfn id=handler-tracklist-onchange title=handler-TrackList-onchange><code>onchange</code></dfn> <td> <code title=event-change>change</code>
+ </table><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this section is the
+ <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
+
+ <!-- v2 should also fire an event when the list changes -->
+
</div>
@@ -28387,39 +28512,54 @@ <h6 id=introduction-0><span class=secno>4.8.10.11.1 </span>Introduction</h6>
any of its slaved <a href=#media-element title="media element">media elements</a>
unexpectedly stall, the others are stopped at the same time.</p>
- <div class=example>
+ <p>When a <a href=#media-element>media element</a> is slaved to a
+ <code><a href=#mediacontroller>MediaController</a></code>, its playback rate is fixed to that of
+ the other tracks in the same <code><a href=#mediacontroller>MediaController</a></code>, and any
+ looping is disabled.</p>
+
+<!-- v2: add control to loop, add control to playback rate
+ <div class="example">
<p>In this example, two audio elements are slaved to the same
(implicit) controller so that a waltz played by one audio element
is kept exactly synchronised to the "tick tock tock" sound of the
metronome played by the second element:</p>
- <pre>&lt;audio src="The%20Amelia%20Earhart%20Waltz.wav" controls autoplay mediagroup="song"&gt;&lt;/audio&gt;
-&lt;audio src="metronomes/3-4.wav" autoplay loop mediagroup="song"&gt;&lt;/audio&gt;</pre>
+ <pre>&lt;audio src="The%20Amelia%20Earhart%20Waltz.wav" controls autoplay mediagroup="song">&lt;/audio>
+&lt;audio src="metronomes/3-4.wav" autoplay loop mediagroup="song">&lt;/audio></pre>
<p>Assuming the song keeps a regular tempo throughout and assuming
the metronome has the same tempo, this works even though if the
metronome file only has one measure's worth of "tick tock tock",
- because the controller (implied by the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute)
+ because the controller (implied by the <code
+ title="attr-media-mediagroup">mediagroup</code> attribute)
guarantees that the two elements will be kept synchronised, even if
the user rewinds, jumps to a different part of the song, etc (the
- user agent controls made available by the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute on the song's
- <code><a href=#audio>audio</a></code> element affect the
- <code><a href=#mediacontroller>MediaController</a></code>'s state).</p>
+ user agent controls made available by the <code
+ title="attr-media-controls">controls</code> attribute on the song's
+ <code>audio</code> element affect the
+ <code>MediaController</code>'s state).</p>
<p>If the metronome has the wrong rate, its rate can be adjusted by
- script separately from the song's (using the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>audio.playbackRate</a></code> IDL
- attribute). The two elements will play back their <a href=#media-data>media
- data</a> at different rates, but the ratio will again be
- controlled by the <code><a href=#mediacontroller>MediaController</a></code>.</p>
+ script separately from the song's (using the <code
+ title="dom-media-playbackRate">audio.playbackRate</code> IDL
+ attribute). The two elements will play back their <span>media
+ data</span> at different rates, but the ratio will again be
+ controlled by the <code>MediaController</code>.</p>
</div>
+-->
<h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers</h6>
<pre class=idl>[<a href=#dom-mediacontroller title=dom-MediaController>Constructor</a>]
interface <dfn id=mediacontroller>MediaController</dfn> {
+ readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-mediacontroller-buffered title=dom-MediaController-buffered>buffered</a>;
+ readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-mediacontroller-seekable title=dom-MediaController-seekable>seekable</a>;
+ readonly attribute double <a href=#dom-mediacontroller-duration title=dom-MediaController-duration>duration</a>;
+ attribute double <a href=#dom-mediacontroller-currenttime title=dom-MediaController-currentTime>currentTime</a>;
+
readonly attribute boolean <a href=#dom-mediacontroller-paused title=dom-MediaController-paused>paused</a>;
void <a href=#dom-mediacontroller-play title=dom-MediaController-play>play</a>();
void <a href=#dom-mediacontroller-pause title=dom-MediaController-pause>pause</a>();
@@ -28430,8 +28570,8 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<
attribute double <a href=#dom-mediacontroller-volume title=dom-MediaController-volume>volume</a>;
attribute boolean <a href=#dom-mediacontroller-muted title=dom-MediaController-muted>muted</a>;
- void <a href=#dom-mediacontroller-seek title=dom-MediaController-seek>seek</a>(in double delta);
-
+ attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-ondurationchange title=handler-MediaController-ondurationchange>ondurationchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-ontimeupdate title=handler-MediaController-ontimeupdate>ontimeupdate</a>;
attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-onplay title=handler-MediaController-onplay>onplay</a>;
attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-onpause title=handler-MediaController-onpause>onpause</a>;
attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-onratechange title=handler-MediaController-onratechange>onratechange</a>;
@@ -28458,6 +28598,51 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<
</dd>
+ <dt><var title="">controller</var> . <code title=dom-MediaController-buffered><a href=#dom-mediacontroller-buffered>buffered</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the
+ intersection of the time ranges for which the user agent has all
+ relevant media data for all the slaved <a href=#media-element title="media
+ element">media elements</a>.</p>
+
+ </dd>
+
+ <dt><var title="">controller</var> . <code title=dom-MediaController-seekable><a href=#dom-mediacontroller-seekable>seekable</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the
+ intersection of the time ranges into which the user agent can seek
+ for all the slaved <a href=#media-element title="media element">media
+ elements</a>.</p>
+
+ </dd>
+
+ <dt><var title="">controller</var> . <code title=dom-MediaController-duration><a href=#dom-mediacontroller-duration>duration</a></code></dt>
+
+ <dd>
+
+ <p>Returns the difference between the earliest playable moment and
+ the latest playable moment (not considering whether the data in
+ question is actually buffered or directly seekable, but not
+ including time in the future for infinite streams). Will return
+ zero if there is no media.</p>
+
+ </dd>
+
+ <dt><var title="">controller</var> . <code title=dom-MediaController-currentTime><a href=#dom-mediacontroller-currenttime>currentTime</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the <a href=#current-playback-position>current playback position</a>, in seconds,
+ as a position between zero time and the current <code title=dom-MediaController-duration><a href=#dom-mediacontroller-duration>duration</a></code>.</p>
+
+ <p>Can be set, to seek to the given time.<p>
+
+ </dd>
+
<dt><var title="">controller</var> . <code title=dom-MediaController-paused><a href=#dom-mediacontroller-paused>paused</a></code></dt>
<dd>
@@ -28490,28 +28675,24 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<
<dd>
- <p>Returns the default multiplier of the rate of playback.</p>
+ <p>Returns the default rate of playback.</p>
- <p>Can be set, to change the default multiplier of the rate of
- playback.</p>
+ <p>Can be set, to change the default rate of playback.</p>
- <p>This default multiplier has no direct effect on playback, but
- if the user switches to a fast-forward mode, when they return to
- the normal playback mode, it is expected that rate of playback
- multiplier (<code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code>) will
- be returned to this default multiplier.</p>
+ <p>This default rate has no direct effect on playback, but if the
+ user switches to a fast-forward mode, when they return to the
+ normal playback mode, it is expected that rate of playback (<code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code>) will
+ be returned to this default rate.</p>
</dd>
<dt><var title="">controller</var> . <code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> [ = <var title="">value</var> ]</dt>
<dd>
- <p>Returns the current multiplier of the rate playback, where 1.0
- is no multiplier.</p>
+ <p>Returns the current rate of playback.</p>
- <p>Can be set, to change the rate of playback of the <a href=#media-element title="media element">media elements</a> slaved to this
- controller.</p>
+ <p>Can be set, to change the rate of playback.</p>
</dd>
@@ -28543,30 +28724,104 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<
</dd>
- <dt><var title="">controller</var> . <code title=dom-MediaController-seek><a href=#dom-mediacontroller-seek>seek</a></code>( <var title="">delta</var> )</dt>
-
- <dd>
-
- <p>Advances the <a href=#media-element title="media element">media elements</a>
- slaved to this controller by <var title="">delta</var> seconds,
- corrected to take into account their relative playback rates.</p>
-
- </dd>
-
</dl><div class=impl>
<p>A <a href=#media-element>media element</a> can have a <dfn id=current-media-controller>current media
controller</dfn>, which is a <code><a href=#mediacontroller>MediaController</a></code> object.
- The <dfn id=slaved-media-elements>slaved media elements</dfn> of a
+ When a <a href=#media-element>media element</a> is created without a <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, it does
+ not have a <a href=#current-media-controller>current media controller</a>. (If it is created
+ <em>with</em> such an attribute, then that attribute initializes the
+ <a href=#current-media-controller>current media controller</a>, as defined below.)</p>
+
+ <p>The <dfn id=slaved-media-elements>slaved media elements</dfn> of a
<code><a href=#mediacontroller>MediaController</a></code> are the <a href=#media-element title="media
element">media elements</a> whose <a href=#current-media-controller>current media
- controller</a> is that <code><a href=#mediacontroller>MediaController</a></code>.</p>
-
- <p>All the <a href=#slaved-media-elements>slaved media elements</a> of a
- <code><a href=#mediacontroller>MediaController</a></code> must use the same clock for their
- definition of their <a href=#media-timeline>media timeline</a>'s unit time.</p>
-
- <p>When a <code><a href=#mediacontroller>MediaController</a></code> is created it is a
+ controller</a> is that <code><a href=#mediacontroller>MediaController</a></code>. All the
+ <a href=#slaved-media-elements>slaved media elements</a> of a <code><a href=#mediacontroller>MediaController</a></code>
+ must use the same clock for their definition of their <a href=#media-timeline>media
+ timeline</a>'s unit time.</p>
+
+ <p>The <a href=#media-resource title="media resource">media resources</a> of all
+ the <a href=#slaved-media-elements>slaved media elements</a> of a
+ <code><a href=#mediacontroller>MediaController</a></code> have a defined temporal relationship
+ which provides relative offsets between the zero time of each such
+ <a href=#media-resource>media resource</a>: for <a href=#media-resource title="media resource">media
+ resources</a> with a <a href=#timeline-offset>timeline offset</a>, their relative
+ offsets are the difference between their <a href=#timeline-offset>timeline
+ offset</a>; the zero times of all the <a href=#media-resource title="media
+ resource">media resources</a> without a <a href=#timeline-offset>timeline
+ offset</a> are not offset from each other (i.e. the origins of
+ their timelines are cotemporal); and finally, the zero time of the
+ <a href=#media-resource>media resource</a> with the earliest <a href=#timeline-offset>timeline
+ offset</a> (if any) is not offset from the zero times of the
+ <a href=#media-resource title="media resource">media resources</a> without a
+ <a href=#timeline-offset>timeline offset</a> (i.e. the origins of <a href=#media-resource title="media
+ resource">media resources</a> without a <a href=#timeline-offset>timeline
+ offset</a> are further cotemporal with the earliest defined point
+ on the timeline of the <a href=#media-resource>media resource</a> with the earliest
+ <a href=#timeline-offset>timeline offset</a>).</p>
+
+ <p>The <dfn id=media-resource-end-position>media resource end position</dfn> of a <a href=#media-resource>media
+ resource</a> in a <a href=#media-element>media element</a> is defined as
+ follows: if the <a href=#media-resource>media resource</a> has a finite and known
+ duration, the <a href=#media-resource-end-position>media resource end position</a> is the
+ duration of the <a href=#media-resource>media resource</a>'s timeline (the last
+ defined position on that timeline); otherwise, the <a href=#media-resource>media
+ resource</a>'s duration is infinite or unknown, and the
+ <a href=#media-resource-end-position>media resource end position</a> is the time of the last
+ frame of <a href=#media-data>media data</a> currently available for that
+ <a href=#media-resource>media resource</a>.</p>
+
+ <p>Each <code><a href=#mediacontroller>MediaController</a></code> also has its own defined
+ timeline. On this timeline, all the <a href=#media-resource title="media
+ resource">media resources</a> of all the <a href=#slaved-media-elements>slaved media
+ elements</a> of the <code><a href=#mediacontroller>MediaController</a></code> are temporally
+ aligned according to their defined offsets. The <dfn id=media-controller-duration>media
+ controller duration</dfn> of that <code><a href=#mediacontroller>MediaController</a></code> is
+ the time from the earliest <a href=#earliest-possible-position>earliest possible position</a>,
+ relative to this <code><a href=#mediacontroller>MediaController</a></code> timeline, of any of
+ the <a href=#media-resource title="media resource">media resources</a> of the
+ <a href=#slaved-media-elements>slaved media elements</a> of the
+ <code><a href=#mediacontroller>MediaController</a></code>, to the time of the latest <a href=#media-resource-end-position>media
+ resource end position</a> of the <a href=#media-resource title="media
+ resource">media resources</a> of the <a href=#slaved-media-elements>slaved media
+ elements</a> of the <code><a href=#mediacontroller>MediaController</a></code>, again relative
+ to this <code><a href=#mediacontroller>MediaController</a></code> timeline.</p>
+
+ <p>Each <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-position>media controller
+ position</dfn>. This is the time on the
+ <code><a href=#mediacontroller>MediaController</a></code>'s timeline at which the user agent is
+ trying to play the <a href=#slaved-media-elements>slaved media elements</a>. When a
+ <code><a href=#mediacontroller>MediaController</a></code> is created, its <a href=#media-controller-position>media controller
+ position</a> is initially zero.</p>
+
+ <p>When the user agent is to <dfn id=bring-the-media-element-up-to-speed-with-its-new-media-controller title="bring the media element up
+ to speed with its new media controller">bring a media element up to
+ speed with its new media controller</dfn>, it must <a href=#dom-media-seek title=dom-media-seek>seek</a> that <a href=#media-element>media element</a>
+ to the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position>media controller
+ position</a> relative to the <a href=#media-element>media element</a>'s
+ timeline, discarding any resulting exceptions.</p>
+
+ <p>When the user agent is to <dfn id=seek-the-media-controller>seek the media controller</dfn> to
+ a particular <var title="">new playback position</var>, it must
+ follow these steps:</p>
+
+ <ol><li><p>If the <var title="">new playback position</var> is less
+ than zero, then set it to zero.</li>
+
+ <li><p>If the <var title="">new playback position</var> is greater
+ than the <a href=#media-controller-duration>media controller duration</a>, then set it to the
+ <a href=#media-controller-duration>media controller duration</a>.</li>
+
+ <li><p>Set the <a href=#media-controller-position>media controller position</a> to the <var title="">new playback position</var>.</li>
+
+ <li><p><a href=#dom-media-seek title=dom-media-seek>Seek</a> each <a href=#slaved-media-elements title="slaved media elements">slaved media element</a> to the
+ <var title="">new playback position</var> relative to the
+ <a href=#media-element>media element</a> timeline, discarding any resulting
+ exceptions.</li> <!-- i.e. "bring the media element up to speed
+ with its new media controller" -->
+
+ </ol><p>When a <code><a href=#mediacontroller>MediaController</a></code> is created it is a
<dfn id=playing-media-controller>playing media controller</dfn>. It can be changed into a
<dfn id=paused-media-controller>paused media controller</dfn> and back either via the user
agent's user interface (when the element is <a href=#expose-a-user-interface-to-the-user title="expose a
@@ -28580,28 +28835,88 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<
media elements</a> are <a href=#blocked-media-element title="blocked media
element">blocked media elements</a>, or if any of its
<a href=#slaved-media-elements>slaved media elements</a> whose <a href=#autoplaying-flag>autoplaying
- flag</a> is true still have a <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute this is true.</p>
+ flag</a> is true still have a <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute that is true.</p>
- <p>A <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-default-playback-rate-multiplier>media controller
- default playback rate multiplier</dfn>, a <dfn id=media-controller-playback-rate-multiplier>media controller
- playback rate multiplier</dfn>, and a <dfn id=media-controller-volume-multiplier>media controller volume
- multiplier</dfn>, which must all be set to 1.0 when the
- <code><a href=#mediacontroller>MediaController</a></code> object is created. A
- <code><a href=#mediacontroller>MediaController</a></code> also has a <dfn id=media-controller-mute-override>media controller mute
- override</dfn>, much must initially be false.</p>
+ <p>A <a href=#media-element>media element</a> is <dfn id=blocked-on-its-media-controller>blocked on its media
+ controller</dfn> if the <code><a href=#mediacontroller>MediaController</a></code> is a
+ <a href=#blocked-media-controller>blocked media controller</a>, or if its <a href=#media-controller-position>media
+ controller position</a> is either before the <a href=#media-resource>media
+ resource</a>'s <a href=#earliest-possible-position>earliest possible position</a> relative
+ to the <code><a href=#mediacontroller>MediaController</a></code>'s timeline or after the end of
+ the <a href=#media-resource>media resource</a> relative to the
+ <code><a href=#mediacontroller>MediaController</a></code>'s timeline.</p>
+
+ <p>A <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-default-playback-rate>media controller
+ default playback rate</dfn>, a <dfn id=media-controller-playback-rate>media controller playback
+ rate</dfn>, and a <dfn id=media-controller-volume-multiplier>media controller volume multiplier</dfn>,
+ which must all be set to 1.0 when the <code><a href=#mediacontroller>MediaController</a></code>
+ object is created. A <code><a href=#mediacontroller>MediaController</a></code> also has a
+ <dfn id=media-controller-mute-override>media controller mute override</dfn>, much must initially be
+ false.</p>
+
+ <p id=controller-playback>When a <code><a href=#mediacontroller>MediaController</a></code> is
+ not a <a href=#blocked-media-controller>blocked media controller</a> and it has at least one
+ <a href=#slaved-media-elements title="slaved media elements">slaved media element</a>
+ whose <code><a href=#document>Document</a></code> is a <a href=#fully-active>fully active</a>
+ <code><a href=#document>Document</a></code>, the <code><a href=#mediacontroller>MediaController</a></code>'s
+ <a href=#media-controller-position>media controller position</a> must increase monotonically
+ at <a href=#media-controller-playback-rate>media controller playback rate</a> units of time on the
+ <code><a href=#mediacontroller>MediaController</a></code>'s timeline per unit time of the clock
+ used by its <a href=#slaved-media-elements>slaved media elements</a>.</p>
<hr><p>The <dfn id=dom-media-controller title=dom-media-controller><code>controller</code></dfn> attribute
on a <a href=#media-element>media element</a>, on getting, must return the
element's <a href=#current-media-controller>current media controller</a>, if any, or null
otherwise. On setting, it must first remove the element's <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, if any,
and then set the <a href=#current-media-controller>current media controller</a> to the given
value. If the given value is null, the element no longer has a
- <a href=#current-media-controller>current media controller</a>.</p>
+ <a href=#current-media-controller>current media controller</a>; if it is not null, then the
+ user agent must <a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller>bring the media element up to speed with its
+ new media controller</a>.</p>
<hr><p>The <dfn id=dom-mediacontroller title=dom-MediaController><code>MediaController()</code></dfn>
constructor, when invoked, must return a newly created
<code><a href=#mediacontroller>MediaController</a></code> object.</p>
+ <hr><p>The <dfn id=dom-mediacontroller-seekable title=dom-MediaController-seekable><code>seekable</code></dfn>
+ attribute must return a new static <a href=#normalized-timeranges-object>normalized
+ <code>TimeRanges</code> object</a> that represents the
+ intersection of the ranges of the <a href=#media-resource title="media resource">media
+ resources</a> of the <a href=#slaved-media-elements>slaved media elements</a> that the
+ user agent is able to seek to, at the time the attribute is
+ evaluated.</p>
+
+ <p>The <dfn id=dom-mediacontroller-buffered title=dom-MediaController-buffered><code>buffered</code></dfn>
+ attribute must return a new static <a href=#normalized-timeranges-object>normalized
+ <code>TimeRanges</code> object</a> that represents the
+ intersection of the ranges of the <a href=#media-resource title="media resource">media
+ resources</a> of the <a href=#slaved-media-elements>slaved media elements</a> that the
+ user agent has buffered, at the time the attribute is evaluated.
+ Users agents must accurately determine the ranges available, even
+ for media streams where this can only be determined by tedious
+ inspection.</p>
+
+ <p>The <dfn id=dom-mediacontroller-duration title=dom-MediaController-duration><code>duration</code></dfn>
+ attribute must return the <a href=#media-controller-duration>media controller
+ duration</a>.</p>
+
+ <p>Every 15 to 250ms, or whenever the <code><a href=#mediacontroller>MediaController</a></code>'s
+ <a href=#media-controller-duration>media controller duration</a> changes, whichever happens
+ least often, the user agent must <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> at the
+ <code><a href=#mediacontroller>MediaController</a></code>.</p>
+
+ <p>The <dfn id=dom-mediacontroller-currenttime title=dom-MediaController-currentTime><code>currentTime</code></dfn>
+ attribute must return the <a href=#media-controller-position>media controller position</a> on
+ getting, and on setting must <a href=#seek-the-media-controller>seek the media controller</a>
+ to the new value.</p>
+
+ <p>Every 15 to 250ms, or whenever the <code><a href=#mediacontroller>MediaController</a></code>'s
+ <a href=#media-controller-position>media controller position</a> changes, whichever happens
+ least often, the user agent must <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
+ <code><a href=#mediacontroller>MediaController</a></code>.</p>
+
<hr><p>The <dfn id=dom-mediacontroller-paused title=dom-MediaController-paused><code>paused</code></dfn>
attribute must return true if the <code><a href=#mediacontroller>MediaController</a></code>
object is a <a href=#paused-media-controller>paused media controller</a>, and false
@@ -28631,22 +28946,22 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<
<hr><p>The <dfn id=dom-mediacontroller-defaultplaybackrate title=dom-MediaController-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
attribute, on getting, must return the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate-multiplier>media controller default
- playback rate multiplier</a>, and on setting, must set the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate-multiplier>media controller default
- playback rate multiplier</a> to the new value.</p>
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate>media controller default
+ playback rate</a>, and on setting, must set the
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate>media controller default
+ playback rate</a> to the new value.</p>
<p>The <dfn id=dom-mediacontroller-playbackrate title=dom-MediaController-playbackRate><code>playbackRate</code></dfn>
attribute, on getting, must return the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate-multiplier>media controller playback rate
- multiplier</a>, and on setting, must set the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate-multiplier>media controller playback rate
- multiplier</a> to the new value.</p>
-
- <p>Whenever the <a href=#media-controller-default-playback-rate-multiplier>media controller default playback rate
- multiplier</a> or the <a href=#media-controller-playback-rate-multiplier>media controller playback rate
- multiplier</a> are changed, the user agent must <a href=#queue-a-task>queue a
- task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> at the
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller playback
+ rate</a>, and on setting, must set the
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller playback
+ rate</a> to the new value.</p>
+
+ <p>Whenever the <a href=#media-controller-default-playback-rate>media controller default playback rate</a>
+ or the <a href=#media-controller-playback-rate>media controller playback rate</a> are changed, the
+ user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> at the
<code><a href=#mediacontroller>MediaController</a></code>.</p>
<hr><p>The <dfn id=dom-mediacontroller-volume title=dom-MediaController-volume><code>volume</code></dfn>
@@ -28672,55 +28987,21 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<
<a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> at the
<code><a href=#mediacontroller>MediaController</a></code>.</p>
- <hr><p>The <dfn id=dom-mediacontroller-seek title=dom-MediaController-seek><code>seek()</code></dfn> method
- must run the following steps for each <a href=#slaved-media-elements title="slaved media
- elements">slaved media element</a>, if any:</p>
-
- <ol><li><p>Let <var title="">delta</var> be the method's argument.</li>
-
- <li><p>Let <var title="">element</var> be the <a href=#slaved-media-elements title="slaved
- media elements">slaved media element</a> being processed in this
- iteration.</li>
-
- <li><p>Let <var title="">effective delta</var> be <var title="">delta</var> multiplied by the value of <var title="">element</var>'s <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>
- attribute.</li>
-
- <li><p>Let <var title="">new position</var> be <var title="">element</var>'s <a href=#current-playback-position>current playback position</a> (in
- seconds) plus <var title="">effective delta</var>.</li>
-
- <li><p>Let <var title="">duration</var> be the difference between
- <var title="">element</var>'s <a href=#earliest-possible-position>earliest possible
- position</a> (in seconds) and the time at the end of <var title="">element</var>'s <a href=#media-data>media data</a> (in
- seconds).</li>
-
- <li>
-
- <p>If <var title="">element</var>'s <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute is not specified,
- then skip this step. Otherwise:</p>
-
- <p>While <var title="">new position</var> is greater than the time
- at the end of <var title="">element</var>'s <a href=#media-data>media
- data</a> (in seconds), decrement <var title="">new
- position</var> by <var title="">duration</var>.</p>
-
- <p>While <var title="">new position</var> is less than <var title="">element</var>'s <a href=#earliest-possible-position>earliest possible position</a>
- (in seconds), increment <var title="">new position</var> by <var title="">duration</var>.</p>
-
- </li>
-
- <li><p><a href=#dom-media-seek title=dom-media-seek>Seek</a> <var title="">element</var> to <var title="">new position</var>
- (interpreted as a time in seconds).</li>
-
- </ol><hr><p>The following are the <a href=#event-handlers>event handlers</a> that must be
+ <hr><p>The following are the <a href=#event-handlers>event handlers</a> that must be
supported, as IDL attributes, by all objects implementing the
<code><a href=#mediacontroller>MediaController</a></code> interface:</p>
<table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-mediacontroller-onplay title=handler-MediaController-onplay><code>onplay</code></dfn> <td> <code title=event-play>play</code>
+ <tbody><tr><td><dfn id=handler-mediacontroller-ondurationchange title=handler-MediaController-ondurationchange><code>ondurationchange</code></dfn> <td> <code title=event-durationchange>durationchange</code>
+ <tr><td><dfn id=handler-mediacontroller-ontimeupdate title=handler-MediaController-ontimeupdate><code>ontimeupdate</code></dfn> <td> <code title=event-durationchange>durationchange</code>
+ <tr><td><dfn id=handler-mediacontroller-onplay title=handler-MediaController-onplay><code>onplay</code></dfn> <td> <code title=event-play>play</code>
<tr><td><dfn id=handler-mediacontroller-onpause title=handler-MediaController-onpause><code>onpause</code></dfn> <td> <code title=event-pause>pause</code>
<tr><td><dfn id=handler-mediacontroller-onratechange title=handler-MediaController-onratechange><code>onratechange</code></dfn> <td> <code title=event-ratechange>ratechange</code>
<tr><td><dfn id=handler-mediacontroller-onvolumechange title=handler-MediaController-onvolumechange><code>onvolumechange</code></dfn> <td> <code title=event-volumechange>volumechange</code>
- </table></div>
+ </table><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this section is the
+ <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
+
+ </div>
<h6 id=assigning-a-media-controller-declaratively><span class=secno>4.8.10.11.3 </span>Assigning a media controller declaratively</h6>
@@ -28767,6 +29048,9 @@ <h6 id=assigning-a-media-controller-declaratively><span class=secno>4.8.10.11.3
<li><p>Let <var title="">m</var>'s <a href=#current-media-controller>current media
controller</a> be <var title="">controller</var>.</li>
+ <li><p><a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller>Bring the media element up to speed with its new media
+ controller</a>.</li>
+
</ol><p>The <dfn id=dom-media-mediagroup title=dom-media-mediaGroup><code>mediaGroup</code></dfn> IDL
attribute on <a href=#media-element title="media element">media elements</a> must
<a href=#reflect>reflect</a> the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> content
@@ -28837,7 +29121,7 @@ <h6 id=text-track-model><span class=secno>4.8.10.12.1 </span>Text track model</h
element</a>, in <a href=#tree-order>tree order</a>.</li>
<li>Any <a href=#text-track title="text track">text tracks</a> added using
- the <code title=dom-media-addTrack><a href=#dom-media-addtrack>addTrack()</a></code> method, in
+ the <code title=dom-media-addTextTrack><a href=#dom-media-addtexttrack>addTextTrack()</a></code> method, in
the order they were added, oldest first.</li>
<li>Any <a href=#media-resource-specific-text-track title="media-resource-specific text
@@ -29898,7 +30182,8 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
void <a href=#dom-mutabletexttrack-removecue title=dom-MutableTextTrack-removeCue>removeCue</a>(in <a href=#texttrackcue>TextTrackCue</a> cue);
};</pre>
- <dl class=domintro><dt><var title="">mutableTextTrack</var> = <var title="">media</var> . <code title=dom-media-addTrack><a href=#dom-media-addtrack>addTrack</a></code>( <var title="">kind</var> [, <var title="">label</var> [, <var title="">language</var> ] ] )</dt>
+ <dl class=domintro><dt><var title="">mutableTextTrack</var> = <var title="">media</var> . <code title=dom-media-addTextTrack><a href=#dom-media-addtexttrack>addTextTrack</a></code>( <var title="">kind</var> [, <var title="">label</var> [, <var title="">language</var> ] ] )</dt>
+
<dd>
<p>Creates and returns a new <code><a href=#mutabletexttrack>MutableTextTrack</a></code> object, which is also added to the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>.</p>
</dd>
@@ -29917,7 +30202,7 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
</dl><div class=impl>
- <p>The <dfn id=dom-media-addtrack title=dom-media-addTrack><code>addTrack(<var title="">kind</var>, <var title="">label</var>, <var title="">language</var>)</code></dfn> method of <a href=#media-element title="media
+ <p>The <dfn id=dom-media-addtexttrack title=dom-media-addTextTrack><code>addTextTrack(<var title="">kind</var>, <var title="">label</var>, <var title="">language</var>)</code></dfn> method of <a href=#media-element title="media
element">media elements</a>, when invoked, must run the following
steps:</p>
@@ -30034,7 +30319,8 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
able to run the script at the exact time specified.</p>
<pre>var sfx = new Audio('sfx.wav');
-var sounds = a.addTrack('metadata');
+var sounds = a.addTextTrack('metadata');
+
// add sounds we care about
sounds.addCue(new TextTrackCue('dog bark', 12.783, 13.612, '', '', '', true));
sounds.addCue(new TextTrackCue('kitten mew', 13.612, 15.091, '', '', '', true));
@@ -32077,6 +32363,19 @@ <h5 id=user-interface><span class=secno>4.8.10.14 </span>User interface</h5>
the user (e.g. full-screen video or in an independent resizable
window). Other controls may also be made available.</p>
+<!--CONTROLLER-->
+ <p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
+ controller</a>, then the user agent should expose audio tracks
+ from all the <a href=#slaved-media-elements>slaved media elements</a> (although avoiding
+ duplicates if the same <a href=#media-resource>media resource</a> is being used
+ several times). If a <a href=#media-resource>media resource</a>'s audio track
+ exposed in this way has no known name, and it is the only audio
+ track for a particular <a href=#media-element>media element</a>, the user agent
+ should use the element's <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ attribute, if any, as the name (or as part of the name) of that
+ track.</p>
+<!--CONTROLLER-->
+
<p>Even when the attribute is absent, however, user agents may
provide controls to affect playback of the media resource
(e.g. play, pause, seeking, and volume controls), but such features
@@ -32097,12 +32396,12 @@ <h5 id=user-interface><span class=secno>4.8.10.14 </span>User interface</h5>
<!--CONTROLLER-->
<p>When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
- controller</a>, the user agent must implement its user interface
- for pausing and unpausing playback, for seeking, for changing the
- rate of playback, for fast-forwarding or rewinding, and for muting
- or changing the volume of audio must be implemented specifically in
- terms of the <code><a href=#mediacontroller>MediaController</a></code> API exposed on that
- <a href=#current-media-controller>current media controller</a>.</p>
+ controller</a>, the user agent's user interface for pausing and
+ unpausing playback, for seeking, for changing the rate of playback,
+ for fast-forwarding or rewinding, and for muting or changing the
+ volume of audio must be implemented specifically in terms of the
+ <code><a href=#mediacontroller>MediaController</a></code> API exposed on that <a href=#current-media-controller>current media
+ controller</a>.</p>
<!--CONTROLLER-->
<p>The "play" function in the user agent's interface must set the
@@ -32133,7 +32432,7 @@ <h5 id=user-interface><span class=secno>4.8.10.14 </span>User interface</h5>
<!--CONTROLLER-->
<p>When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
- controller</a>, seeking must be implemented in terms of the <code title=dom-MediaController-seek><a href=#dom-mediacontroller-seek>seek()</a></code> method on that
+ controller</a>, seeking must be implemented in terms of the <code title=dom-MediaController-seek>seek()</code> method on that
<code><a href=#mediacontroller>MediaController</a></code> object. Otherwise, the user agent must
directly <a href=#dom-media-seek title=dom-media-seek>seek</a> to the requested
position in the <a href=#media-element>media element</a>'s <a href=#media-timeline>media
@@ -32467,20 +32766,20 @@ <h5 id=mediaevents><span class=secno>4.8.10.16 </span>Event summary</h5>
<td><code><a href=#event>Event</a></code>
<td>The <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute changed to false.
<td>
- <tr><td><dfn id=event-media-timeupdate title=event-media-timeupdate><code>timeupdate</code></dfn>
- <td><code><a href=#event>Event</a></code>
- <td>The <a href=#current-playback-position>current playback position</a> changed as part of normal playback or in an especially interesting way, for example discontinuously.
- <td>
<tr><td><dfn id=event-media-ended title=event-media-ended><code>ended</code></dfn>
<td><code><a href=#event>Event</a></code>
<td>Playback has stopped because the end of the <a href=#media-resource>media resource</a> was reached.
<td><code title=dom-media-currentTime><a href=#dom-media-currenttime>currentTime</a></code> equals the end of the <a href=#media-resource>media resource</a>; <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code> is true.
- <tr><td><dfn id=event-media-durationchange title=event-media-durationchange><code>durationchange</code></dfn>
+
+ <tbody><tr><td><dfn id=event-media-durationchange title=event-media-durationchange><code>durationchange</code></dfn>
<td><code><a href=#event>Event</a></code>
<td>The <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute has just been updated.
<td>
-
- <tbody><tr><td><dfn id=event-media-play title=event-media-play><code>play</code></dfn>
+ <tr><td><dfn id=event-media-timeupdate title=event-media-timeupdate><code>timeupdate</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The <a href=#current-playback-position>current playback position</a> changed as part of normal playback or in an especially interesting way, for example discontinuously.
+ <td>
+ <tr><td><dfn id=event-media-play title=event-media-play><code>play</code></dfn>
<td><code><a href=#event>Event</a></code>
<td>Playback has begun. Fired after the <code title=dom-media-play><a href=#dom-media-play>play()</a></code> method has returned, or when the <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute has caused playback to begin.
<td><code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is newly false.
@@ -32496,7 +32795,7 @@ <h5 id=mediaevents><span class=secno>4.8.10.16 </span>Event summary</h5>
<td><code><a href=#event>Event</a></code>
<td>Either the <code title=dom-media-volume><a href=#dom-media-volume>volume</a></code> attribute or the <code title=dom-media-muted><a href=#dom-media-muted>muted</a></code> attribute has changed. Fired after the relevant attribute's setter has returned.
<td>
- </table><!--CONTROLLER--><p>The last four events in this table are also fired on <code><a href=#mediacontroller>MediaController</a></code> objects.</p>
+ </table><!--CONTROLLER--><p>The last six events in this table are also fired on <code><a href=#mediacontroller>MediaController</a></code> objects.</p>
<!--CONTROLLER-->
View
713 index
@@ -243,7 +243,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
- <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 30 March 2011</h2>
+ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 8 April 2011</h2>
</hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -25727,7 +25727,7 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
readonly attribute <a href=#exclusivetracklist>ExclusiveTrackList</a> <a href=#dom-media-videotracks title=dom-media-videoTracks>videoTracks</a>;
<!--CONTROLLER-->
readonly attribute <a href=#texttrack>TextTrack</a>[] <a href=#dom-media-texttracks title=dom-media-textTracks>textTracks</a>;
- <a href=#mutabletexttrack>MutableTextTrack</a> <a href=#dom-media-addtrack title=dom-media-addTrack>addTrack</a>(in DOMString kind, in optional DOMString label, in optional DOMString language);
+ <a href=#mutabletexttrack>MutableTextTrack</a> <a href=#dom-media-addtexttrack title=dom-media-addTextTrack>addTextTrack</a>(in DOMString kind, in optional DOMString label, in optional DOMString language);
<!--KEEP-START w3c-html--><!--TT-->
};</pre>
@@ -26646,7 +26646,7 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<p>If either the <a href=#media-resource>media resource</a> or the address of
the <var title="">current media resource</var> indicate a
particular start time, then set the <a href=#initial-playback-position>initial playback
- position</a> to that time and then seek <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time. Ignore any
+ position</a> to that time and then <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time. Ignore any
resulting exceptions (if the position is out of range, it is
effectively ignored).</p>
@@ -26668,6 +26668,24 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
element's <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> object.</p>
</li>
+
+ <li>
+
+ <p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current
+ media controller</a>, then: if the <a href=#initial-playback-position>initial playback
+ position</a>, relative to the <a href=#current-media-controller>current media
+ controller</a>'s timeline, is greater than the
+ <a href=#current-media-controller>current media controller</a>'s <a href=#media-controller-position>media controller
+ position</a>, then <a href=#seek-the-media-controller>seek the media controller</a>
+ to the <a href=#media-element>media element</a>'s <a href=#initial-playback-position>initial playback
+ position</a>, relative to the <a href=#current-media-controller>current media
+ controller</a>'s timeline; otherwise, <a href=#dom-media-seek title=dom-media-seek>seek</a> the <a href=#media-element>media
+ element</a> to the <a href=#media-controller-position>media controller position</a>,
+ relative to the <a href=#media-element>media element</a>'s timeline,
+ discarding any resulting exceptions.</p> <!-- i.e. "bring the
+ media element up to speed with its new media controller" -->
+
+ </li>
<!--CONTROLLER-->
<li>
@@ -27017,7 +27035,11 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<p>Can be set, to seek to the given time.<p>
<p>Will throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception if there
- is no selected <a href=#media-resource>media resource</a>. Will throw an
+ is no selected <a href=#media-resource>media resource</a>
+<!--CONTROLLER-->
+ or if there is a <a href=#current-media-controller>current media controller</a>.
+<!--CONTROLLER-->
+ Will throw an
<code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception if the given time is not
within the ranges to which the user agent can seek.</p>
@@ -27116,7 +27138,13 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<p>The <dfn id=dom-media-currenttime title=dom-media-currentTime><code>currentTime</code></dfn>
attribute must, on getting, return the <a href=#current-playback-position>current playback
- position</a>, expressed in seconds. On setting, the user agent
+ position</a>, expressed in seconds. On setting,
+<!--CONTROLLER-->
+ if the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
+ controller</a>, then it must throw an
+ <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception; otherwise,
+<!--CONTROLLER-->
+ the user agent
must <a href=#dom-media-seek title=dom-media-seek>seek</a> to the new value
(which might raise an exception).</p>
@@ -27206,6 +27234,12 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
indicates that the <a href=#media-element>media element</a> is to seek back to the
start of the <a href=#media-resource>media resource</a> upon reaching the end.</p>
+<!--CONTROLLER-->
+ <p>The <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute has no
+ effect while the element has a <a href=#current-media-controller>current media
+ controller</a>.</p>
+<!--CONTROLLER-->
+
<div class=impl>
<p>The <dfn id=dom-media-loop title=dom-media-loop><code>loop</code></dfn> IDL
@@ -27294,10 +27328,9 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<dd>All the conditions described for the <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> state
are met, and, in addition, the user agent estimates that data is
being fetched at a rate where the <a href=#current-playback-position>current playback
- position</a>, if it were to advance at the rate given by the
- <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
- attribute, would not overtake the available data before playback
- reaches the end of the <a href=#media-resource>media resource</a>.</dd>
+ position</a>, if it were to advance at the <a href=#effective-playback-rate>effective
+ playback rate</a>, would not overtake the available data before
+ playback reaches the end of the <a href=#media-resource>media resource</a>.</dd>
</dl><div class=impl>
@@ -27470,6 +27503,14 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
normal playback mode, it is expected that the rate of playback
will be returned to the default rate of playback.</p>
+<!--CONTROLLER-->
+ <p>When the element has a <a href=#current-media-controller>current media controller</a>,
+ the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
+ attribute is ignored and the <a href=#current-media-controller>current media
+ controller</a>'s <code title=dom-MediaController-defaultPlaybackRate><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code>
+ is used instead.</p>
+<!--CONTROLLER-->
+
</dd>
<dt><var title="">media</var> . <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> [ = <var title="">value</var> ]</dt>
@@ -27480,6 +27521,14 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<p>Can be set, to change the rate of playback.</p>
+<!--CONTROLLER-->
+ <p>When the element has a <a href=#current-media-controller>current media controller</a>,
+ the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>
+ attribute is ignored and the <a href=#current-media-controller>current media
+ controller</a>'s <code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> is
+ used instead.</p>
+<!--CONTROLLER-->
+
</dd>
<dt><var title="">media</var> . <code title=dom-media-played><a href=#dom-media-played>played</a></code></dt>
@@ -27531,22 +27580,46 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
playback has not <a href=#stopped-due-to-errors>stopped due to errors</a>,
<!--CONTROLLER-->
the element either has no <a href=#current-media-controller>current media controller</a> or
- has a <a href=#current-media-controller>current media controller</a> that is itself not a
- <a href=#blocked-media-controller>blocked media controller</a>,
+ has a <a href=#current-media-controller>current media controller</a> but is not <a href=#blocked-on-its-media-controller>blocked
+ on its media controller</a>,
<!--CONTROLLER-->
and the element is not a <a href=#blocked-media-element>blocked media element</a>.</p>
<p>A <a href=#media-element>media element</a> is said to have <dfn id=ended-playback>ended
- playback</dfn> when the element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater, and
- either the <a href=#current-playback-position>current playback position</a> is the end of the
- <a href=#media-resource>media resource</a> and the <a href=#direction-of-playback>direction of
- playback</a> is forwards and the <a href=#media-element>media element</a> does
- not have a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute
- specified, or the <a href=#current-playback-position>current playback position</a> is the
- <a href=#earliest-possible-position>earliest possible position</a> and the <a href=#direction-of-playback>direction of
- playback</a> is backwards.</p>
-
- <p>The <dfn id=dom-media-ended title=dom-media-ended><code>ended</code></dfn>
+ playback</dfn> when:</p>
+
+ <ul><li>The element's <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute is <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater,
+ and
+
+ <li>
+
+ <p>Either:
+
+ <ul><li>The <a href=#current-playback-position>current playback position</a> is the end of the
+ <a href=#media-resource>media resource</a>, and
+
+ <li>The <a href=#direction-of-playback>direction of playback</a> is forwards, and
+
+ <li>
+<!--CONTROLLER-->
+ Either
+<!--CONTROLLER-->
+ the <a href=#media-element>media element</a> does not have a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified,
+<!--CONTROLLER-->
+ or the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
+ controller</a>.
+<!--CONTROLLER-->
+
+ </ul><p>Or:
+
+ <ul><li>The <a href=#current-playback-position>current playback position</a> is the
+ <a href=#earliest-possible-position>earliest possible position</a>, and
+
+ <li>The <a href=#direction-of-playback>direction of playback</a> is backwards.
+
+ </ul></li>
+
+ </ul><p>The <dfn id=dom-media-ended title=dom-media-ended><code>ended</code></dfn>
attribute must return true if the <a href=#media-element>media element</a> has
<a href=#ended-playback>ended playback</a> and the <a href=#direction-of-playback>direction of
playback</a> is forwards, and false otherwise.</p>
@@ -27593,14 +27666,18 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
playback</a> is forwards, then the user agent must follow these
steps:</p>
- <ol><li><p>If the <a href=#media-element>media element</a> has a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest possible
- position</a> of the <a href=#media-resource>media resource</a> and abort these
- steps.</li> <!-- v2/v3: We should fire a 'looping' event here
- to explain why this immediately fires a 'playing' event, otherwise
- the 'playing' event that fires from the readyState going from
- HAVE_CURRENT_DATA back to HAVE_FUTURE_DATA will seem inexplicable
- (since the normally matching 'ended' given below event doesn't fire
- in the loop case). -->
+ <ol><li><p>If the <a href=#media-element>media element</a> has a <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified
+<!--CONTROLLER-->
+ and does not have a <a href=#current-media-controller>current media controller</a>,
+<!--CONTROLLER-->
+ then <a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest
+ possible position</a> of the <a href=#media-resource>media resource</a> and
+ abort these steps.</li> <!-- v2/v3: We should fire a 'looping'
+ event here to explain why this immediately fires a 'playing' event,
+ otherwise the 'playing' event that fires from the readyState going
+ from HAVE_CURRENT_DATA back to HAVE_FUTURE_DATA will seem
+ inexplicable (since the normally matching 'ended' given below event
+ doesn't fire in the loop case). -->
<li><p>Stop playback.<p class=note>The <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code> attribute becomes
true.</li>
@@ -27622,7 +27699,7 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<li><p>The user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire
a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</li>
- </ol><p>The <dfn id=dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
+ </ol><hr><p>The <dfn id=dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
attribute gives the desired speed at which the <a href=#media-resource>media
resource</a> is to play, as a multiple of its intrinsic
speed. The attribute is mutable: on getting it must return the last
@@ -27634,20 +27711,22 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
to the user">exposes a user interface to the user</a>.</p>
<p>The <dfn id=dom-media-playbackrate title=dom-media-playbackRate><code>playbackRate</code></dfn>
- attribute gives the speed at which the <a href=#media-resource>media resource</a>
- plays, as a multiple of its intrinsic speed. If it is not equal to
- the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>,
+ attribute gives the <a href=#effective-playback-rate>effective playback rate</a>
+<!--CONTROLLER-->
+ (assuming there is no <a href=#current-media-controller>current media controller</a> overriding it),
+<!--CONTROLLER-->
+ which is the speed at which the <a href=#media-resource>media resource</a> plays,
+ as a multiple of its intrinsic speed. If it is not equal to the
+ <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>,
then the implication is that the user is using a feature such as
fast forward or slow motion playback. The attribute is mutable: on
getting it must return the last value it was set to, or 1.0 if it
hasn't yet been set; on setting the attribute must be set to the new
- value, and the playback must change speed (if the element is
- <a href=#potentially-playing>potentially playing</a>).</p>
-
- <p>The <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> can
- be 0.0, in which case the <a href=#current-playback-position>current playback position</a>
- doesn't move, despite playback not being paused (<code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> doesn't become true, and the
- <code title=event-media-pause><a href=#event-media-pause>pause</a></code> event doesn't fire).</p>
+ value, and the playback will change speed
+<!--CONTROLLER-->
+ (if the element is <a href=#potentially-playing>potentially playing</a> and there is no
+ <a href=#current-media-controller>current media controller</a>).</p>
+<!--CONTROLLER-->
<p id=rateUpdate>When the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> or
<code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attributes
@@ -27657,7 +27736,16 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
event</a> named <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> at the <a href=#media-element>media
element</a>.</p>
- <p>The <dfn id=dom-media-played title=dom-media-played><code>played</code></dfn>
+<!--CONTROLLER-->
+ <p class=note>The <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> and
+ <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> attributes
+ have no effect when the <a href=#media-element>media element</a> has a
+ <a href=#current-media-controller>current media controller</a>; the namesake attributes on
+ the <code><a href=#mediacontroller>MediaController</a></code> object are used instead in that
+ situation.</p>
+<!--CONTROLLER-->
+
+ <hr><p>The <dfn id=dom-media-played title=dom-media-played><code>played</code></dfn>
attribute must return a new static <a href=#normalized-timeranges-object>normalized
<code>TimeRanges</code> object</a> that represents the ranges of
the <a href=#media-resource>media resource</a>, if any, that the user agent has so
@@ -27750,30 +27838,36 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
</ol><hr><p>The
<!--CONTROLLER-->
- <var title="">effective playback rate</var> is not necessarily the
- element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>.
- When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
- controller</a>, its <var title="">effective playback rate</var>
- is the element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> multiplied by the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate-multiplier>media controller playback rate
- multiplier</a>. Otherwise, the
+ <dfn id=effective-playback-rate>effective playback rate</dfn> is not necessarily the element's
+ <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>. When a
+ <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
+ controller</a>, its <a href=#effective-playback-rate>effective playback rate</a> is the
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller playback
+ rate</a>. Otherwise, the
+<!--CONTROLLER-->
+ <a href=#effective-playback-rate>effective playback rate</a> is just the element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>.
+<!--CONTROLLER-->
+ Thus, the <a href=#current-media-controller>current media controller</a> overrides the
+ <a href=#media-element>media element</a>.
<!--CONTROLLER-->
- <var title="">effective playback rate</var> is just the
- element's <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>.</p>
+ </p>
- <p>If the <var title="">effective playback rate</var> is positive or
- zero, then the <dfn id=direction-of-playback>direction of playback</dfn> is forwards.
- Otherwise, it is backwards.</p>
+ <p>If the <a href=#effective-playback-rate>effective playback rate</a> is positive or zero,
+ then the <dfn id=direction-of-playback>direction of playback</dfn> is forwards. Otherwise, it
+ is backwards.</p>
<p id=media-playback>When a <a href=#media-element>media element</a> is
<a href=#potentially-playing>potentially playing</a> and its <code><a href=#document>Document</a></code> is a
<a href=#fully-active>fully active</a> <code><a href=#document>Document</a></code>, its <a href=#current-playback-position>current
- playback position</a> must increase monotonically at <var title="">effective playback rate</var> units of media time per unit
- time of wall clock time.</p> <!--XXX will change with bug 12339 -->
-
- <p class=note>If the <var title="">effective playback rate</var>
- is zero, the <a href=#current-playback-position>current playback position</a> doesn't
- move.</p>
+ playback position</a> must increase monotonically at
+ <a href=#effective-playback-rate>effective playback rate</a> units of media time per unit time
+ of wall clock time.</p> <!--XXX will change with bug 12339 -->
+
+ <p class=note>The <a href=#effective-playback-rate>effective playback rate</a> can be 0.0,
+ in which case the <a href=#current-playback-position>current playback position</a> doesn't
+ move, despite playback not being paused (<code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> doesn't become true, and the
+ <code title=event-media-pause><a href=#event-media-pause>pause</a></code> event doesn't
+ fire).</p>
<p class=note>This specification doesn't define how the user agent
achieves the appropriate playback rate &mdash; depending on the
@@ -27785,23 +27879,29 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
interpolate any frames.</p>
<p>When the <a href=#direction-of-playback>direction of playback</a> is backwards, any
- corresponding audio must be muted. When the <var title="">effective
- playback rate</var> is so low or so high that the user agent cannot
- play audio usefully, the corresponding audio must also be muted. If
- the <var title="">effective playback rate</var> is not 1.0, the user
- agent may apply pitch adjustments to the audio as necessary to
- render it faithfully.</p>
+ corresponding audio must be muted. When the <a href=#effective-playback-rate>effective playback
+ rate</a> is so low or so high that the user agent cannot play
+ audio usefully, the corresponding audio must also be muted. If the
+ <a href=#effective-playback-rate>effective playback rate</a> is not 1.0, the user agent may
+ apply pitch adjustments to the audio as necessary to render it
+ faithfully.</p>
<p><a href=#media-element title="media element">Media elements</a> that are
<a href=#potentially-playing>potentially playing</a> while not <a href=#in-a-document>in a
<code>Document</code></a> must not play any video, but should
play any audio component. Media elements must not stop playing just
because all references to them have been removed; only once a media
- element to which no references exist has reached a point where no
- further audio remains to be played for that element (e.g. because
- the element is paused, or because the end of the clip has been
- reached, or because its <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code> is 0.0) may the
- element be garbage collected.</p>
+ element is in a state where no further audio could ever be played by
+ that element may the element be garbage collected.</p>
+
+<!--CONTROLLER-->
+ <p class=note>It is possible for an element to which no explicit
+ references exist to play audio, even if such an element is not still
+ actively playing: for instance, it could have a <a href=#current-media-controller>current media
+ controller</a> that still has references and can still be
+ unpaused, or it could be unpaused but stalled waiting for content to
+ buffer.</p>
+<!--CONTROLLER-->
<hr><p>When the <a href=#current-playback-position>current playback position</a> of a <a href=#media-element>media
element</a> changes (e.g. due to playback or seeking), the user
@@ -27838,14 +27938,14 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<!--KEEP-START w3c-html--><!--TT-->
<li><p>If the time was reached through the usual monotonic increase
- of the current playback position during normal playback, and if the
- user agent has not fired a <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event at the
+ of the <a href=#current-playback-position>current playback position</a> during normal
+ playback, and if the user agent has not fired a <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event at the
element in the past 15 to 250ms and is not still running event
handlers for such an event, then the user agent must <a href=#queue-a-task>queue a
- task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
- element. (In the other cases, such as explicit seeks, relevant
- events get fired as part of the overall process of changing the
- current playback position.)</p>
+ task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.
+ (In the other cases, such as explicit seeks, relevant events get
+ fired as part of the overall process of changing the <a href=#current-playback-position>current
+ playback position</a>.)</p>
<p class=note>The event thus is not to be fired faster than about
66Hz or slower than 4Hz (assuming the event handlers don't take
@@ -27864,11 +27964,11 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
steps.</li>
<li><p>If the time was reached through the usual monotonic increase
- of the current playback position during normal playback, and there
- are <a href=#text-track-cue title="text track cue">cues</a> in <var title="">other
- cues</var> that have both their <a href=#text-track-cue-active-flag>text track cue active
- flag</a> set and their <a href=#text-track-cue-pause-on-exit-flag>text track cue pause-on-exit
- flag</a> set, then immediately <a href=#dom-media-pause title=dom-media-pause>pause</a> the <a href=#media-element>media
+ of the <a href=#current-playback-position>current playback position</a> during normal
+ playback, and there are <a href=#text-track-cue title="text track cue">cues</a> in
+ <var title="">other cues</var> that have both their <a href=#text-track-cue-active-flag>text
+ track cue active flag</a> set and their <a href=#text-track-cue-pause-on-exit-flag>text track cue
+ pause-on-exit flag</a> set, then immediately <a href=#dom-media-pause title=dom-media-pause>pause</a> the <a href=#media-element>media
element</a>. <!-- "pause" can in theory call load(), but never
can it do so as part of this invokation, since we wouldn't be in
this algorithm if the media element was empty. So, no need to couch
@@ -28170,6 +28270,8 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
readonly attribute unsigned long <a href=#dom-tracklist-length title=dom-TrackList-length>length</a>;
DOMString <a href=#dom-tracklist-getname title=dom-TrackList-getName>getName</a>(in unsigned long index);
DOMString <a href=#dom-tracklist-getlanguage title=dom-TrackList-getLanguage>getLanguage</a>(in unsigned long index);
+
+ attribute <a href=#function>Function</a> <a href=#handler-tracklist-onchange title=handler-TrackList-onchange>onchange</a>;
};
interface <dfn id=multipletracklist>MultipleTrackList</dfn> : <a href=#tracklist>TrackList</a> {
@@ -28296,6 +28398,11 @@ interface <dfn id=exclusivetracklist>ExclusiveTrackList</dfn> : <a href=#trackli
index <var title="">index</var>, if there is one. If there is not,
it must instead throw an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+ <p>Whenever a track is enabled or disabled, the user agent must
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-media-change>change</code> at the
+ <code><a href=#multipletracklist>MultipleTrackList</a></code> object.</p>
+
<hr><p>An <code><a href=#exclusivetracklist>ExclusiveTrackList</a></code> object represents a track list
where exactly one track is selected at a time.</p>
@@ -28309,6 +28416,24 @@ interface <dfn id=exclusivetracklist>ExclusiveTrackList</dfn> : <a href=#trackli
track was previously selected. If there is no track with index <var title="">index</var>, it must instead throw an
<code><a href=#index_size_err>INDEX_SIZE_ERR</a></code> exception.</p>
+ <p>Whenever the selected track is changed, the user agent must
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
+ <code title=event-media-change>change</code> at the
+ <code><a href=#multipletracklist>MultipleTrackList</a></code> object.</p>
+
+ <hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
+ corresponding <a href=#event-handler-event-type title="event handler event type">event handler
+ event types</a>) that must be supported, as IDL attributes, by
+ all objects implementing the <code><a href=#tracklist>TrackList</a></code>
+ interface:</p>
+
+ <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
+ <tbody><tr><td><dfn id=handler-tracklist-onchange title=handler-TrackList-onchange><code>onchange</code></dfn> <td> <code title=event-change>change</code>
+ </table><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this section is the
+ <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
+
+ <!-- v2 should also fire an event when the list changes -->
+
</div>
@@ -28367,39 +28492,54 @@ interface <dfn id=exclusivetracklist>ExclusiveTrackList</dfn> : <a href=#trackli
any of its slaved <a href=#media-element title="media element">media elements</a>
unexpectedly stall, the others are stopped at the same time.</p>
- <div class=example>
+ <p>When a <a href=#media-element>media element</a> is slaved to a
+ <code><a href=#mediacontroller>MediaController</a></code>, its playback rate is fixed to that of
+ the other tracks in the same <code><a href=#mediacontroller>MediaController</a></code>, and any
+ looping is disabled.</p>
+
+<!-- v2: add control to loop, add control to playback rate
+ <div class="example">
<p>In this example, two audio elements are slaved to the same
(implicit) controller so that a waltz played by one audio element
is kept exactly synchronised to the "tick tock tock" sound of the
metronome played by the second element:</p>
- <pre>&lt;audio src="The%20Amelia%20Earhart%20Waltz.wav" controls autoplay mediagroup="song"&gt;&lt;/audio&gt;
-&lt;audio src="metronomes/3-4.wav" autoplay loop mediagroup="song"&gt;&lt;/audio&gt;</pre>
+ <pre>&lt;audio src="The%20Amelia%20Earhart%20Waltz.wav" controls autoplay mediagroup="song">&lt;/audio>
+&lt;audio src="metronomes/3-4.wav" autoplay loop mediagroup="song">&lt;/audio></pre>
<p>Assuming the song keeps a regular tempo throughout and assuming
the metronome has the same tempo, this works even though if the
metronome file only has one measure's worth of "tick tock tock",
- because the controller (implied by the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute)
+ because the controller (implied by the <code
+ title="attr-media-mediagroup">mediagroup</code> attribute)
guarantees that the two elements will be kept synchronised, even if
the user rewinds, jumps to a different part of the song, etc (the
- user agent controls made available by the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute on the song's
- <code><a href=#audio>audio</a></code> element affect the
- <code><a href=#mediacontroller>MediaController</a></code>'s state).</p>
+ user agent controls made available by the <code
+ title="attr-media-controls">controls</code> attribute on the song's
+ <code>audio</code> element affect the
+ <code>MediaController</code>'s state).</p>
<p>If the metronome has the wrong rate, its rate can be adjusted by
- script separately from the song's (using the <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>audio.playbackRate</a></code> IDL
- attribute). The two elements will play back their <a href=#media-data>media
- data</a> at different rates, but the ratio will again be
- controlled by the <code><a href=#mediacontroller>MediaController</a></code>.</p>
+ script separately from the song's (using the <code
+ title="dom-media-playbackRate">audio.playbackRate</code> IDL
+ attribute). The two elements will play back their <span>media
+ data</span> at different rates, but the ratio will again be
+ controlled by the <code>MediaController</code>.</p>
</div>
+-->
<h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers</h6>
<pre class=idl>[<a href=#dom-mediacontroller title=dom-MediaController>Constructor</a>]
interface <dfn id=mediacontroller>MediaController</dfn> {
+ readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-mediacontroller-buffered title=dom-MediaController-buffered>buffered</a>;
+ readonly attribute <a href=#timeranges>TimeRanges</a> <a href=#dom-mediacontroller-seekable title=dom-MediaController-seekable>seekable</a>;
+ readonly attribute double <a href=#dom-mediacontroller-duration title=dom-MediaController-duration>duration</a>;
+ attribute double <a href=#dom-mediacontroller-currenttime title=dom-MediaController-currentTime>currentTime</a>;
+
readonly attribute boolean <a href=#dom-mediacontroller-paused title=dom-MediaController-paused>paused</a>;
void <a href=#dom-mediacontroller-play title=dom-MediaController-play>play</a>();
void <a href=#dom-mediacontroller-pause title=dom-MediaController-pause>pause</a>();
@@ -28410,8 +28550,8 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
attribute double <a href=#dom-mediacontroller-volume title=dom-MediaController-volume>volume</a>;
attribute boolean <a href=#dom-mediacontroller-muted title=dom-MediaController-muted>muted</a>;
- void <a href=#dom-mediacontroller-seek title=dom-MediaController-seek>seek</a>(in double delta);
-
+ attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-ondurationchange title=handler-MediaController-ondurationchange>ondurationchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-ontimeupdate title=handler-MediaController-ontimeupdate>ontimeupdate</a>;
attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-onplay title=handler-MediaController-onplay>onplay</a>;
attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-onpause title=handler-MediaController-onpause>onpause</a>;
attribute <a href=#function>Function</a> <a href=#handler-mediacontroller-onratechange title=handler-MediaController-onratechange>onratechange</a>;
@@ -28438,6 +28578,51 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
</dd>
+ <dt><var title="">controller</var> . <code title=dom-MediaController-buffered><a href=#dom-mediacontroller-buffered>buffered</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the
+ intersection of the time ranges for which the user agent has all
+ relevant media data for all the slaved <a href=#media-element title="media
+ element">media elements</a>.</p>
+
+ </dd>
+
+ <dt><var title="">controller</var> . <code title=dom-MediaController-seekable><a href=#dom-mediacontroller-seekable>seekable</a></code></dt>
+
+ <dd>
+
+ <p>Returns a <code><a href=#timeranges>TimeRanges</a></code> object that represents the
+ intersection of the time ranges into which the user agent can seek
+ for all the slaved <a href=#media-element title="media element">media
+ elements</a>.</p>
+
+ </dd>
+
+ <dt><var title="">controller</var> . <code title=dom-MediaController-duration><a href=#dom-mediacontroller-duration>duration</a></code></dt>
+
+ <dd>
+
+ <p>Returns the difference between the earliest playable moment and
+ the latest playable moment (not considering whether the data in
+ question is actually buffered or directly seekable, but not
+ including time in the future for infinite streams). Will return
+ zero if there is no media.</p>
+
+ </dd>
+
+ <dt><var title="">controller</var> . <code title=dom-MediaController-currentTime><a href=#dom-mediacontroller-currenttime>currentTime</a></code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the <a href=#current-playback-position>current playback position</a>, in seconds,
+ as a position between zero time and the current <code title=dom-MediaController-duration><a href=#dom-mediacontroller-duration>duration</a></code>.</p>
+
+ <p>Can be set, to seek to the given time.<p>
+
+ </dd>
+
<dt><var title="">controller</var> . <code title=dom-MediaController-paused><a href=#dom-mediacontroller-paused>paused</a></code></dt>
<dd>
@@ -28470,28 +28655,24 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
<dd>
- <p>Returns the default multiplier of the rate of playback.</p>
+ <p>Returns the default rate of playback.</p>
- <p>Can be set, to change the default multiplier of the rate of
- playback.</p>
+ <p>Can be set, to change the default rate of playback.</p>
- <p>This default multiplier has no direct effect on playback, but
- if the user switches to a fast-forward mode, when they return to
- the normal playback mode, it is expected that rate of playback
- multiplier (<code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code>) will
- be returned to this default multiplier.</p>
+ <p>This default rate has no direct effect on playback, but if the
+ user switches to a fast-forward mode, when they return to the
+ normal playback mode, it is expected that rate of playback (<code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code>) will
+ be returned to this default rate.</p>
</dd>
<dt><var title="">controller</var> . <code title=dom-MediaController-playbackRate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> [ = <var title="">value</var> ]</dt>
<dd>
- <p>Returns the current multiplier of the rate playback, where 1.0
- is no multiplier.</p>
+ <p>Returns the current rate of playback.</p>
- <p>Can be set, to change the rate of playback of the <a href=#media-element title="media element">media elements</a> slaved to this
- controller.</p>
+ <p>Can be set, to change the rate of playback.</p>
</dd>
@@ -28523,30 +28704,104 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
</dd>
- <dt><var title="">controller</var> . <code title=dom-MediaController-seek><a href=#dom-mediacontroller-seek>seek</a></code>( <var title="">delta</var> )</dt>
-
- <dd>
-
- <p>Advances the <a href=#media-element title="media element">media elements</a>
- slaved to this controller by <var title="">delta</var> seconds,
- corrected to take into account their relative playback rates.</p>
-
- </dd>
-
</dl><div class=impl>
<p>A <a href=#media-element>media element</a> can have a <dfn id=current-media-controller>current media
controller</dfn>, which is a <code><a href=#mediacontroller>MediaController</a></code> object.
- The <dfn id=slaved-media-elements>slaved media elements</dfn> of a
+ When a <a href=#media-element>media element</a> is created without a <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, it does
+ not have a <a href=#current-media-controller>current media controller</a>. (If it is created
+ <em>with</em> such an attribute, then that attribute initializes the
+ <a href=#current-media-controller>current media controller</a>, as defined below.)</p>
+
+ <p>The <dfn id=slaved-media-elements>slaved media elements</dfn> of a
<code><a href=#mediacontroller>MediaController</a></code> are the <a href=#media-element title="media
element">media elements</a> whose <a href=#current-media-controller>current media
- controller</a> is that <code><a href=#mediacontroller>MediaController</a></code>.</p>
-
- <p>All the <a href=#slaved-media-elements>slaved media elements</a> of a
- <code><a href=#mediacontroller>MediaController</a></code> must use the same clock for their
- definition of their <a href=#media-timeline>media timeline</a>'s unit time.</p>
-
- <p>When a <code><a href=#mediacontroller>MediaController</a></code> is created it is a
+ controller</a> is that <code><a href=#mediacontroller>MediaController</a></code>. All the
+ <a href=#slaved-media-elements>slaved media elements</a> of a <code><a href=#mediacontroller>MediaController</a></code>
+ must use the same clock for their definition of their <a href=#media-timeline>media
+ timeline</a>'s unit time.</p>
+
+ <p>The <a href=#media-resource title="media resource">media resources</a> of all
+ the <a href=#slaved-media-elements>slaved media elements</a> of a
+ <code><a href=#mediacontroller>MediaController</a></code> have a defined temporal relationship
+ which provides relative offsets between the zero time of each such
+ <a href=#media-resource>media resource</a>: for <a href=#media-resource title="media resource">media
+ resources</a> with a <a href=#timeline-offset>timeline offset</a>, their relative
+ offsets are the difference between their <a href=#timeline-offset>timeline
+ offset</a>; the zero times of all the <a href=#media-resource title="media
+ resource">media resources</a> without a <a href=#timeline-offset>timeline
+ offset</a> are not offset from each other (i.e. the origins of
+ their timelines are cotemporal); and finally, the zero time of the
+ <a href=#media-resource>media resource</a> with the earliest <a href=#timeline-offset>timeline
+ offset</a> (if any) is not offset from the zero times of the
+ <a href=#media-resource title="media resource">media resources</a> without a
+ <a href=#timeline-offset>timeline offset</a> (i.e. the origins of <a href=#media-resource title="media
+ resource">media resources</a> without a <a href=#timeline-offset>timeline
+ offset</a> are further cotemporal with the earliest defined point
+ on the timeline of the <a href=#media-resource>media resource</a> with the earliest
+ <a href=#timeline-offset>timeline offset</a>).</p>
+
+ <p>The <dfn id=media-resource-end-position>media resource end position</dfn> of a <a href=#media-resource>media
+ resource</a> in a <a href=#media-element>media element</a> is defined as
+ follows: if the <a href=#media-resource>media resource</a> has a finite and known
+ duration, the <a href=#media-resource-end-position>media resource end position</a> is the
+ duration of the <a href=#media-resource>media resource</a>'s timeline (the last
+ defined position on that timeline); otherwise, the <a href=#media-resource>media
+ resource</a>'s duration is infinite or unknown, and the
+ <a href=#media-resource-end-position>media resource end position</a> is the time of the last
+ frame of <a href=#media-data>media data</a> currently available for that
+ <a href=#media-resource>media resource</a>.</p>
+
+ <p>Each <code><a href=#mediacontroller>MediaController</a></code> also has its own defined
+ timeline. On this timeline, all the <a href=#media-resource title="media
+ resource">media resources</a> of all the <a href=#slaved-media-elements>slaved media
+ elements</a> of the <code><a href=#mediacontroller>MediaController</a></code> are temporally
+ aligned according to their defined offsets. The <dfn id=media-controller-duration>media
+ controller duration</dfn> of that <code><a href=#mediacontroller>MediaController</a></code> is
+ the time from the earliest <a href=#earliest-possible-position>earliest possible position</a>,
+ relative to this <code><a href=#mediacontroller>MediaController</a></code> timeline, of any of
+ the <a href=#media-resource title="media resource">media resources</a> of the
+ <a href=#slaved-media-elements>slaved media elements</a> of the
+ <code><a href=#mediacontroller>MediaController</a></code>, to the time of the latest <a href=#media-resource-end-position>media
+ resource end position</a> of the <a href=#media-resource title="media
+ resource">media resources</a> of the <a href=#slaved-media-elements>slaved media
+ elements</a> of the <code><a href=#mediacontroller>MediaController</a></code>, again relative
+ to this <code><a href=#mediacontroller>MediaController</a></code> timeline.</p>
+
+ <p>Each <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-position>media controller
+ position</dfn>. This is the time on the
+ <code><a href=#mediacontroller>MediaController</a></code>'s timeline at which the user agent is
+ trying to play the <a href=#slaved-media-elements>slaved media elements</a>. When a
+ <code><a href=#mediacontroller>MediaController</a></code> is created, its <a href=#media-controller-position>media controller
+ position</a> is initially zero.</p>
+
+ <p>When the user agent is to <dfn id=bring-the-media-element-up-to-speed-with-its-new-media-controller title="bring the media element up
+ to speed with its new media controller">bring a media element up to
+ speed with its new media controller</dfn>, it must <a href=#dom-media-seek title=dom-media-seek>seek</a> that <a href=#media-element>media element</a>
+ to the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position>media controller
+ position</a> relative to the <a href=#media-element>media element</a>'s
+ timeline, discarding any resulting exceptions.</p>
+
+ <p>When the user agent is to <dfn id=seek-the-media-controller>seek the media controller</dfn> to
+ a particular <var title="">new playback position</var>, it must
+ follow these steps:</p>
+
+ <ol><li><p>If the <var title="">new playback position</var> is less
+ than zero, then set it to zero.</li>
+
+ <li><p>If the <var title="">new playback position</var> is greater
+ than the <a href=#media-controller-duration>media controller duration</a>, then set it to the
+ <a href=#media-controller-duration>media controller duration</a>.</li>
+
+ <li><p>Set the <a href=#media-controller-position>media controller position</a> to the <var title="">new playback position</var>.</li>
+
+ <li><p><a href=#dom-media-seek title=dom-media-seek>Seek</a> each <a href=#slaved-media-elements title="slaved media elements">slaved media element</a> to the
+ <var title="">new playback position</var> relative to the
+ <a href=#media-element>media element</a> timeline, discarding any resulting
+ exceptions.</li> <!-- i.e. "bring the media element up to speed
+ with its new media controller" -->
+
+ </ol><p>When a <code><a href=#mediacontroller>MediaController</a></code> is created it is a
<dfn id=playing-media-controller>playing media controller</dfn>. It can be changed into a
<dfn id=paused-media-controller>paused media controller</dfn> and back either via the user
agent's user interface (when the element is <a href=#expose-a-user-interface-to-the-user title="expose a
@@ -28560,28 +28815,88 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
media elements</a> are <a href=#blocked-media-element title="blocked media
element">blocked media elements</a>, or if any of its
<a href=#slaved-media-elements>slaved media elements</a> whose <a href=#autoplaying-flag>autoplaying
- flag</a> is true still have a <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute this is true.</p>
+ flag</a> is true still have a <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute that is true.</p>
- <p>A <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-default-playback-rate-multiplier>media controller
- default playback rate multiplier</dfn>, a <dfn id=media-controller-playback-rate-multiplier>media controller
- playback rate multiplier</dfn>, and a <dfn id=media-controller-volume-multiplier>media controller volume
- multiplier</dfn>, which must all be set to 1.0 when the
- <code><a href=#mediacontroller>MediaController</a></code> object is created. A
- <code><a href=#mediacontroller>MediaController</a></code> also has a <dfn id=media-controller-mute-override>media controller mute
- override</dfn>, much must initially be false.</p>
+ <p>A <a href=#media-element>media element</a> is <dfn id=blocked-on-its-media-controller>blocked on its media
+ controller</dfn> if the <code><a href=#mediacontroller>MediaController</a></code> is a
+ <a href=#blocked-media-controller>blocked media controller</a>, or if its <a href=#media-controller-position>media
+ controller position</a> is either before the <a href=#media-resource>media
+ resource</a>'s <a href=#earliest-possible-position>earliest possible position</a> relative
+ to the <code><a href=#mediacontroller>MediaController</a></code>'s timeline or after the end of
+ the <a href=#media-resource>media resource</a> relative to the
+ <code><a href=#mediacontroller>MediaController</a></code>'s timeline.</p>
+
+ <p>A <code><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-default-playback-rate>media controller
+ default playback rate</dfn>, a <dfn id=media-controller-playback-rate>media controller playback
+ rate</dfn>, and a <dfn id=media-controller-volume-multiplier>media controller volume multiplier</dfn>,
+ which must all be set to 1.0 when the <code><a href=#mediacontroller>MediaController</a></code>
+ object is created. A <code><a href=#mediacontroller>MediaController</a></code> also has a
+ <dfn id=media-controller-mute-override>media controller mute override</dfn>, much must initially be
+ false.</p>
+
+ <p id=controller-playback>When a <code><a href=#mediacontroller>MediaController</a></code> is
+ not a <a href=#blocked-media-controller>blocked media controller</a> and it has at least one
+ <a href=#slaved-media-elements title="slaved media elements">slaved media element</a>
+ whose <code><a href=#document>Document</a></code> is a <a href=#fully-active>fully active</a>
+ <code><a href=#document>Document</a></code>, the <code><a href=#mediacontroller>MediaController</a></code>'s
+ <a href=#media-controller-position>media controller position</a> must increase monotonically
+ at <a href=#media-controller-playback-rate>media controller playback rate</a> units of time on the
+ <code><a href=#mediacontroller>MediaController</a></code>'s timeline per unit time of the clock
+ used by its <a href=#slaved-media-elements>slaved media elements</a>.</p>
<hr><p>The <dfn id=dom-media-controller title=dom-media-controller><code>controller</code></dfn> attribute
on a <a href=#media-element>media element</a>, on getting, must return the
element's <a href=#current-media-controller>current media controller</a>, if any, or null
otherwise. On setting, it must first remove the element's <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, if any,
and then set the <a href=#current-media-controller>current media controller</a> to the given
value. If the given value is null, the element no longer has a
- <a href=#current-media-controller>current media controller</a>.</p>
+ <a href=#current-media-controller>current media controller</a>; if it is not null, then the
+ user agent must <a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller>bring the media element up to speed with its
+ new media controller</a>.</p>
<hr><p>The <dfn id=dom-mediacontroller title=dom-MediaController><code>MediaController()</code></dfn>
constructor, when invoked, must return a newly created
<code><a href=#mediacontroller>MediaController</a></code> object.</p>
+ <hr><p>The <dfn id=dom-mediacontroller-seekable title=dom-MediaController-seekable><code>seekable</code></dfn>
+ attribute must return a new static <a href=#normalized-timeranges-object>normalized
+ <code>TimeRanges</code> object</a> that represents the
+ intersection of the ranges of the <a href=#media-resource title="media resource">media
+ resources</a> of the <a href=#slaved-media-elements>slaved media elements</a> that the
+ user agent is able to seek to, at the time the attribute is
+ evaluated.</p>
+
+ <p>The <dfn id=dom-mediacontroller-buffered title=dom-MediaController-buffered><code>buffered</code></dfn>
+ attribute must return a new static <a href=#normalized-timeranges-object>normalized
+ <code>TimeRanges</code> object</a> that represents the
+ intersection of the ranges of the <a href=#media-resource title="media resource">media
+ resources</a> of the <a href=#slaved-media-elements>slaved media elements</a> that the
+ user agent has buffered, at the time the attribute is evaluated.
+ Users agents must accurately determine the ranges available, even
+ for media streams where this can only be determined by tedious
+ inspection.</p>
+
+ <p>The <dfn id=dom-mediacontroller-duration title=dom-MediaController-duration><code>duration</code></dfn>
+ attribute must return the <a href=#media-controller-duration>media controller
+ duration</a>.</p>
+
+ <p>Every 15 to 250ms, or whenever the <code><a href=#mediacontroller>MediaController</a></code>'s
+ <a href=#media-controller-duration>media controller duration</a> changes, whichever happens
+ least often, the user agent must <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> at the
+ <code><a href=#mediacontroller>MediaController</a></code>.</p>
+
+ <p>The <dfn id=dom-mediacontroller-currenttime title=dom-MediaController-currentTime><code>currentTime</code></dfn>
+ attribute must return the <a href=#media-controller-position>media controller position</a> on
+ getting, and on setting must <a href=#seek-the-media-controller>seek the media controller</a>
+ to the new value.</p>
+
+ <p>Every 15 to 250ms, or whenever the <code><a href=#mediacontroller>MediaController</a></code>'s
+ <a href=#media-controller-position>media controller position</a> changes, whichever happens
+ least often, the user agent must <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
+ <code><a href=#mediacontroller>MediaController</a></code>.</p>
+
<hr><p>The <dfn id=dom-mediacontroller-paused title=dom-MediaController-paused><code>paused</code></dfn>
attribute must return true if the <code><a href=#mediacontroller>MediaController</a></code>
object is a <a href=#paused-media-controller>paused media controller</a>, and false
@@ -28611,22 +28926,22 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
<hr><p>The <dfn id=dom-mediacontroller-defaultplaybackrate title=dom-MediaController-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
attribute, on getting, must return the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate-multiplier>media controller default
- playback rate multiplier</a>, and on setting, must set the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate-multiplier>media controller default
- playback rate multiplier</a> to the new value.</p>
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate>media controller default
+ playback rate</a>, and on setting, must set the
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate>media controller default
+ playback rate</a> to the new value.</p>
<p>The <dfn id=dom-mediacontroller-playbackrate title=dom-MediaController-playbackRate><code>playbackRate</code></dfn>
attribute, on getting, must return the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate-multiplier>media controller playback rate
- multiplier</a>, and on setting, must set the
- <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate-multiplier>media controller playback rate
- multiplier</a> to the new value.</p>
-
- <p>Whenever the <a href=#media-controller-default-playback-rate-multiplier>media controller default playback rate
- multiplier</a> or the <a href=#media-controller-playback-rate-multiplier>media controller playback rate
- multiplier</a> are changed, the user agent must <a href=#queue-a-task>queue a
- task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> at the
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller playback
+ rate</a>, and on setting, must set the
+ <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate>media controller playback
+ rate</a> to the new value.</p>
+
+ <p>Whenever the <a href=#media-controller-default-playback-rate>media controller default playback rate</a>
+ or the <a href=#media-controller-playback-rate>media controller playback rate</a> are changed, the
+ user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+ event</a> named <code title=event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> at the
<code><a href=#mediacontroller>MediaController</a></code>.</p>
<hr><p>The <dfn id=dom-mediacontroller-volume title=dom-MediaController-volume><code>volume</code></dfn>
@@ -28652,55 +28967,21 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
<a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> at the
<code><a href=#mediacontroller>MediaController</a></code>.</p>
- <hr><p>The <dfn id=dom-mediacontroller-seek title=dom-MediaController-seek><code>seek()</code></dfn> method
- must run the following steps for each <a href=#slaved-media-elements title="slaved media
- elements">slaved media element</a>, if any:</p>
-
- <ol><li><p>Let <var title="">delta</var> be the method's argument.</li>
-
- <li><p>Let <var title="">element</var> be the <a href=#slaved-media-elements title="slaved
- media elements">slaved media element</a> being processed in this
- iteration.</li>
-
- <li><p>Let <var title="">effective delta</var> be <var title="">delta</var> multiplied by the value of <var title="">element</var>'s <code title=dom-media-playbackRate><a href=#dom-media-playbackrate>playbackRate</a></code>
- attribute.</li>
-
- <li><p>Let <var title="">new position</var> be <var title="">element</var>'s <a href=#current-playback-position>current playback position</a> (in
- seconds) plus <var title="">effective delta</var>.</li>
-
- <li><p>Let <var title="">duration</var> be the difference between
- <var title="">element</var>'s <a href=#earliest-possible-position>earliest possible
- position</a> (in seconds) and the time at the end of <var title="">element</var>'s <a href=#media-data>media data</a> (in
- seconds).</li>
-
- <li>
-
- <p>If <var title="">element</var>'s <code title=attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute is not specified,
- then skip this step. Otherwise:</p>
-
- <p>While <var title="">new position</var> is greater than the time
- at the end of <var title="">element</var>'s <a href=#media-data>media
- data</a> (in seconds), decrement <var title="">new
- position</var> by <var title="">duration</var>.</p>
-
- <p>While <var title="">new position</var> is less than <var title="">element</var>'s <a href=#earliest-possible-position>earliest possible position</a>
- (in seconds), increment <var title="">new position</var> by <var title="">duration</var>.</p>
-
- </li>
-
- <li><p><a href=#dom-media-seek title=dom-media-seek>Seek</a> <var title="">element</var> to <var title="">new position</var>
- (interpreted as a time in seconds).</li>
-
- </ol><hr><p>The following are the <a href=#event-handlers>event handlers</a> that must be
+ <hr><p>The following are the <a href=#event-handlers>event handlers</a> that must be
supported, as IDL attributes, by all objects implementing the
<code><a href=#mediacontroller>MediaController</a></code> interface:</p>
<table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-mediacontroller-onplay title=handler-MediaController-onplay><code>onplay</code></dfn> <td> <code title=event-play>play</code>
+ <tbody><tr><td><dfn id=handler-mediacontroller-ondurationchange title=handler-MediaController-ondurationchange><code>ondurationchange</code></dfn> <td> <code title=event-durationchange>durationchange</code>
+ <tr><td><dfn id=handler-mediacontroller-ontimeupdate title=handler-MediaController-ontimeupdate><code>ontimeupdate</code></dfn> <td> <code title=event-durationchange>durationchange</code>
+ <tr><td><dfn id=handler-mediacontroller-onplay title=handler-MediaController-onplay><code>onplay</code></dfn> <td> <code title=event-play>play</code>
<tr><td><dfn id=handler-mediacontroller-onpause title=handler-MediaController-onpause><code>onpause</code></dfn> <td> <code title=event-pause>pause</code>
<tr><td><dfn id=handler-mediacontroller-onratechange title=handler-MediaController-onratechange><code>onratechange</code></dfn> <td> <code title=event-ratechange>ratechange</code>
<tr><td><dfn id=handler-mediacontroller-onvolumechange title=handler-MediaController-onvolumechange><code>onvolumechange</code></dfn> <td> <code title=event-volumechange>volumechange</code>
- </table></div>
+ </table><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this section is the
+ <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
+
+ </div>
<h6 id=assigning-a-media-controller-declaratively><span class=secno>4.8.10.11.3 </span>Assigning a media controller declaratively</h6>
@@ -28747,6 +29028,9 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
<li><p>Let <var title="">m</var>'s <a href=#current-media-controller>current media
controller</a> be <var title="">controller</var>.</li>
+ <li><p><a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller>Bring the media element up to speed with its new media
+ controller</a>.</li>
+
</ol><p>The <dfn id=dom-media-mediagroup title=dom-media-mediaGroup><code>mediaGroup</code></dfn> IDL
attribute on <a href=#media-element title="media element">media elements</a> must
<a href=#reflect>reflect</a> the <code title=attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> content
@@ -28817,7 +29101,7 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
element</a>, in <a href=#tree-order>tree order</a>.</li>
<li>Any <a href=#text-track title="text track">text tracks</a> added using
- the <code title=dom-media-addTrack><a href=#dom-media-addtrack>addTrack()</a></code> method, in
+ the <code title=dom-media-addTextTrack><a href=#dom-media-addtexttrack>addTextTrack()</a></code> method, in
the order they were added, oldest first.</li>
<li>Any <a href=#media-resource-specific-text-track title="media-resource-specific text
@@ -29878,7 +30162,8 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
void <a href=#dom-mutabletexttrack-removecue title=dom-MutableTextTrack-removeCue>removeCue</a>(in <a href=#texttrackcue>TextTrackCue</a> cue);
};</pre>
- <dl class=domintro><dt><var title="">mutableTextTrack</var> = <var title="">media</var> . <code title=dom-media-addTrack><a href=#dom-media-addtrack>addTrack</a></code>( <var title="">kind</var> [, <var title="">label</var> [, <var title="">language</var> ] ] )</dt>
+ <dl class=domintro><dt><var title="">mutableTextTrack</var> = <var title="">media</var> . <code title=dom-media-addTextTrack><a href=#dom-media-addtexttrack>addTextTrack</a></code>( <var title="">kind</var> [, <var title="">label</var> [, <var title="">language</var> ] ] )</dt>
+
<dd>
<p>Creates and returns a new <code><a href=#mutabletexttrack>MutableTextTrack</a></code> object, which is also added to the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>.</p>
</dd>
@@ -29897,7 +30182,7 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
</dl><div class=impl>
- <p>The <dfn id=dom-media-addtrack title=dom-media-addTrack><code>addTrack(<var title="">kind</var>, <var title="">label</var>, <var title="">language</var>)</code></dfn> method of <a href=#media-element title="media
+ <p>The <dfn id=dom-media-addtexttrack title=dom-media-addTextTrack><code>addTextTrack(<var title="">kind</var>, <var title="">label</var>, <var title="">language</var>)</code></dfn> method of <a href=#media-element title="media
element">media elements</a>, when invoked, must run the following
steps:</p>
@@ -30014,7 +30299,8 @@ interface <dfn id=mediacontroller>MediaController</dfn> {
able to run the script at the exact time specified.</p>
<pre>var sfx = new Audio('sfx.wav');
-var sounds = a.addTrack('metadata');
+var sounds = a.addTextTrack('metadata');
+
// add sounds we care about
sounds.addCue(new TextTrackCue('dog bark', 12.783, 13.612, '', '', '', true));
sounds.addCue(new TextTrackCue('kitten mew', 13.612, 15.091, '', '', '', true));
@@ -32057,6 +32343,19 @@ interface <dfn id=texttrackcue>TextTrackCue</dfn> {
the user (e.g. full-screen video or in an independent resizable
window). Other controls may also be made available.</p>
+<!--CONTROLLER-->
+ <p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
+ controller</a>, then the user agent should expose audio tracks
+ from all the <a href=#slaved-media-elements>slaved media elements</a> (although avoiding
+ duplicates if the same <a href=#media-resource>media resource</a> is being used
+ several times). If a <a href=#media-resource>media resource</a>'s audio track
+ exposed in this way has no known name, and it is the only audio
+ track for a particular <a href=#media-element>media element</a>, the user agent
+ should use the element's <code title=attr-title><a href=#the-title-attribute>title</a></code>
+ attribute, if any, as the name (or as part of the name) of that
+ track.</p>
+<!--CONTROLLER-->
+
<p>Even when the attribute is absent, however, user agents may
provide controls to affect playback of the media resource
(e.g. play, pause, seeking, and volume controls), but such features
@@ -32077,12 +32376,12 @@ interface <dfn id=texttrackcue>TextTrackCue</dfn> {
<!--CONTROLLER-->
<p>When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
- controller</a>, the user agent must implement its user interface
- for pausing and unpausing playback, for seeking, for changing the
- rate of playback, for fast-forwarding or rewinding, and for muting
- or changing the volume of audio must be implemented specifically in
- terms of the <code><a href=#mediacontroller>MediaController</a></code> API exposed on that
- <a href=#current-media-controller>current media controller</a>.</p>
+ controller</a>, the user agent's user interface for pausing and
+ unpausing playback, for seeking, for changing the rate of playback,
+ for fast-forwarding or rewinding, and for muting or changing the
+ volume of audio must be implemented specifically in terms of the
+ <code><a href=#mediacontroller>MediaController</a></code> API exposed on that <a href=#current-media-controller>current media
+ controller</a>.</p>
<!--CONTROLLER-->
<p>The "play" function in the user agent's interface must set the
@@ -32113,7 +32412,7 @@ interface <dfn id=texttrackcue>TextTrackCue</dfn> {
<!--CONTROLLER-->
<p>When a <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
- controller</a>, seeking must be implemented in terms of the <code title=dom-MediaController-seek><a href=#dom-mediacontroller-seek>seek()</a></code> method on that
+ controller</a>, seeking must be implemented in terms of the <code title=dom-MediaController-seek>seek()</code> method on that
<code><a href=#mediacontroller>MediaController</a></code> object. Otherwise, the user agent must
directly <a href=#dom-media-seek title=dom-media-seek>seek</a> to the requested
position in the <a href=#media-element>media element</a>'s <a href=#media-timeline>media
@@ -32447,20 +32746,20 @@ interface <dfn id=texttrackcue>TextTrackCue</dfn> {
<td><code><a href=#event>Event</a></code>
<td>The <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute changed to false.
<td>
- <tr><td><dfn id=event-media-timeupdate title=event-media-timeupdate><code>timeupdate</code></dfn>
- <td><code><a href=#event>Event</a></code>
- <td>The <a href=#current-playback-position>current playback position</a> changed as part of normal playback or in an especially interesting way, for example discontinuously.
- <td>
<tr><td><dfn id=event-media-ended title=event-media-ended><code>ended</code></dfn>
<td><code><a href=#event>Event</a></code>
<td>Playback has stopped because the end of the <a href=#media-resource>media resource</a> was reached.
<td><code title=dom-media-currentTime><a href=#dom-media-currenttime>currentTime</a></code> equals the end of the <a href=#media-resource>media resource</a>; <code title=dom-media-ended><a href=#dom-media-ended>ended</a></code> is true.
- <tr><td><dfn id=event-media-durationchange title=event-media-durationchange><code>durationchange</code></dfn>
+
+ <tbody><tr><td><dfn id=event-media-durationchange title=event-media-durationchange><code>durationchange</code></dfn>
<td><code><a href=#event>Event</a></code>
<td>The <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute has just been updated.
<td>
-
- <tbody><tr><td><dfn id=event-media-play title=event-media-play><code>play</code></dfn>
+ <tr><td><dfn id=event-media-timeupdate title=event-media-timeupdate><code>timeupdate</code></dfn>
+ <td><code><a href=#event>Event</a></code>
+ <td>The <a href=#current-playback-position>current playback position</a> changed as part of normal playback or in an especially interesting way, for example discontinuously.
+ <td>
+ <tr><td><dfn id=event-media-play title=event-media-play><code>play</code></dfn>
<td><code><a href=#event>Event</a></code>
<td>Playback has begun. Fired after the <code title=dom-media-play><a href=#dom-media-play>play()</a></code> method has returned, or when the <code title=attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute has caused playback to begin.