W3C home > Mailing lists > Public > public-html-diffs@w3.org > March 2010

hixie: Make seeking async since some implementations can't tell if something is seekable synchronously. Also, make it not throw ever, and make it sanely re-entrant. (whatwg r4868)

From: poot <cvsmail@w3.org>
Date: Thu, 25 Mar 2010 18:30:34 +0900 (JST)
To: public-html-diffs@w3.org
Message-Id: <20100325093034.B40332BCA4@toro.w3.mag.keio.ac.jp>
hixie: Make seeking async since some implementations can't tell if
something is seekable synchronously. Also, make it not throw ever, and
make it sanely re-entrant. (whatwg r4868)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3896&r2=1.3897&f=h
http://html5.org/tools/web-apps-tracker?from=4867&to=4868

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3896
retrieving revision 1.3897
diff -u -d -r1.3896 -r1.3897
--- Overview.html	24 Mar 2010 08:58:03 -0000	1.3896
+++ Overview.html	25 Mar 2010 09:30:15 -0000	1.3897
@@ -21172,12 +21172,35 @@
 
   <p>When the user agent is required to <dfn id="dom-media-seek" title="dom-media-seek">seek</dfn> to a particular <var title="">new
   playback position</var> in the <a href="#media-resource">media resource</a>, it means
-  that the user agent must run the following steps:</p>
+  that the user agent must run the following steps. This algorithm
+  interacts closely with the <a href="#event-loop">event loop</a> mechanism; in
+  particular, it has a <a href="#synchronous-section">synchronous
+  section</a> (which is triggered as part of the <a href="#event-loop">event
+  loop</a> algorithm). Steps in that section are marked with
+  &#8987;.</p>
 
-  <ol><li><p>If the <a href="#media-element">media element</a>'s <code title="dom-media-readyState"><a href="#dom-media-readystate">readyState</a></code> is <code title="dom-media-HAVE_NOTHING"><a href="#dom-media-have_nothing">HAVE_NOTHING</a></code>, then the user
-   agent must raise an <code><a href="#invalid_state_err">INVALID_STATE_ERR</a></code> exception (if
-   the seek was in response to a DOM method call or setting of an IDL
-   attribute), and abort these steps.</li>
+  <ol><li><p>If the <a href="#media-element">media element</a>'s <code title="dom-media-readyState"><a href="#dom-media-readystate">readyState</a></code> is <code title="dom-media-HAVE_NOTHING"><a href="#dom-media-have_nothing">HAVE_NOTHING</a></code>, then raise an
+   <code><a href="#invalid_state_err">INVALID_STATE_ERR</a></code> exception (if the seek was in
+   response to a DOM method call or setting of an IDL attribute), and
+   abort these steps.</li>
+
+   <li><p>If the element's <code title="dom-media-seeking"><a href="#dom-media-seeking">seeking</a></code> IDL attribute is true,
+   then another instance of this algorithm is already running. Abort
+   that other instance of the algorithm without waiting for the step
+   that it is running to complete.</li>
+
+   <li><p>Set the <code title="dom-media-seeking"><a href="#dom-media-seeking">seeking</a></code> IDL
+   attribute to true.</li>
+
+   <li id="seekUpdate"><p><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>
+
+   <li><p>If the seek was in response to a DOM method call or setting
+   of an IDL attribute, then continue the script. The remainder of
+   these steps must be run asynchronously. With the exception of the
+   steps marked with &#8987;, they could be aborted at any time by
+   another instance of this algorithm being invoked.</li>
 
    <li><p>If the <var title="">new playback position</var> is later
    than the end of the <a href="#media-resource">media resource</a>, then let it be the
@@ -21188,49 +21211,49 @@
    position instead.</li>
 
    <li><p>If the (possibly now changed) <var title="">new playback
-   position</var> is not in one of the ranges given in the <code title="dom-media-seekable"><a href="#dom-media-seekable">seekable</a></code> attribute, then the user
-   agent must raise an <code><a href="#index_size_err">INDEX_SIZE_ERR</a></code> exception (if the
-   seek was in response to a DOM method call or setting of an IDL
-   attribute), and abort these steps.</li>
-
-   <li><p>The <a href="#current-playback-position">current playback position</a> must be set to
-   the given <var title="">new playback position</var>.</li>
-
-   <li><p>The <code title="dom-media-seeking"><a href="#dom-media-seeking">seeking</a></code> IDL
-   attribute must be set to true.</li>
+   position</var> is not in one of the ranges given in the <code title="dom-media-seekable"><a href="#dom-media-seekable">seekable</a></code> attribute, then let it
+   be the position in one of the ranges given in the <code title="dom-media-seekable"><a href="#dom-media-seekable">seekable</a></code> attribute that is the
+   nearest to the <var title="">new playback position</var>. If two
+   positions both satisfy that constraint (i.e. the <var title="">new
+   playback position</var> is exactly in the middle of a range in the
+   <code title="dom-media-seekable"><a href="#dom-media-seekable">seekable</a></code> attribute) then
+   use the position that is closest to the <a href="#current-playback-position">current playback
+   position</a>. If there are no ranges given in the <code title="dom-media-seekable"><a href="#dom-media-seekable">seekable</a></code> attribute then set the
+   <code title="dom-media-seeking"><a href="#dom-media-seeking">seeking</a></code> IDL attribute to
+   false and abort these steps.</li>
 
-   <li id="seekUpdate"><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>
+   <li><p>Set the <a href="#current-playback-position">current playback position</a> to the given
+   <var title="">new playback position</var>.</li>
 
    <li><p>If the <a href="#media-element">media element</a> was <a href="#potentially-playing">potentially
    playing</a> immediately before it started seeking, but seeking
    caused its <code title="dom-media-readyState"><a href="#dom-media-readystate">readyState</a></code>
-   attribute to change to a value lower than <code title="dom-media-HAVE_FUTURE_DATA"><a href="#dom-media-have_future_data">HAVE_FUTURE_DATA</a></code>, 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-waiting"><a href="#event-media-waiting">waiting</a></code> at
-   the element.</li>
+   attribute to change to a value lower than <code title="dom-media-HAVE_FUTURE_DATA"><a href="#dom-media-have_future_data">HAVE_FUTURE_DATA</a></code>, then
+   <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-waiting"><a href="#event-media-waiting">waiting</a></code> at the
+   element.</li>
 
    <li><p>If, when it reaches this step, the user agent has still not
    established whether or not the <a href="#media-data">media data</a> for the <var title="">new playback position</var> is available, and, if it is,
-   decoded enough data to play back that position, 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-seeking"><a href="#event-media-seeking">seeking</a></code> at the
-   element.</li>
+   decoded enough data to play back that position, then <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-seeking"><a href="#event-media-seeking">seeking</a></code> at the element.</li>
 
-   <li><p>If the seek was in response to a DOM method call or setting
-   of an IDL attribute, then continue the script. The remainder of
-   these steps must be run asynchronously.</li>
+   <li><p>Wait until it has established whether or not the <a href="#media-data">media
+   data</a> 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.</li>
 
-   <li><p>The user agent must wait until it has established whether or
-   not the <a href="#media-data">media data</a> 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.</li>
+   <li><p><a href="#await-a-stable-state">Await a stable state</a>. The <a href="#synchronous-section">synchronous
+   section</a> consists of all the remaining steps of this
+   algorithm. (Steps in the <a href="#synchronous-section">synchronous section</a> are
+   marked with &#8987;.)</li>
 
-   <li><p>The <code title="dom-media-seeking"><a href="#dom-media-seeking">seeking</a></code> IDL
-   attribute must be set to false.</li>
+   <li><p>&#8987; Set the <code title="dom-media-seeking"><a href="#dom-media-seeking">seeking</a></code> IDL attribute to
+   false.</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> named <code title="event-media-seeked"><a href="#event-media-seeked">seeked</a></code> at the element.</li>
+   <li><p>&#8987; <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-seeked"><a href="#event-media-seeked">seeked</a></code>
+   at the element.</li>
 
   </ol><p>The <dfn id="dom-media-seekable" title="dom-media-seekable"><code>seekable</code></dfn>
   attribute must return a new static <a href="#normalized-timeranges-object">normalized
Received on Thursday, 25 March 2010 09:31:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 December 2010 06:14:18 GMT