HTML Standard Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/6018

File a bug

SVNBugCommentTime (UTC)
6018[Gecko] [Internet Explorer] [Opera] [Webkit] Rework MediaController so that it exposes more events so that you can keep track of the overall state.2011-04-20 00:42
Index: source
===================================================================
--- source	(revision 6017)
+++ source	(revision 6018)
@@ -28629,6 +28629,11 @@
 
     <ol>
 
+     <li><p><span>Queue a task</span> to <span>fire a simple
+     event</span> named <code
+     title="event-media-emptied">emptied</code> at the <span>media
+     element</span>.</p></li>
+
      <li><p>If a fetching process is in progress for the <span>media
      element</span>, the user agent should stop it.</p></li>
 
@@ -28645,7 +28650,9 @@
      <li><p>If <code title="dom-media-readyState">readyState</code> is
      not set to <code
      title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>, then set it
-     to that state.</p></li>
+     to that state.
+     <!-- this can do the "report the controller state" thing -->
+     </p></li>
 
      <li><p>If the <code title="dom-media-paused">paused</code>
      attribute is false, then set it to true.</p></li>
@@ -28683,11 +28690,6 @@
 
      </li>
 
-     <li><p><span>Queue a task</span> to <span>fire a simple
-     event</span> named <code
-     title="event-media-emptied">emptied</code> at the <span>media
-     element</span>.</p></li>
-
     </ol>
 
    </li>
@@ -29235,27 +29237,27 @@
 
        </li>
 
-       <li><p>Set the <code
-       title="dom-media-readyState">readyState</code> attribute to
-       <code
-       title="dom-media-HAVE_METADATA">HAVE_METADATA</code>.</p></li>
-
        <li><p>For <code>video</code> elements, set the <code
        title="dom-video-videoWidth">videoWidth</code> and <code
        title="dom-video-videoHeight">videoHeight</code>
        attributes.</p></li>
 
-       <li id="fire-loadedmetadata">
+       <li>
 
-        <p><span>Queue a task</span> to <span>fire a simple
-        event</span> named <code
-        title="event-media-loadedmetadata">loadedmetadata</code> at the
-        element.</p>
+        <p>Set the <code
+        title="dom-media-readyState">readyState</code> attribute to
+        <code
+        title="dom-media-HAVE_METADATA">HAVE_METADATA</code>.</p>
 
-        <p class="note">Before this task is run, as part of the event
-        loop mechanism, the rendering will have been updated to resize
-        the <code>video</code> element if appropriate.</p>
+        <p class="note">A <code
+        title="event-media-loadedmetadata">loadedmetadata</code> DOM
+        event <a href="#fire-loadedmetadata">will be fired</a> as part
+        of setting the <code
+        title="dom-media-readyState">readyState</code> attribute to a
+        new value.</p>
 
+        <!-- this can also do the "report the controller state" thing -->
+
        </li>
 
        <li>
@@ -29277,37 +29279,19 @@
        </li>
 
 <!--END w3c-html--><!--CONTROLLER-->
-       <li>
+       <li><p>If either the <span>media resource</span> or the address
+       of the <var title="">current media resource</var> indicate a
+       particular set of audio or video tracks to enable, then the
+       selected audio tracks must be enabled in the element's <code
+       title="dom-media-audioTracks">audioTracks</code> object, and
+       the first selected video track must be selected in the
+       element's <code
+       title="dom-media-videoTracks">videoTracks</code>
+       object.</p></li>
 
-        <p>If either the <span>media resource</span> or the address of
-        the <var title="">current media resource</var> indicate a
-        particular set of audio or video tracks to enable, then the
-        selected audio tracks must be enabled in the element's <code
-        title="dom-media-audioTracks">audioTracks</code> object, and
-        the first selected video track must be selected in the
-        element's <code
-        title="dom-media-videoTracks">videoTracks</code> object.</p>
-
-       </li>
-
-       <li>
-
-        <p>If the <span>media element</span> has a <span>current
-        media controller</span>, then: if the <span>initial playback
-        position</span>, relative to the <span>current media
-        controller</span>'s timeline, is greater than the
-        <span>current media controller</span>'s <span>media controller
-        position</span>, then <span>seek the media controller</span>
-        to the <span>media element</span>'s <span>initial playback
-        position</span>, relative to the <span>current media
-        controller</span>'s timeline; otherwise, <span
-        title="dom-media-seek">seek</span> the <span>media
-        element</span> to the <span>media controller position</span>,
-        relative to the <span>media element</span>'s timeline,
-        discarding any resulting exceptions.</p> <!-- i.e. "bring the
-        media element up to speed with its new media controller" -->
-
-       </li>
+       <li><p>If the <span>media element</span> has a <span>current
+       media controller</span>, then <span>bring the media element up
+       to speed with its new media controller</span>.</p>
 <!--START w3c-html--><!--CONTROLLER-->
 
        <li>
@@ -30083,125 +30067,158 @@
   title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> changes, the
   user agent must follow the steps given below:</p>
 
-  <dl class="switch">
+  <ol>
 
-   <!-- going up to metadata -->
-   <dt>If the previous ready state was <code
-   title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>, and the new
-   ready state is <code
-   title="dom-media-HAVE_METADATA">HAVE_METADATA</code></dt>
+   <li>
 
-   <dd>
+    <p>Apply the first applicable set of substeps from the following
+    list:</p>
 
-    <p class="note">A <code
-    title="event-media-loadedmetadata">loadedmetadata</code> DOM event <a
-    href="#fire-loadedmetadata">will be fired</a> as part of the <code
-    title="dom-media-load">load()</code> algorithm.</p>
 
-   </dd>
+    <dl class="switch">
 
-   <!-- going up to current for the first time -->
+     <!-- going up to metadata -->
+     <dt>If the previous ready state was <code
+     title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>, and the new
+     ready state is <code
+     title="dom-media-HAVE_METADATA">HAVE_METADATA</code></dt>
 
-   <dt id="handling-first-frame-available">If the previous ready state
-   was <code title="dom-media-HAVE_METADATA">HAVE_METADATA</code> and
-   the new ready state is <code
-   title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or
-   greater</dt>
+     <dd id="fire-loadedmetadata">
 
-   <dd>
+      <p><span>Queue a task</span> to <span>fire a simple event</span>
+      named <code
+      title="event-media-loadedmetadata">loadedmetadata</code> at the
+      element.</p>
 
-    <p id="fire-loadeddata">If this is the first time this occurs for
-    this <span>media element</span> since the <code
-    title="dom-media-load">load()</code> algorithm was last invoked,
-    the user agent must <span>queue a task</span> to <span>fire a
-    simple event</span> named <code
-    title="event-media-loadeddata">loadeddata</code> at the element.</p>
+      <p class="note">Before this task is run, as part of the event
+      loop mechanism, the rendering will have been updated to resize
+      the <code>video</code> element if appropriate.</p>
 
-    <p>If the new ready state is <code
-    title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code> or
-    <code title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</code>,
-    then the relevant steps below must then be run also.</p>
+     </dd>
 
-   </dd>
+     <!-- going up to current for the first time -->
 
-   <!-- going down -->
-   <dt>If the previous ready state was <code
-   title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code> or more,
-   and the new ready state is <code
-   title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or
-   less</dt>
+     <dt id="handling-first-frame-available">If the previous ready state
+     was <code title="dom-media-HAVE_METADATA">HAVE_METADATA</code> and
+     the new ready state is <code
+     title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or
+     greater</dt>
 
-   <dd>
+     <dd>
 
-    <p class="note">A <code title="event-media-waiting">waiting</code> DOM
-    event <a href="#fire-waiting-when-waiting">can be fired</a>,
-    depending on the current state of playback.</p>
+      <p id="fire-loadeddata">If this is the first time this occurs for
+      this <span>media element</span> since the <code
+      title="dom-media-load">load()</code> algorithm was last invoked,
+      the user agent must <span>queue a task</span> to <span>fire a
+      simple event</span> named <code
+      title="event-media-loadeddata">loadeddata</code> at the element.</p>
 
-   </dd>
+      <p>If the new ready state is <code
+      title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code> or
+      <code title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</code>,
+      then the relevant steps below must then be run also.</p>
 
-   <!-- going up to future -->
-   <dt>If the previous ready state was <code
-   title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or
-   less, and the new ready state is <code
-   title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code></dt>
+     </dd>
 
-   <dd>
+     <!-- going down -->
+     <dt>If the previous ready state was <code
+     title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code> or more,
+     and the new ready state is <code
+     title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or
+     less</dt>
 
-    <p>The user agent must <span>queue a task</span> to <span>fire a
-    simple event</span> named <code
-    title="event-media-canplay">canplay</code>.</p>
+     <dd>
 
-    <p>If the element's <code title="dom-media-paused">paused</code>
-    attribute is false, the user agent must <span>queue a task</span>
-    to <span>fire a simple event</span> named <code
-    title="event-media-playing">playing</code>.</p>
+      <p id="fire-waiting-when-waiting">If the <span>media
+      element</span> was <span>potentially playing</span> before its
+      <code title="dom-media-readyState">readyState</code> attribute
+      changed to a value lower than <code
+      title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>, and
+      the element has not <span>ended playback</span>, and playback
+      has not <span>stopped due to errors</span>, and playback has not
+      <span>paused for user interaction</span>, the user agent must
+      <span>queue a task</span> to <span>fire a simple event</span>
+      named <code title="event-media-timeupdate">timeupdate</code> at
+      the element, and <span>queue a task</span> to <span>fire a
+      simple event</span> named <code
+      title="event-media-waiting">waiting</code> at the element.</p>
 
-   </dd>
+     </dd>
 
-   <!-- going up to enough -->
-   <dt>If the new ready state is <code
-   title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</code></dt>
+     <!-- going up to future -->
+     <dt>If the previous ready state was <code
+     title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or
+     less, and the new ready state is <code
+     title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code></dt>
 
-   <dd>
+     <dd>
 
-    <p>If the previous ready state was <code
-    title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or
-    less, the user agent must <span>queue a task</span> to <span>fire
-    a simple event</span> named <code
-    title="event-media-canplay">canplay</code>, and, if the element's
-    <code title="dom-media-paused">paused</code> attribute is false,
-    <span>queue a task</span> to <span>fire a simple event</span>
-    named <code title="event-media-playing">playing</code>.</p>
+      <p>The user agent must <span>queue a task</span> to <span>fire a
+      simple event</span> named <code
+      title="event-media-canplay">canplay</code>.</p>
 
-    <p>If the <span>autoplaying flag</span> is true, and the <code
-    title="dom-media-paused">paused</code> attribute is true, and the
-    <span>media element</span> has an <code
-    title="attr-media-autoplay">autoplay</code> attribute specified,
-    and the <span>media element</span>'s <code>Document</code>'s
-    <span>browsing context</span> did not have the <span>sandboxed
-    automatic features browsing context flag</span> set when the
-    <code>Document</code> was created, then the user agent may also
-    set the <code title="dom-media-paused">paused</code> attribute to
-    false, <span>queue a task</span> to <span>fire a simple
-    event</span> named <code title="event-media-play">play</code>, and
-    <span>queue a task</span> to <span>fire a simple event</span>
-    named <code title="event-media-playing">playing</code>.</p>
+      <p>If the element's <code title="dom-media-paused">paused</code>
+      attribute is false, the user agent must <span>queue a task</span>
+      to <span>fire a simple event</span> named <code
+      title="event-media-playing">playing</code>.</p>
 
-    <p class="note">User agents do not need to support autoplay,
-    and it is suggested that user agents honor user preferences on the
-    matter. Authors are urged to use the <code
-    title="attr-media-autoplay">autoplay</code> attribute rather than
-    using script to force the video to play, so as to allow the user
-    to override the behavior if so desired.</p>
+     </dd>
 
-    <p>In any case, the user agent must finally <span>queue a
-    task</span> to <span>fire a simple event</span> named <code
-    title="event-media-canplaythrough">canplaythrough</code>.</p>
+     <!-- going up to enough -->
+     <dt>If the new ready state is <code
+     title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</code></dt>
 
-   </dd>
+     <dd>
 
-  </dl>
+      <p>If the previous ready state was <code
+      title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or
+      less, the user agent must <span>queue a task</span> to <span>fire
+      a simple event</span> named <code
+      title="event-media-canplay">canplay</code>, and, if the element's
+      <code title="dom-media-paused">paused</code> attribute is false,
+      <span>queue a task</span> to <span>fire a simple event</span>
+      named <code title="event-media-playing">playing</code>.</p>
 
+      <p>If the <span>autoplaying flag</span> is true, and the <code
+      title="dom-media-paused">paused</code> attribute is true, and the
+      <span>media element</span> has an <code
+      title="attr-media-autoplay">autoplay</code> attribute specified,
+      and the <span>media element</span>'s <code>Document</code>'s
+      <span>browsing context</span> did not have the <span>sandboxed
+      automatic features browsing context flag</span> set when the
+      <code>Document</code> was created, then the user agent may also
+      set the <code title="dom-media-paused">paused</code> attribute to
+      false, <span>queue a task</span> to <span>fire a simple
+      event</span> named <code title="event-media-play">play</code>, and
+      <span>queue a task</span> to <span>fire a simple event</span>
+      named <code title="event-media-playing">playing</code>.</p>
+
+      <p class="note">User agents do not need to support autoplay,
+      and it is suggested that user agents honor user preferences on the
+      matter. Authors are urged to use the <code
+      title="attr-media-autoplay">autoplay</code> attribute rather than
+      using script to force the video to play, so as to allow the user
+      to override the behavior if so desired.</p>
+
+      <p>In any case, the user agent must finally <span>queue a
+      task</span> to <span>fire a simple event</span> named <code
+      title="event-media-canplaythrough">canplaythrough</code>.</p>
+
+     </dd>
+
+    </dl>
+
+   </li>
+
+<!--END w3c-html--><!--CONTROLLER-->
+   <li><p>If the <span>media element</span> has a <span>current media
+   controller</span>, then <span>report the controller state</span>
+   for the <span>media element</span>'s <span>current media
+   controller</span>.</p></li>
+<!--START w3c-html--><!--CONTROLLER-->
+
+  </ol>
+
   </div>
 
   <p class="note">It is possible for the ready state of a media
@@ -30443,7 +30460,19 @@
   <code title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</code> and
   the user agent has reached a point in the <span>media
   resource</span> where the user has to make a selection for the
-  resource to continue.</p>
+  resource to continue.
+<!--END w3c-html--><!--CONTROLLER-->
+  If the <span>media element</span> has a <span>current media
+  controller</span> when this happens, then the user agent must
+  <span>report the controller state</span> for the <span>media
+  element</span>'s <span>current media controller</span>. If If the
+  <span>media element</span> has a <span>current media
+  controller</span> when the user makes a selection, allowing playback
+  to resume, the user agent must similarly <span>report the controller
+  state</span> for the <span>media element</span>'s <span>current
+  media controller</span>.
+<!--START w3c-html--><!--CONTROLLER-->
+  </p>
 
   <p>It is possible for a <span>media element</span> to have both
   <span>ended playback</span> and <span>paused for user
@@ -30455,20 +30484,13 @@
   <span>fire a simple event</span> named <code
   title="event-media-timeupdate">timeupdate</code> at the element.</p>
 
-  <p id="fire-waiting-when-waiting">When a <span>media element</span>
-  that is <span>potentially playing</span> stops playing because its
-  <code title="dom-media-readyState">readyState</code> attribute
-  changes to a value lower than <code
-  title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>, without
-  the element having <span>ended playback</span>, or playback having
-  <span>stopped due to errors</span>, or playback having <span>paused
-  for user interaction</span>, or the <span
-  title="dom-media-seek">seeking algorithm</span> being invoked, the
-  user agent must <span>queue a task</span> to <span>fire a simple
-  event</span> named <code title="event-media-timeupdate">timeupdate</code>
-  at the element, and <span>queue a task</span> to <span>fire a simple
-  event</span> named <code title="event-media-waiting">waiting</code> at
-  the element.</p>
+  <p class="note">A <code title="event-media-waiting">waiting</code>
+  DOM event <a href="#fire-waiting-when-waiting">can be fired</a> as a
+  result of an element that is <span>potentially playing</span>
+  stopping playback due to its <code
+  title="dom-media-readyState">readyState</code> attribute changing to
+  a value lower than <code
+  title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>.</p>
 
   <p>When the <span>current playback position</span> reaches the end
   of the <span>media resource</span> when the <span>direction of
@@ -30660,6 +30682,13 @@
    <li><p>Set the <span>media element</span>'s <span>autoplaying
    flag</span> to false.</p></li>
 
+<!--END w3c-html--><!--CONTROLLER-->
+   <li><p>If the <span>media element</span> has a <span>current media
+   controller</span>, then <span>report the controller state</span>
+   for the <span>media element</span>'s <span>current media
+   controller</span>.</p></li>
+<!--START w3c-html--><!--CONTROLLER-->
+
   </ol>
 
   <hr>
@@ -30704,6 +30733,13 @@
 
    </li>
 
+<!--END w3c-html--><!--CONTROLLER-->
+   <li><p>If the <span>media element</span> has a <span>current media
+   controller</span>, then <span>report the controller state</span>
+   for the <span>media element</span>'s <span>current media
+   controller</span>.</p></li>
+<!--START w3c-html--><!--CONTROLLER-->
+
   </ol>
 
   <hr>
@@ -31053,31 +31089,35 @@
    <code title="dom-media-seeking">seeking</code> IDL attribute to
    false and abort these steps.</p></li>
 
-   <li><p>Set the <span>current playback position</span> to the given
-   <var title="">new playback position</var>.</p></li>
-
    <li><p><span>Queue a task</span> to <span>fire a simple
    event</span> named <code title="event-media-seeking">seeking</code>
    at the element.</p></li>
 
-   <li id="seekUpdate"><p><span>Queue a task</span> to <span>fire a
-   simple event</span> named <code
-   title="event-media-timeupdate">timeupdate</code> at the
-   element.</p></li>
+   <li>
 
-   <li><p>If the <span>media element</span> was <span>potentially
-   playing</span> immediately before it started seeking, but seeking
-   caused its <code title="dom-media-readyState">readyState</code>
-   attribute to change to a value lower than <code
-   title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>, then
-   <span>queue a task</span> to <span>fire a simple event</span> named
-   <code title="event-media-waiting">waiting</code> at the
-   element.</p></li>
+    <p>Set the <span>current playback position</span> to the given
+    <var title="">new playback position</var>.</p>
 
+    <p class="note">If the <span>media element</span> was
+    <span>potentially playing</span> immediately before it started
+    seeking, but seeking caused its <code
+    title="dom-media-readyState">readyState</code> attribute to change
+    to a value lower than <code
+    title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>, then a
+    <code title="event-media-waiting">waiting</code> <a
+    href="#fire-waiting-when-waiting">will be fired</a> at the
+    element.</p> <!-- also, timeupdate -->
+    <!-- also, it will do the "report the controller state" thing -->
+
+   </li>
+
    <li><p>Wait until the user agent has established whether or not the
    <span>media data</span> for the <var title="">new playback
    position</var> is available, and, if it is, until it has decoded
-   enough data to play back that position.</p></li>
+   enough data to play back that position.</p>
+   <!-- at which point, it will do the "port the controller state"
+   thing again -->
+   </li>
 
    <li><p><span>Await a stable state</span>. The <span>synchronous
    section</span> consists of all the remaining steps of this
@@ -31088,6 +31128,11 @@
    title="dom-media-seeking">seeking</code> IDL attribute to
    false.</p></li>
 
+   <li id="seekUpdate"><p><span>Queue a task</span> to <span>fire a
+   simple event</span> named <code
+   title="event-media-timeupdate">timeupdate</code> at the
+   element.</p></li>
+
    <li><p>&#x231B; <span>Queue a task</span> to <span>fire a simple
    event</span> named <code title="event-media-seeked">seeked</code>
    at the element.</p></li>
@@ -31511,6 +31556,14 @@
            attribute double <span title="dom-MediaController-volume">volume</span>;
            attribute boolean <span title="dom-MediaController-muted">muted</span>;
 
+           attribute <span>Function</span> <span title="handler-MediaController-onemptied">onemptied</span>;
+           attribute <span>Function</span> <span title="handler-MediaController-onloadedmetadata">onloadedmetadata</span>;
+           attribute <span>Function</span> <span title="handler-MediaController-onloadeddata">onloadeddata</span>;
+           attribute <span>Function</span> <span title="handler-MediaController-oncanplay">oncanplay</span>;
+           attribute <span>Function</span> <span title="handler-MediaController-oncanplaythrough">oncanplaythrough</span>;
+           attribute <span>Function</span> <span title="handler-MediaController-onplaying">onplaying</span>;
+           attribute <span>Function</span> <span title="handler-MediaController-onwaiting">onwaiting</span>;
+
            attribute <span>Function</span> <span title="handler-MediaController-ondurationchange">ondurationchange</span>;
            attribute <span>Function</span> <span title="handler-MediaController-ontimeupdate">ontimeupdate</span>;
            attribute <span>Function</span> <span title="handler-MediaController-onplay">onplay</span>;
@@ -31690,6 +31743,180 @@
   must use the same clock for their definition of their <span>media
   timeline</span>'s unit time.</p>
 
+  <hr>
+
+  <p>The <dfn
+  title="dom-media-controller"><code>controller</code></dfn> attribute
+  on a <span>media element</span>, on getting, must return the
+  element's <span>current media controller</span>, if any, or null
+  otherwise. On setting, it must first remove the element's <code
+  title="attr-media-mediagroup">mediagroup</code> attribute, if any,
+  and then set the <span>current media controller</span> to the given
+  value. If the given value is null, the element no longer has a
+  <span>current media controller</span>; if it is not null, then the
+  user agent must <span>bring the media element up to speed with its
+  new media controller</span>.</p>
+
+  <hr>
+
+  <p>The <dfn
+  title="dom-MediaController"><code>MediaController()</code></dfn>
+  constructor, when invoked, must return a newly created
+  <code>MediaController</code> object.</p>
+
+  <hr>
+
+  <p>The <dfn
+  title="dom-MediaController-seekable"><code>seekable</code></dfn>
+  attribute must return a new static <span>normalized
+  <code>TimeRanges</code> object</span> that represents the
+  intersection of the ranges of the <span title="media resource">media
+  resources</span> of the <span>slaved media elements</span> that the
+  user agent is able to seek to, at the time the attribute is
+  evaluated.</p>
+
+  <p>The <dfn
+  title="dom-MediaController-buffered"><code>buffered</code></dfn>
+  attribute must return a new static <span>normalized
+  <code>TimeRanges</code> object</span> that represents the
+  intersection of the ranges of the <span title="media resource">media
+  resources</span> of the <span>slaved media elements</span> 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
+  title="dom-MediaController-duration"><code>duration</code></dfn>
+  attribute must return the <span>media controller
+  duration</span>.</p>
+
+  <p>Every 15 to 250ms, or whenever the <code>MediaController</code>'s
+  <span>media controller duration</span> changes, whichever happens
+  least often, the user agent must <span>queue a task</span> to
+  <span>fire a simple event</span> named <code
+  title="event-MediaController-durationchange">durationchange</code>
+  at the <code>MediaController</code>. If the
+  <code>MediaController</code>'s <span>media controller
+  duration</span> decreases such that the <span>media controller
+  position</span> is greater than the <span>media controller
+  duration</span>, the user agent must immediately <span>seek the
+  media controller</span> to <span>media controller
+  duration</span>.</p>
+
+  <p>The <dfn
+  title="dom-MediaController-currentTime"><code>currentTime</code></dfn>
+  attribute must return the <span>media controller position</span> on
+  getting, and on setting must <span>seek the media controller</span>
+  to the new value.</p>
+
+  <p>Every 15 to 250ms, or whenever the <code>MediaController</code>'s
+  <span>media controller position</span> changes, whichever happens
+  least often, the user agent must <span>queue a task</span> to
+  <span>fire a simple event</span> named <code
+  title="event-MediaController-timeupdate">timeupdate</code> at the
+  <code>MediaController</code>.</p>
+
+  <hr>
+
+  <p>When a <code>MediaController</code> is created it is a
+  <dfn>playing media controller</dfn>. It can be changed into a
+  <dfn>paused media controller</dfn> and back either via the user
+  agent's user interface (when the element is <span title="expose a
+  user interface to the user">exposing a user interface to the
+  user</span>) or by script using the APIs defined in this section
+  (see below).</p>
+
+  <p>The <dfn
+  title="dom-MediaController-paused"><code>paused</code></dfn>
+  attribute must return true if the <code>MediaController</code>
+  object is a <span>paused media controller</span>, and false
+  otherwise.</p>
+
+  <p>When the <dfn
+  title="dom-MediaController-pause"><code>pause()</code></dfn> method
+  is invoked, if the <code>MediaController</code> is a <span>playing
+  media controller</span> then the user agent must change the
+  <code>MediaController</code> into a <span>paused media
+  controller</span>, <span>queue a task</span> to <span>fire a simple
+  event</span> named <code
+  title="event-MediaController-pause">pause</code> at the
+  <code>MediaController</code>, and then <span>report the controller
+  state</span> of the <code>MediaController</code>.</p>
+
+  <p>When the <dfn
+  title="dom-MediaController-play"><code>play()</code></dfn> method is
+  invoked, if the <code>MediaController</code> is a <span>paused media
+  controller</span>, the user agent must change the
+  <code>MediaController</code> into a <span>playing media
+  controller</span>, <span>queue a task</span> to <span>fire a simple
+  event</span> named <code
+  title="event-MediaController-play">play</code> at the
+  <code>MediaController</code>, and then <span>report the controller
+  state</span> of the <code>MediaController</code>.</p>
+
+  <hr>
+
+  <p>A <code>MediaController</code> has a <dfn>media controller
+  default playback rate</dfn> and a <dfn>media controller playback
+  rate</dfn>, which must both be set to 1.0 when the
+  <code>MediaController</code> object is created.</p>
+
+  <p>The <dfn
+  title="dom-MediaController-defaultPlaybackRate"><code>defaultPlaybackRate</code></dfn>
+  attribute, on getting, must return the
+  <code>MediaController</code>'s <span>media controller default
+  playback rate</span>, and on setting, must set the
+  <code>MediaController</code>'s <span>media controller default
+  playback rate</span> to the new value, then <span>queue a
+  task</span> to <span>fire a simple event</span> named <code
+  title="event-MediaController-ratechange">ratechange</code> at the
+  <code>MediaController</code>.</p>
+
+  <p>The <dfn
+  title="dom-MediaController-playbackRate"><code>playbackRate</code></dfn>
+  attribute, on getting, must return the
+  <code>MediaController</code>'s <span>media controller playback
+  rate</span>, and on setting, must set the
+  <code>MediaController</code>'s <span>media controller playback
+  rate</span> to the new value, then <span>queue a task</span> to
+  <span>fire a simple event</span> named <code
+  title="event-MediaController-ratechange">ratechange</code> at the
+  <code>MediaController</code>.</p>
+
+  <hr>
+
+  <p>A <code>MediaController</code> has a <dfn>media controller volume
+  multiplier</dfn>, which must be set to 1.0 when the
+  <code>MediaController</code> object is created, and a <dfn>media
+  controller mute override</dfn>, much must initially be false.</p>
+
+  <p>The <dfn
+  title="dom-MediaController-volume"><code>volume</code></dfn>
+  attribute, on getting, must return the
+  <code>MediaController</code>'s <span>media controller volume
+  multiplier</span>, and on setting, if the new value is in the range
+  0.0 to 1.0 inclusive, must set the <code>MediaController</code>'s
+  <span>media controller volume multiplier</span> to the new value and
+  <span>queue a task</span> to <span>fire a simple event</span> named
+  <code title="event-MediaController-volumechange">volumechange</code>
+  at the <code>MediaController</code>. If the new value is outside the
+  range 0.0 to 1.0 inclusive, then, on setting, an
+  <code>INDEX_SIZE_ERR</code> exception must be raised instead.</p>
+
+  <p>The <dfn
+  title="dom-MediaController-muted"><code>muted</code></dfn>
+  attribute, on getting, must return the
+  <code>MediaController</code>'s <span>media controller mute
+  override</span>, and on setting, must set the
+  <code>MediaController</code>'s <span>media controller mute
+  override</span> to the new value and <span>queue a task</span> to
+  <span>fire a simple event</span> named <code
+  title="event-MediaController-volumechange">volumechange</code> at
+  the <code>MediaController</code>.</p>
+
+  <hr>
+
   <p>The <span title="media resource">media resources</span> of all
   the <span>slaved media elements</span> of a
   <code>MediaController</code> have a defined temporal relationship
@@ -31777,14 +32004,6 @@
 
   </ol>
 
-  <p>When a <code>MediaController</code> is created it is a
-  <dfn>playing media controller</dfn>. It can be changed into a
-  <dfn>paused media controller</dfn> and back either via the user
-  agent's user interface (when the element is <span title="expose a
-  user interface to the user">exposing a user interface to the
-  user</span>) or via the APIs defined in this section (see
-  below).</p>
-
   <p>A <code>MediaController</code> is a <dfn>blocked media
   controller</dfn> if the <code>MediaController</code> is a
   <span>paused media controller</span>, or if any of its <span>slaved
@@ -31803,14 +32022,6 @@
   the <span>media resource</span> relative to the
   <code>MediaController</code>'s timeline.</p>
 
-  <p>A <code>MediaController</code> has a <dfn>media controller
-  default playback rate</dfn>, a <dfn>media controller playback
-  rate</dfn>, and a <dfn>media controller volume multiplier</dfn>,
-  which must all be set to 1.0 when the <code>MediaController</code>
-  object is created. A <code>MediaController</code> also has a
-  <dfn>media controller mute override</dfn>, much must initially be
-  false.</p>
-
   <p id="controller-playback">When a <code>MediaController</code> is
   not a <span>blocked media controller</span> and it has at least one
   <span title="slaved media elements">slaved media element</span>
@@ -31821,161 +32032,119 @@
   <code>MediaController</code>'s timeline per unit time of the clock
   used by its <span>slaved media elements</span>.</p>
 
-  <hr>
+  <p>When the zero point on the timeline of a
+  <code>MediaController</code> moves relative to the timelines of the
+  <span>slaved media elements</span> by a time difference <var
+  title="">&#x0394;T</var>, the <code>MediaController</code>'s
+  <span>media controller position</span> must be decremented by <var
+  title="">&#x0394;T</var>.</p>
 
-  <p>The <dfn
-  title="dom-media-controller"><code>controller</code></dfn> attribute
-  on a <span>media element</span>, on getting, must return the
-  element's <span>current media controller</span>, if any, or null
-  otherwise. On setting, it must first remove the element's <code
-  title="attr-media-mediagroup">mediagroup</code> attribute, if any,
-  and then set the <span>current media controller</span> to the given
-  value. If the given value is null, the element no longer has a
-  <span>current media controller</span>; if it is not null, then the
-  user agent must <span>bring the media element up to speed with its
-  new media controller</span>.</p>
+  <p class="note">In some situations, e.g. when playing back a live
+  stream without buffering anything, the <span>media controller
+  position</span> would increase motonically as described above at the
+  same rate as the <var title="">&#x0394;T</var> described in the
+  previous paragraph decreases it, with the end result that for all
+  intents and purposes, the <span>media controller position</span>
+  would appear to remain constant (probably with the value 0).</p>
 
   <hr>
 
-  <p>The <dfn
-  title="dom-MediaController"><code>MediaController()</code></dfn>
-  constructor, when invoked, must return a newly created
-  <code>MediaController</code> object.</p>
+  <p>A <code>MediaController</code> has a <dfn>most recently reported
+  readiness state</dfn>, which is a number from 0 to 4 derived from
+  the numbers used for the <span>media element</span> <code
+  title="attr-media-readyState">readyState</code> attribute, and a
+  <dfn>most recently reported playback state</dfn>, which is either
+  <i>playing</i> or <i>waiting</i>.</p>
 
-  <hr>
+  <p>When a <code>MediaController</code> is created, its <span>most
+  recently reported readiness state</span> must be set to 0, and its
+  <span>most recently reported playback state</span> must be set to
+  <i>waiting</i>.</p>
 
-  <p>The <dfn
-  title="dom-MediaController-seekable"><code>seekable</code></dfn>
-  attribute must return a new static <span>normalized
-  <code>TimeRanges</code> object</span> that represents the
-  intersection of the ranges of the <span title="media resource">media
-  resources</span> of the <span>slaved media elements</span> that the
-  user agent is able to seek to, at the time the attribute is
-  evaluated.</p>
+  <p>When a user agent is required to <dfn>report the controller
+  state</dfn> for a <code>MediaController</code>, the user agent must
+  run the following steps:</p>
 
-  <p>The <dfn
-  title="dom-MediaController-buffered"><code>buffered</code></dfn>
-  attribute must return a new static <span>normalized
-  <code>TimeRanges</code> object</span> that represents the
-  intersection of the ranges of the <span title="media resource">media
-  resources</span> of the <span>slaved media elements</span> 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>
+  <ol>
 
-  <p>The <dfn
-  title="dom-MediaController-duration"><code>duration</code></dfn>
-  attribute must return the <span>media controller
-  duration</span>.</p>
+   <li>
 
-  <p>Every 15 to 250ms, or whenever the <code>MediaController</code>'s
-  <span>media controller duration</span> changes, whichever happens
-  least often, the user agent must <span>queue a task</span> to
-  <span>fire a simple event</span> named <code
-  title="event-MediaController-durationchange">durationchange</code> at the
-  <code>MediaController</code>.</p>
+    <p>If the <code>MediaController</code> has no <span>slaved media
+    elements</span>, let <var title="">new readiness state</var> be
+    0.</p>
 
-  <p>The <dfn
-  title="dom-MediaController-currentTime"><code>currentTime</code></dfn>
-  attribute must return the <span>media controller position</span> on
-  getting, and on setting must <span>seek the media controller</span>
-  to the new value.</p>
+    <p>Otherwise, let it have the lowest value of the <code
+    title="dom-media-readyState">readyState</code> IDL attributes of
+    all of its <span>slaved media elements</span>.</p>
 
-  <p>Every 15 to 250ms, or whenever the <code>MediaController</code>'s
-  <span>media controller position</span> changes, whichever happens
-  least often, the user agent must <span>queue a task</span> to
-  <span>fire a simple event</span> named <code
-  title="event-MediaController-timeupdate">timeupdate</code> at the
-  <code>MediaController</code>.</p>
+   </li>
 
-  <hr>
+   <li>
 
-  <p>The <dfn
-  title="dom-MediaController-paused"><code>paused</code></dfn>
-  attribute must return true if the <code>MediaController</code>
-  object is a <span>paused media controller</span>, and false
-  otherwise.</p>
+    <p>If the <code>MediaController</code>'s <span>most recently
+    reported readiness state</span> is not equal to <var title="">new
+    readiness state</var> then <span>queue a task</span> to <span>fire
+    a simple event</span> at the <code>MediaController</code> object,
+    whose name is the event name corresponding to the value of <var
+    title="">new readiness state</var> given in the table below:</p>
+    <!-- hopefully everyone will understand what this means -->
 
-  <p>When the <dfn
-  title="dom-MediaController-pause"><code>pause()</code></dfn> method
-  is invoked, the user agent must change the
-  <code>MediaController</code> into a <span>paused media
-  controller</span>.</p>
+    <table>
+     <thead>
+      <tr>
+       <th>Value of <var title="">new readiness state</var>
+       <th>Event name
 
-  <p>Whenever the <code>MediaController</code> changes from a
-  <span>playing media controller</span> to a <span>paused media
-  controller</span>, the user agent must <span>queue a task</span> to
-  <span>fire a simple event</span> named <code
-  title="event-MediaController-pause">pause</code> at the
-  <code>MediaController</code>.</p>
+     <tbody>
+      <tr>
+       <td> 0
+       <td> <code title="event-MediaController-emptied">emptied</code>
 
-  <p>When the <dfn
-  title="dom-MediaController-play"><code>play()</code></dfn> method
-  is invoked, the user agent must change the
-  <code>MediaController</code> into a <span>playing media
-  controller</span>.</p>
+      <tr>
+       <td> 1
+       <td> <code title="event-MediaController-loadedmetadata">loadedmetadata</code>
 
-  <p>Whenever the <code>MediaController</code> changes from a
-  <span>paused media controller</span> to a <span>playing media
-  controller</span>, the user agent must <span>queue a task</span> to
-  <span>fire a simple event</span> named <code
-  title="event-MediaController-play">play</code> at the
-  <code>MediaController</code>.</p>
+      <tr>
+       <td> 2
+       <td> <code title="event-MediaController-loadeddata">loadeddata</code>
 
-  <hr>
+      <tr>
+       <td> 3
+       <td> <code title="event-MediaController-canplay">canplay</code>
 
-  <p>The <dfn
-  title="dom-MediaController-defaultPlaybackRate"><code>defaultPlaybackRate</code></dfn>
-  attribute, on getting, must return the
-  <code>MediaController</code>'s <span>media controller default
-  playback rate</span>, and on setting, must set the
-  <code>MediaController</code>'s <span>media controller default
-  playback rate</span> to the new value.</p>
+      <tr>
+       <td> 4
+       <td> <code title="event-MediaController-canplaythrough">canplaythrough</code>
 
-  <p>The <dfn
-  title="dom-MediaController-playbackRate"><code>playbackRate</code></dfn>
-  attribute, on getting, must return the
-  <code>MediaController</code>'s <span>media controller playback
-  rate</span>, and on setting, must set the
-  <code>MediaController</code>'s <span>media controller playback
-  rate</span> to the new value.</p>
+    </table>
 
-  <p>Whenever the <span>media controller default playback rate</span>
-  or the <span>media controller playback rate</span> are changed, the
-  user agent must <span>queue a task</span> to <span>fire a simple
-  event</span> named <code
-  title="event-MediaController-ratechange">ratechange</code> at the
-  <code>MediaController</code>.</p>
+   </li>
 
-  <hr>
+   <li><p>Let the <code>MediaController</code>'s <span>most recently
+   reported readiness state</span> be <var title="">new readiness
+   state</var>.</p></li>
 
-  <p>The <dfn
-  title="dom-MediaController-volume"><code>volume</code></dfn>
-  attribute, on getting, must return the
-  <code>MediaController</code>'s <span>media controller volume
-  multiplier</span>, and on setting, if the new value is in the range
-  0.0 to 1.0 inclusive, must set the <code>MediaController</code>'s
-  <span>media controller volume multiplier</span> to the new value. If
-  the new value is outside the range 0.0 to 1.0 inclusive, then, on
-  setting, an <code>INDEX_SIZE_ERR</code> exception must be raised
-  instead.</p>
+   <li><p>If the <code>MediaController</code> has no <span>slaved
+   media elements</span>, or the <code>MediaController</code> is a
+   <span>blocked media controller</span>, let <var title="">new
+   playback state</var> be false; otherwise, let it be true.</p></li>
 
-  <p>The <dfn
-  title="dom-MediaController-muted"><code>muted</code></dfn>
-  attribute, on getting, must return the
-  <code>MediaController</code>'s <span>media controller mute
-  override</span>, and on setting, must set the
-  <code>MediaController</code>'s <span>media controller mute
-  override</span> to the new value.</p>
+   <li><p>If the <code>MediaController</code>'s <span>most recently
+   reported playback state</span> is not equal to <var title="">new
+   playback state</var> then <span>queue a task</span> to <span>fire a
+   simple event</span> at the <code>MediaController</code> object,
+   whose name is <code
+   title="event-MediaController-playing">playing</code> if <var
+   title="">new playback state</var> is true, and whose name is <code
+   title="event-MediaController-waiting">waiting</code>
+   otherwise.</p></li>
 
-  <p>Whenever either the <span>media controller volume
-  multiplier</span> or the <span>media controller mute override</span>
-  are changed, the user agent must <span>queue a task</span> to
-  <span>fire a simple event</span> named <code
-  title="event-MediaController-volumechange">volumechange</code> at the
-  <code>MediaController</code>.</p>
+   <li><p>Let the <code>MediaController</code>'s <span>most recently
+   reported playback state</span> be <var title="">new playback
+   state</var>.</p></li>
 
+  </ol>
+
   <hr>
 
   <p>The following are the <span>event handlers</span> that must be
@@ -31986,6 +32155,14 @@
    <thead>
     <tr><th><span title="event handlers">Event handler</span> <th><span>Event handler event type</span>
    <tbody>
+    <tr><td><dfn title="handler-MediaController-onemptied"><code>onemptied</code></dfn> <td> <code title="event-MediaController-emptied">emptied</code>
+    <tr><td><dfn title="handler-MediaController-onloadedmetadata"><code>onloadedmetadata</code></dfn> <td> <code title="event-MediaController-loadedmetadata">loadedmetadata</code>
+    <tr><td><dfn title="handler-MediaController-onloadeddata"><code>onloadeddata</code></dfn> <td> <code title="event-MediaController-loadeddata">loadeddata</code>
+    <tr><td><dfn title="handler-MediaController-oncanplay"><code>oncanplay</code></dfn> <td> <code title="event-MediaController-canplay">canplay</code>
+    <tr><td><dfn title="handler-MediaController-oncanplaythrough"><code>oncanplaythrough</code></dfn> <td> <code title="event-MediaController-canplaythrough">canplaythrough</code>
+    <tr><td><dfn title="handler-MediaController-onplaying"><code>onplaying</code></dfn> <td> <code title="event-MediaController-playing">playing</code>
+    <tr><td><dfn title="handler-MediaController-onwaiting"><code>onwaiting</code></dfn> <td> <code title="event-MediaController-waiting">waiting</code>
+   <tbody>
     <tr><td><dfn title="handler-MediaController-ondurationchange"><code>ondurationchange</code></dfn> <td> <code title="event-MediaController-durationchange">durationchange</code>
     <tr><td><dfn title="handler-MediaController-ontimeupdate"><code>ontimeupdate</code></dfn> <td> <code title="event-MediaController-durationchange">durationchange</code>
     <tr><td><dfn title="handler-MediaController-onplay"><code>onplay</code></dfn> <td> <code title="event-MediaController-play">play</code>
@@ -36475,6 +36652,36 @@
 
    <tbody>
     <tr>
+     <td><dfn title="event-MediaController-emptied"><code>emptied</code></dfn>
+     <td><code>Event</code>
+     <td>All the <span>slaved media elements</span> newly have <code title="dom-media-readyState">readyState</code> set to <code title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code> or greater, or there are no longer any <span>slaved media elements</span>.
+    <tr>
+     <td><dfn title="event-MediaController-loadedmetadata"><code>loadedmetadata</code></dfn>
+     <td><code>Event</code>
+     <td>All the <span>slaved media elements</span> newly have <code title="dom-media-readyState">readyState</code> set to <code title="dom-media-HAVE_METADATA">HAVE_METADATA</code> or greater.
+    <tr>
+     <td><dfn title="event-MediaController-loadeddata"><code>loadeddata</code></dfn>
+     <td><code>Event</code>
+     <td>All the <span>slaved media elements</span> newly have <code title="dom-media-readyState">readyState</code> set to <code title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code> or greater.
+    <tr>
+     <td><dfn title="event-MediaController-canplay"><code>canplay</code></dfn>
+     <td><code>Event</code>
+     <td>All the <span>slaved media elements</span> newly have <code title="dom-media-readyState">readyState</code> set to <code title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code> or greater.
+    <tr>
+     <td><dfn title="event-MediaController-canplaythrough"><code>canplaythrough</code></dfn>
+     <td><code>Event</code>
+     <td>All the <span>slaved media elements</span> newly have <code title="dom-media-readyState">readyState</code> set to <code title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</code> or greater.
+    <tr>
+     <td><dfn title="event-MediaController-playing"><code>playing</code></dfn>
+     <td><code>Event</code>
+     <td>The <code>MediaController</code> is no longer a <span>blocked media controller</span>.
+    <tr>
+     <td><dfn title="event-MediaController-waiting"><code>waiting</code></dfn>
+     <td><code>Event</code>
+     <td>The <code>MediaController</code> is now a <span>blocked media controller</span>.
+
+   <tbody>
+    <tr>
      <td><dfn title="event-MediaController-durationchange"><code>durationchange</code></dfn>
      <td><code>Event</code>
      <td>The <code title="dom-MediaController-duration">duration</code> attribute has just been updated.

|