Fix a variety of issues with how media playback works when playbackRate is backwards. (whatwg r3012)

Fix a variety of issues with how media playback works when playbackRate
is backwards. (whatwg r3012)

When a media element that is potentially playing stops playing because its readyState attribute changes to a value lower than HAVE_FUTURE_DATA, without the element having ended playback, or playback having stopped due to errors, or playback having paused for user interaction, or the seeking algorithm being invoked, the user agent must queue a task to fire a simple event called timeupdate at the element, and queue a task to fire a simple event called waiting at the element.
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#fire-waiting-when-waiting
HAVE_ENOUGH_DATA
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#dom-media-have_enough_data
stopped due to errors
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#stopped-due-to-errors
HAVE_CURRENT_DATA
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#dom-media-have_current_data
defaultPlaybackRate
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#dom-media-defaultplaybackrate
playbackRate
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#dom-media-playbackrate
HAVE_FUTURE_DATA
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#dom-media-have_future_data
ended
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#dom-media-ended
direction of playback
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#direction-of-playback
potentially playing
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#potentially-playing
ended playback
http://people.w3.org/mike/diffs/html5/spec/Overview.1.2175.html#ended-playback

http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2174&r2=1.2175&f=h
http://html5.org/tools/web-apps-tracker?from=3011&to=3012

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2174
retrieving revision 1.2175
diff -u -d -r1.2174 -r1.2175
--- Overview.html 28 Apr 2009 22:11:49 -0000 1.2174
+++ Overview.html 28 Apr 2009 22:38:24 -0000 1.2175
@@ -18307,30 +18307,36 @@
    <dt><dfn id="dom-media-have_current_data" title="dom-media-HAVE_CURRENT_DATA"><code>HAVE_CURRENT_DATA</code></dfn> (numeric value 2)</dt>
 
    <dd>Data for the immediate <a href="#current-playback-position">current playback position</a>
-   is available, but not enough data is available that the user agent
-   could successfully advance the <a href="#current-playback-position">current playback
-   position</a> at all without immediately reverting to the <code title="dom-media-HAVE_METADATA"><a href="#dom-media-have_metadata">HAVE_METADATA</a></code> state. For
-   example, in video this corresponds to the user agent having data
-   from the current frame, but not the next frame.</dd>
+   is available, but either not enough data is available that the user
+   agent could successfully advance the <a href="#current-playback-position">current playback
+   position</a> in the <a href="#direction-of-playback">direction of playback</a> at all
+   without immediately reverting to the <code title="dom-media-HAVE_METADATA"><a href="#dom-media-have_metadata">HAVE_METADATA</a></code> state, or
+   there is no more data to obtain in the <a href="#direction-of-playback">direction of
+   playback</a>. For example, in video this corresponds to the user
+   agent having data from the current frame, but not the next frame;
+   and to when <a href="#ended-playback" title="ended playback">playback has
+   ended</a>.</dd>
 
    <dt><dfn id="dom-media-have_future_data" title="dom-media-HAVE_FUTURE_DATA"><code>HAVE_FUTURE_DATA</code></dfn> (numeric value 3)</dt>
 
    <dd>Data for the immediate <a href="#current-playback-position">current playback position</a>
    is available, as well as enough data for the user agent to advance
-   the <a href="#current-playback-position">current playback position</a> at least a little
-   without immediately reverting to the <code title="dom-media-HAVE_METADATA"><a href="#dom-media-have_metadata">HAVE_METADATA</a></code> state. For
-   example, In video this corresponds to the user agent having data
-   for at least the current frame and the next frame.</dd>
+   the <a href="#current-playback-position">current playback position</a> in the <a href="#direction-of-playback">direction
+   of playback</a> at least a little without immediately reverting
+   to the <code title="dom-media-HAVE_METADATA"><a href="#dom-media-have_metadata">HAVE_METADATA</a></code>
+   state. For example, in video this corresponds to the user agent
+   having data for at least the current frame and the next frame. The
+   user agent cannot be in this state if <a href="#ended-playback" title="ended
+   playback">playback has ended</a>, as the <a href="#current-playback-position">current playback
+   position</a> can never advanced in this case.</dd>
 
    <dt><dfn id="dom-media-have_enough_data" title="dom-media-HAVE_ENOUGH_DATA"><code>HAVE_ENOUGH_DATA</code></dfn> (numeric value 4)</dt>
 
-   <dd>Data for the immediate <a href="#current-playback-position">current playback position</a>
-   is available, as well as enough data for the user agent to advance
-   the <a href="#current-playback-position">current playback position</a> at least a little
-   without immediately reverting to the <code title="dom-media-HAVE_METADATA"><a href="#dom-media-have_metadata">HAVE_METADATA</a></code> state, 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>
+   <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>
 
@@ -18610,14 +18616,18 @@
 
   <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
-  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="#media-element">media element</a> does
+  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.</p>
+  specified, or the <a href="#current-playback-position">current playback position</a> is the
+  <var><a href="#earliest-possible-position">earliest possible position</a></var> 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>
   attribute must return true if the <a href="#media-element">media element</a> has
-  <a href="#ended-playback">ended playback</a>, and false otherwise.</p>
+  <a href="#ended-playback">ended playback</a> and the <a href="#direction-of-playback">direction of
+  playback</a> is forwards, and false otherwise.</p>
 
   <p>A <a href="#media-element">media element</a> is said to have <dfn id="stopped-due-to-errors">stopped due to
   errors</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
@@ -18657,8 +18667,9 @@
   the element.</p>
 
   <p>When the <a href="#current-playback-position">current playback position</a> reaches the end
-  of the <a href="#media-resource">media resource</a>, then the user agent must follow
-  these steps:</p>
+  of the <a href="#media-resource">media resource</a> when the <a href="#direction-of-playback">direction of
+  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 <var><a href="#earliest-possible-position">earliest possible
    position</a></var> of the <a href="#media-resource">media resource</a> and abort these
@@ -18679,6 +18690,16 @@
    a simple event</a> called <code title="event-ended"><a href="#event-ended">ended</a></code>
    at the element.</li>
 
+  </ol><p>When the <a href="#current-playback-position">current playback position</a> reaches the
+  <var><a href="#earliest-possible-position">earliest possible position</a></var> of the <a href="#media-resource">media
+  resource</a> when the <a href="#direction-of-playback">direction of playback</a> is
+  backwards, then the user agent must follow these steps:</p>
+
+  <ol><li><p>Stop playback.</li>
+
+   <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> called <code title="event-timeupdate"><a href="#event-timeupdate">timeupdate</a></code> at the element.</li>
+
   </ol><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
@@ -18697,6 +18718,10 @@
   value, and the playback must change speed (if the element is
   <a href="#potentially-playing">potentially playing</a>).</p>
 
+  <p>If the <code title="dom-media-playbackRate"><a href="#dom-media-playbackrate">playbackRate</a></code>
+  is positive or zero, then the <dfn id="direction-of-playback">direction of playback</dfn> is
+  forwards. Otherwise, it is backwards.</p>
+
   <p>The "play" function in a user agent's interface must set the
   <code title="dom-media-playbackRate"><a href="#dom-media-playbackrate">playbackRate</a></code> attribute
   to the value of the <code title="dom-media-defaultPlaybackRate"><a href="#dom-media-defaultplaybackrate">defaultPlaybackRate</a></code>

Received on Tuesday, 28 April 2009 22:40:36 UTC