HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2849[Gecko] [Webkit] Change the way resources are loaded for media elements to make it actually work.2009-02-23 07:19
@@ -19284,22 +19284,22 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
   <code>HTMLAudioElement</code> objects (in addition to the factory
   methods from DOM Core such as <code
   title="">createElement()</code>): <dfn
   title="dom-Audio"><code>Audio()</code></dfn> and <dfn
   title="dom-Audio-s"><code>Audio(<var
   title="">src</var>)</code></dfn>. When invoked as constructors,
   these must return a new <code>HTMLAudioElement</code> object (a new
   <code>audio</code> element). If the <var title="">src</var> argument
   is present, the object created must have its <code
   title="dom-media-src">src</code> content attribute set to the
-  provided value, and the user agent must invoke the <code
-  title="dom-media-load">load()</code> method on the object before
+  provided value, and the user agent must invoke the object's <span
+  title="concept-media-load-algorithm">load algorithm</span> before
   returning.</p>
 
 
 
 
   <h5>Audio codecs for <code>audio</code> elements</h5>
 
   <p>User agents may support any audio codecs and container
   formats.</p>
 
@@ -19448,30 +19448,20 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
 
   </div>
 
   <p>The <dfn title="attr-source-media"><code>media</code></dfn>
   attribute gives the intended media type of the <span>media
   resource</span>, to help the user agent determine if this
   <span>media resource</span> is useful to the user before fetching
   it. Its value must be a valid <a href="#mq">media query</a>. <a
   href="#refsMQ">[MQ]</a></p>
 
-  <p>If a <code>source</code> element is inserted into a <span>media
-  element</span> that is already in a document and whose <code
-  title="dom-media-networkState">networkState</code> is in the <code
-  title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> state, the user
-  agent must <span>queue a task</span> that implicitly invokes the
-  <code title="dom-media-load">load()</code> method on the <span>media
-  element</span>, and ignores any resulting exceptions. The <span>task
-  source</span> for this task is the <span>media element</span>'s own
-  <span>media element new resource task source</span>.</p>
-
   <p>The DOM attributes <dfn
   title="dom-source-src"><code>src</code></dfn>, <dfn
   title="dom-source-type"><code>type</code></dfn>, and <dfn
   title="dom-source-media"><code>media</code></dfn> must
   <span>reflect</span> the respective content attributes of the same
   name.</p>
 
 
 
   <h4>Media elements</h4>
@@ -19484,20 +19474,21 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
   // error state
   readonly attribute <span>MediaError</span> <span title="dom-media-error">error</span>;
 
   // network state
            attribute DOMString <span title="dom-media-src">src</span>;
   readonly attribute DOMString <span title="dom-media-currentSrc">currentSrc</span>;
   const unsigned short <span title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</span> = 0;
   const unsigned short <span title="dom-media-NETWORK_IDLE">NETWORK_IDLE</span> = 1;
   const unsigned short <span title="dom-media-NETWORK_LOADING">NETWORK_LOADING</span> = 2;
   const unsigned short <span title="dom-media-NETWORK_LOADED">NETWORK_LOADED</span> = 3;
+  const unsigned short <span title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</span> = 4;
   readonly attribute unsigned short <span title="dom-media-networkState">networkState</span>;
   readonly attribute float <span title="dom-media-bufferingRate">bufferingRate</span>;
   readonly attribute boolean <span title="dom-media-bufferingThrottled">bufferingThrottled</span>;
   readonly attribute <span>TimeRanges</span> <span title="dom-media-buffered">buffered</span>;
   void <span title="dom-media-load">load</span>();
   DOMString <span title="dom-navigator-canPlayType">canPlayType</span>(in DOMString type);
 
   // ready state
   const unsigned short <span title="dom-media-HAVE_NOTHING">HAVE_NOTHING</span> = 0;
   const unsigned short <span title="dom-media-HAVE_METADATA">HAVE_METADATA</span> = 1;
@@ -19579,39 +19570,36 @@ interface <dfn>CueRangeCallback</dfn> {
   -->
 
   <p><span title="media element">Media elements</span> are used to
   present audio data, or video and audio data, to the user. This is
   referred to as <dfn>media data</dfn> in this section, since this
   section applies equally to <span title="media element">media
   elements</span> for audio or for video. The term <dfn>media
   resource</dfn> is used to refer to the complete set of media data,
   e.g. the complete video file, or complete audio file.</p>
 
-  <p><span title="media element">Media elements</span> use two <span
-  title="task queue">task queues</span>, the <dfn>media element event
-  task source</dfn> for asynchronous events and callbacks, and the
-  <dfn>media element new resource task source</dfn> for handling
-  implicit loads. Unless otherwise specified, the <span>task
-  source</span> for all the tasks <span title="queue a
-  task">queued</span> in this section and its subsections is the
-  <span>media element event task source</span>.</p>
+  <p>Unless otherwise specified, the <span>task source</span> for all
+  the tasks <span title="queue a task">queued</span> in this section
+  and its subsections is the <dfn>media element event task
+  source</dfn>.</p>
 
 
   <h5>Error codes</h5>
 
   <p>All <span title="media element">media elements</span> have an
   associated error status, which records the last error the element
-  encountered since the <code title="dom-media-load">load()</code>
-  method was last invoked. The <dfn
-  title="dom-media-error"><code>error</code></dfn> attribute, on
-  getting, must return the <code>MediaError</code> object created for
-  this last error, or null if there has not been an error.</p>
+  encountered since its <span
+  title="concept-media-load-algorithm">load algorithm</span> was last
+  invoked. The <dfn title="dom-media-error"><code>error</code></dfn>
+  attribute, on getting, must return the <code>MediaError</code>
+  object created for this last error, or null if there has not been an
+  error.</p>
 
   <pre class="idl">interface <dfn>MediaError</dfn> {
   const unsigned short <span title="dom-MediaError-MEDIA_ERR_ABORTED">MEDIA_ERR_ABORTED</span> = 1;
   const unsigned short <span title="dom-MediaError-MEDIA_ERR_NETWORK">MEDIA_ERR_NETWORK</span> = 2;
   const unsigned short <span title="dom-MediaError-MEDIA_ERR_DECODE">MEDIA_ERR_DECODE</span> = 3;
   const unsigned short <span title="dom-MediaError-MEDIA_ERR_NONE_SUPPORTED">MEDIA_ERR_NONE_SUPPORTED</span> = 4;
   readonly attribute unsigned short <span title="dom-MediaError-code">code</span>;
 };</pre>
 
   <p>The <dfn title="dom-MediaError-code"><code>code</code></dfn>
@@ -19645,145 +19633,35 @@ interface <dfn>CueRangeCallback</dfn> {
 
 
 
   <h5>Location of the media resource</h5>
 
   <p>The <dfn title="attr-media-src"><code>src</code></dfn> content
   attribute on <span title="media element">media elements</span> gives
   the address of the media resource (video, audio) to show. The
   attribute, if present, must contain a <span>valid URL</span>.</p>
 
-  <p>If the <code title="attr-media-src">src</code> attribute of a
-  <span>media element</span> that is already in a document and whose
-  <code title="dom-media-networkState">networkState</code> is in the
-  <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> state is
-  added, changed, or removed, the user agent must <span>queue a
-  task</span> that implicitly invokes the <code
-  title="dom-media-load">load()</code> method on the <span>media
-  element</span>, and ignores any resulting exceptions. The <span>task
-  source</span> for this task is the <span>media element</span>'s own
-  <span>media element new resource task source</span>.</p>
-
-  <p class="note">If a <code title="attr-media-src">src</code>
-  attribute is specified, the resource it specifies is the <span>media
-  resource</span> that will be used. Otherwise, the resource specified
-  by the first suitable <code>source</code> element child of the
-  <span>media element</span> is the one used.</p>
-
   <p>The <dfn title="dom-media-src"><code>src</code></dfn> DOM
   attribute on <span title="media element">media elements</span> must
   <span>reflect</span> the respective content attribute of the same
   name.</p>
 
   <p>The <dfn
   title="dom-media-currentSrc"><code>currentSrc</code></dfn> DOM
   attribute is initially the empty string. Its value is changed by the
-  algorithm for the <code title="dom-media-load">load()</code> method
+  <span title="concept-media-load-algorithm">load algorithm</span>
   defined below.</p>
 
-  <p>To <dfn>generate the list of potential media resources</dfn> for
-  a <span>media element</span>, a user agent must use the following
-  steps. These steps return a list of <span title="absolute
-  URL">absolute URLs</span> giving a resource's address.</p>
-
-  <ol>
-
-   <li>
-
-    <p>If the <span>media element</span> has a <code
-    title="attr-media-src">src</code> attribute, then run these
-    substeps:</p>
-
-    <ol>
-
-     <li><p><span title="resolve a url">Resolve</span> the
-     <span>URL</span> given in that attribute, relative to the
-     <span>media element</span>.</p>
-
-     <li><p>If that is successful, then return a list consisting of
-     only one entry, the resulting <span>absolute URL</span> as the
-     resource's address.</p></li>
-
-     <li><p>Otherwise, return the empty list.</p></li>
-
-     <li><p>Abort the algorithm.</p></li>
-
-    </ol>
-
-    <p>Otherwise, the <code>source</code> elements will be used.</p>
-
-   </li>
-
-   <li><p>If the <span>media element</span> has no <code>source</code>
-   element children, then return the empty the list and abort these
-   steps.</p></li>
-
-   <li><p>Let <var title="">result</var> be an empty list.</p></li>
-
-   <li><p>Let <var title="">candidate</var> be the first
-   <code>source</code> element child in the <span>media
-   element</span>.</p></li>
-
-   <li><p><i>Loop</i>: this is the start of the loop that looks at the
-   <code>source</code> elements.</p></li>
-
-   <li>
-
-    <p>If all the following conditions are true:</p>
-
-    <ul>
-
-     <li>The <var title="">candidate</var> element has a <code
-     title="attr-source-src">src</code> attribute.</li>
-
-     <li><span title="resolve a url">Resolving</span> the
-     <span>URL</span> given by the <var title="">candidate</var>
-     element's <code title="attr-source-src">src</code> attribute
-     relative to <var title="">candidate</var> does not fail.</li>
-
-     <li>The <var title="">candidate</var> element either has no <code
-     title="attr-source-type">type</code> attribute, or its <code
-     title="attr-source-type">type</code> attribute's value, when
-     parsed as a MIME type (including any codecs described by the
-     <code title="">codec</code> parameter), does not represent
-     <span>a type that the user agent knows it cannot
-     render</span>.</li>
-
-     <li>The <var title="">candidate</var> element either has no <code
-     title="attr-source-media">media</code> attribute, or its <code
-     title="attr-source-media">media</code> attribute's value, when
-     processed according to the rules for <a href="#mq">media
-     queries</a>, matches the current environment. <a
-     href="#refsMQ">[MQ]</a></li>
-
-    </ul>
-
-    <p>...then append the <span>absolute URL</span> resulting from
-    <span title="resolve a url">resolving</span> the <span>URL</span>
-    given in that <var title="">candidate</var> element's <code
-    title="attr-source-src">src</code> attribute relative to <var
-    title="">candidate</var> to the <var title="">result</var>
-    list.</p>
-
-   </li>
-
-   <li><p>Let <var title="">candidate</var> be the next
-   <code>source</code> element child in the <span>media
-   element</span>, or null if there are no more such
-   children.</p></li>
-
-   <li><p>If <var title="">candidate</var> is not null, return to the
-   step labeled <i>loop</i>.</p></li>
-
-   <li><p>Return <var title="">result</var>.</p></li>
-
-  </ol>
+  <p class="note">There are two ways to specify a <span>media
+  resource</span>, the <code title="attr-media-src">src</code>
+  attribute, or <code>source</code> elements. The attribute overrides
+  the elements.</p>
 
 
 
   <h5>Media types</h5>
 
   <p>A <span>media resource</span> can be described in terms of its
   <em>type</em>, specifically a MIME type, optionally with a <code
   title="">codecs</code> parameter. <a
   href="#refsRFC2046">[RFC2046]</a> <a
   href="#refsRFC4281">[RFC4281]</a>.</p>
@@ -19867,110 +19745,116 @@ interface <dfn>CueRangeCallback</dfn> {
 
   <dl>
 
    <dt><dfn title="dom-media-NETWORK_EMPTY"><code>NETWORK_EMPTY</code></dfn> (numeric value 0)</dt>
 
    <dd>The element has not yet been initialized. All attributes are in
    their initial states.</dd>
 
    <dt><dfn title="dom-media-NETWORK_IDLE"><code>NETWORK_IDLE</code></dfn> (numeric value 1)</dt>
 
-   <dd>The element's <code title="dom-media-load">load()</code> method
-   algorithm is active, but it is not actually using the network at
-   this time.</dd>
+   <dd>The element's <span title="concept-media-load-algorithm">load
+   algorithm</span> is active and has selected a resource, but it is
+   not actually using the network at this time.</dd>
 
    <dt><dfn title="dom-media-NETWORK_LOADING"><code>NETWORK_LOADING</code></dfn> (numeric value 2)</dt>
 
    <dd>The user agent is actively trying to download data.</dd>
 
    <dt><dfn title="dom-media-NETWORK_LOADED"><code>NETWORK_LOADED</code></dfn> (numeric value 3)</dt>
 
    <dd>The entire <span>media resource</span> has been obtained and is
    available to the user agent locally. Network connectivity could be
    lost without affecting the media playback.</dd>
 
+   <dt><dfn title="dom-media-NETWORK_NO_SOURCE"><code>NETWORK_NO_SOURCE</code></dfn> (numeric value 4)</dt>
+
+   <dd>The element's <span title="concept-media-load-algorithm">load
+   algorithm</span> is active, but it has failed to find a resource to
+   use.</dd>
+
   </dl>
 
-  <p>The algorithm for the <code title="dom-media-load">load()</code>
-  method defined below describes exactly when the <code
+  <p>The <span title="concept-media-load-algorithm">load
+  algorithm</span> defined below describes exactly when the <code
   title="dom-media-networkState">networkState</code> attribute changes
   value and what events fire to indicate changes in this state.</p>
 
   <p class="note">Some resources, e.g. streaming Web radio, can never
   reach the <code
   title="dom-media-NETWORK_LOADED">NETWORK_LOADED</code> state.</p>
 
 
   <h5>Loading the media resource</h5>
 
-  <p>All <span title="media element">media elements</span> have a
-  <dfn>begun flag</dfn>, which must begin in the false state, an
+  <p>All <span title="media element">media elements</span> have an
   <dfn>autoplaying flag</dfn>, which must begin in the true state, and
   a <dfn>delaying-the-load-event flag</dfn>, which must begin in the
   false state. While the <span>delaying-the-load-event flag</span> is
   true, the element must <span>delay the load event</span>.</p>
 
   <p>When the <dfn title="dom-media-load"><code>load()</code></dfn>
   method on a <span>media element</span> is invoked, the user agent
   must run the following steps. Note that this algorithm might get
   aborted, e.g. if the <code title="dom-media-load">load()</code>
   method itself is invoked again.</p>
 
   <ol>
 
+   <li><p>If the <code title="dom-media-load">load()</code> method for
+   this element is already being invoked, then abort these
+   steps.</p></li>
+
+   <li><p>Abort any already-running instance of the <span
+   title="concept-media-load-algorithm">load algorithm</span> for this
+   element.</p></li>
+
    <li>
 
     <p>If there are any <span title="concept-task">tasks</span> from
-    the <span>media element</span>'s <span>media element new resource
-    task source</span> or its <span>media element event task
+    the <span>media element</span>'s <span>media element event task
     source</span> in one of the <span title="task queue">task
     queues</span>, then remove those tasks.</p>
 
-    <p class="note">Basically, pending events, callbacks, and loads
-    for the media element are discarded when the media element starts
-    loading a new resource.</p>
+    <p class="note">Basically, pending events and callbacks for the
+    media element are discarded when the media element starts loading
+    a new resource.</p>
 
    </li>
 
-   <li><p>Abort any already-running instance of this algorithm for
-   this element. If those method calls have not yet returned, they
-   must finish the step they are on, and then immediately return. This
-   is not blocking; this algorithm must not wait for the earlier
-   instances to abort before continuing.</p></li>
-
-   <li><p>Set the element's <span>delaying-the-load-event flag</span>
-   to true. This <span title="delay the load event">delays the load
-   event</span>.</p></li>
-
-   <li><p>If the element's <span>begun flag</span> is true, then set
-   the <span>begun flag</span> to false, set the <code
+   <li><p>If the <span>media element</span>'s <code
+   title="dom-media-networkState">networkState</code> is set to <code
+   title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code> or <code
+   title="dom-media-NETWORK_IDLE">NETWORK_IDLE</code>, set the <code
    title="dom-media-error">error</code> attribute to a new
    <code>MediaError</code> object whose <code
    title="dom-MediaError-code">code</code> attribute is set to <code
    title="dom-MediaError-MEDIA_ERR_ABORTED">MEDIA_ERR_ABORTED</code>,
    and <span>fire a progress event</span> called <code
    title="event-abort">abort</code> at the <span>media
    element</span>.</p></li>
 
    <li><p>Set the <code title="dom-media-error">error</code> attribute
    to null and the <span>autoplaying flag</span> to true.</p></li>
 
    <li><p>Set the <code
    title="dom-media-playbackRate">playbackRate</code> attribute to the
    value of the <code
    title="dom-media-defaultPlaybackRate">defaultPlaybackRate</code>
    attribute.</p></li>
 
-   <li><p>If the <span>media element</span>'s <code
-   title="dom-media-networkState">networkState</code> is not set to
-   <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then
-   run these substeps:</p>
+   <li>
+
+    <p>If the <span>media element</span>'s <code
+    title="dom-media-networkState">networkState</code> is not set to
+    <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then
+    run these substeps:</p>
 
     <ol>
 
      <li><p>If a fetching process is in progress for the <span>media
      element</span>, the user agent should stop it.</p></li>
 
      <!--<li>Let <var title="">events</var> be a list of event names,
      initially empty.</li>-->
 
      <li>Set the <code
@@ -20001,453 +19885,635 @@ interface <dfn>CueRangeCallback</dfn> {
      in the same order that they were added to that list.</li>-->
 
      <li><span>Fire a simple event</span> called <code
      title="event-emptied">emptied</code> at the <span>media
      element</span>.</li>
 
     </ol>
 
    </li>
 
-   <li><p><span>Generate the list of potential media resources</span>
-   and let the resulting list be <var
-   title="">candidates</var>.</p></li>
+   <li><p>Asynchronously invoke the <span>media element</span>'s <span
+   title="concept-media-load-algorithm">load algorithm</span>.</li>
+
+   <li>
+
+    <p class="note">Playback of any previously playing <span>media
+    resource</span> for this element stops.</p>
+
+   </li>
+
+  </ol>
+
+  <p>The <dfn title="concept-media-load-algorithm">load
+  algorithm</dfn> for a <span>media element</span> is as follows. This
+  algorithm is always invoked asynchronously, meaning that it runs in
+  the background with scripts and other <span
+  title="concept-task">tasks</span> running in parallel.</p>
+
+  <ol>
+
+   <li><p>While the <span>media element</span> has neither a <code
+   title="attr-media-src">src</code> attribute nor any
+   <code>source</code> element children, wait. (This steps might wait
+   forever.)</p></li>
+
+   <li><p>Set the element's <span>delaying-the-load-event flag</span>
+   to true. This <span title="delay the load event">delays the load
+   event</span>.</p></li>
 
    <li><p>Set the <code
    title="dom-media-networkState">networkState</code> to <code
    title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
 
-   <li><p>Set the <span>begun flag</span> to true and <span>queue a
-   task</span> to <span>fire a progress event</span> called <code
-   title="event-loadstart">loadstart</code> at the <span>media
-   element</span>.</p></li>
+   <li><p><span>Queue a task</span> to <span>fire a progress
+   event</span> called <code title="event-loadstart">loadstart</code>
+   at the <span>media element</span>.</p></li>
 
    <li>
 
-    <p>The method must return, but these steps must continue.</p>
+    <p>If the <span>media element</span> has a <code
+    title="attr-media-src">src</code> attribute, then run these
+    substeps:</p>
 
-    <p class="note">Playback of any previously playing <span>media
-    resource</span> for this element stops.</p>
+    <ol>
 
-   </li>
+     <li><p><span title="resolve a url">Resolve</span> the
+     <span>URL</span> given in that attribute, relative to the
+     <span>media element</span>.</p>
 
+     <li><p>If that is successful, then run the <span
+     title="concept-media-load-resource">resource-load
+     algorithm</span> with the resulting <span>absolute URL</span>. If
+     that algorithm returns without aborting <em>this</em> one, then
+     the load failed.</p></li>
 
-   <!-- SYNCHRONOUS / ASYNCHRONOUS BOUNDARY FOR EVENT DISPATCH -->
+     <li><p>Reaching this step indicates that either the URL failed to
+     resolve, or the media resource failed to load. Set the <code
+     title="dom-media-error">error</code> attribute to a new
+     <code>MediaError</code> object whose <code
+     title="dom-MediaError-code">code</code> attribute is set to <code
+     title="dom-MediaError-MEDIA_ERR_NONE_SUPPORTED">MEDIA_ERR_NONE_SUPPORTED</code>.</p></li>
 
+     <li><p>Set the element's <code
+     title="dom-media-networkState">networkState</code> attribute to
+     the <span
+     title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</span>
+     value.</p></li>
 
-   <li>
+     <li><p><span>Queue a task</span> to <span>fire a progress
+     event</span> called <code title="event-error">error</code> at the
+     <span>media element</span>.</p></li>
+
+     <li><p>Set the element's <span>delaying-the-load-event flag</span>
+     to false. This stops <span title="delay the load event">delaying
+     the load event</span>.</p></li>
+
+     <li><p>Abort these steps. Until the <code
+     title="dom-media-load">load()</code> method is invoked, the
+     element won't attempt to load another resource.</p></li>
+     <!-- it took its ball and went home, sulking. -->
+
+    </ol>
 
-    <p><i>Candidate loop</i>: For each item in <var
-    title="">candidates</var>, if any, and in the same order as they
-    were added to the list, run the following steps:</p>
+    <p>Otherwise, the <code>source</code> elements will be used; run
+    these substeps:</p>
 
     <ol>
 
-     <li><p>Let the <var title="">current media resource</var> be the
-     resource given by the <span>absolute URL</span> for the current
-     item in <var title="">candidates</var>. This is now the element's
-     <span>media resource</span>.</p></li>
+     <li>
 
-     <li><p>Set the <code
-     title="dom-media-currentSrc">currentSrc</code> attribute to the
-     <span>absolute URL</span> of the <var title="">current media
-     resource</var>.</p></li>
+      <p>Let <var title="">pointer</var> be a position defined by two
+      adjacent nodes in the <span>media element</span>'s child list,
+      treating the start of the list (before the first child in the
+      list, if any) and end of the list (after the last child in the
+      list, if any) as nodes in their own right. One node is the node
+      before <var title="">pointer</var>, and the other node is the
+      node after <var title="">pointer</var>. Initially, let <var
+      title="">pointer</var> be the position between the start of the
+      list and the next node (either the first child node of the
+      <span>media element</span>, if there are any, or the end of the
+      list, if it is empty).</p>
+
+      <p>As elements are inserted and removed into the <span>media
+      element</span>, <var title="">pointer</var> must be updated as
+      follows:</p>
+
+      <dl>
+
+       <dt>If a new element is inserted between the two nodes that
+       define <var title="">pointer</var></dt>
+
+       <dd>Let <var title="">pointer</var> be the point between the
+       node before <var title="">pointer</var> and the new node. In
+       other words, insertions at <var title="">pointer</var> go after
+       <var title="">pointer</var>.</dd>
+
+       <dt>If the node before <var title="">pointer</var> is removed</dt>
+
+       <dd>Let <var title="">pointer</var> be the point between the
+       node after <var title="">pointer</var> and the node before the
+       node after <var title="">pointer</var>. In other words, <var
+       title="">pointer</var> doesn't move relative to the remaining
+       nodes.</dd>
+
+       <dt>If the node after <var title="">pointer</var> is removed</dt>
+
+       <dd>Let <var title="">pointer</var> be the point between the
+       node before <var title="">pointer</var> and the node after the
+       node before <var title="">pointer</var>. Just as with the
+       previous case, <var title="">pointer</var> doesn't move
+       relative to the remaining nodes.</dd>
+
+      </dl>
+
+      <p>Other changes don't affect <var title="">pointer</var>.</p>
+
+     </li>
 
      <li>
 
-      <p>Begin to <span>fetch</span> the <var title="">current media
-      resource</var>.</p>
-
-      <p>Every 350ms (&#xB1;200ms) or for every byte received,
-      whichever is <em>least</em> frequent, <span>queue a task</span>
-      to <span>fire a progress event</span> called <code
-      title="event-progress">progress</code> at the element.</p>
-
-      <p>If at any point the user agent has received no data for more
-      than about three seconds, then <span>queue a task</span> to
-      <span>fire a progress event</span> called <code
-      title="event-stalled">stalled</code> at the element.</p>
-
-      <p>User agents may allow users to selectively block or slow
-      <span>media data</span> downloads. When a <span>media
-      element</span>'s download has been blocked altogether, the user
-      agent must act as if it was stalled (as opposed to acting as if
-      the connection was closed). The rate of the download may also be
-      throttled automatically by the user agent, e.g. to balance the
-      download with other connections sharing the same bandwidth.</p>
-
-      <p>User agents may decide to not download more content at any
-      time, e.g. after buffering five minutes of a one hour media
-      resource, while waiting for the user to decide whether to play
-      the resource or not, or while waiting for user input in an
-      interactive resource. When a <span>media element</span>'s
-      download has been suspended, the user agent must set the <code
-      title="dom-media-networkState">networkState</code> to <code
-      title="dom-media-NETWORK_IDLE">NETWORK_IDLE</code> and
-      <span>queue a task</span> to <span>fire a progress event</span>
-      called <code title="event-suspend">suspend</code> at the
-      element. If and when downloading of the resource resumes, the
-      user agent must set the <code
-      title="dom-media-networkState">networkState</code> to <code
-      title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p>
-
-      <p>The user agent may use whatever means necessary to fetch the
-      resource (within the constraints put forward by this and other
-      specifications); for example, reconnecting to the server in the
-      face of network errors, using HTTP partial range requests, or
-      switching to a streaming protocol. The user agent must consider a
-      resource erroneous only if it has given up trying to fetch it.</p>
-
-      <p>The <span>networking task source</span> <span
-      title="concept-task">tasks</span> to process the data as it is
-      being fetched must, when appropriate, include the relevant
-      substeps from the following list:</p>
+      <p><i>Search loop:</i> Run these substeps atomically (so that
+      the DOM cannot change while they are running):</p>
 
-      <dl class="switch">
+      <ol>
 
-       <dt>If the <span>media data</span> cannot be fetched at all, due
-       to network errors, causing the user agent to give up trying to
-       fetch the resource</dt>
+       <li><p>If the node after <var title="">pointer</var> is the end
+       of the list, then jump to the step below labeled
+       <i>waiting</i>.</p></li>
 
-       <dt>If the <span>media data</span> can be fetched but is in an
-       unsupported format, or can otherwise not be rendered at
-       all</dt>
+       <li><p>If the node after <var title="">pointer</var> is a
+       <code>source</code> element, let <var title="">candidate</var>
+       be that element; otherwise, let <var title="">candidate</var>
+       be null.</p></li>
 
-       <dd>
+       <li><p>Advance <var title="">pointer</var> so that the node
+       before <var title="">pointer</var> is now the node that was
+       after <var title="">pointer</var>, and the node after <var
+       title="">pointer</var> is the node after the node that used to
+       be after <var title="">pointer</var>.</p></li>
 
-        <p>DNS errors, HTTP 4xx and 5xx errors (and equivalents in
-        other protocols), and other fatal network errors that occur
-        before the user agent has established whether the <var
-        title="">current media resource</var> is usable, as well as
-        the file using an unsupported container format, or using
-        unsupported codecs for all the data, must cause the user agent
-        to execute the following steps:</p>
+       <li><p>If <var title="">candidate</var> is null, restart the
+       step labelled <i>search loop</i> from the first
+       substep.</p></li>
 
-        <ol>
+      </ol>
 
-         <li><p>The user agent should cancel the fetching
-         process.</p></li>
+     </li>
 
-         <li><p>If there are more items in the <var
-         title="">candidates</var> list, then move on to the next one,
-         jumping back to the top of the <i>candidate loop</i>;
-         otherwise, jump to the final step in the overall algorithm
-         (the <i>failure step</i>).</p>
+     <li>
 
-        </ol>
+      <p>If any of the following conditions are true, then jump back
+      to the step labelled <i>search loop</i>:</p>
 
-       </dd>
+      <ul>
 
+       <li>The <var title="">candidate</var> element does not have a
+       <code title="attr-source-src">src</code> attribute.</li>
 
-       <dt id="getting-media-metadata">Once enough of the <span>media
-       data</span> has been fetched to determine the duration of the
-       <span>media resource</span>, its dimensions, and other
-       metadata</dt>
+       <li><span title="resolve a url">Resolving</span> the
+       <span>URL</span> given by the <var title="">candidate</var>
+       element's <code title="attr-source-src">src</code> attribute
+       relative to <var title="">candidate</var> fails.</li>
 
-       <dd>
+       <li>The <var title="">candidate</var> element has a <code
+       title="attr-source-type">type</code> attribute whose value,
+       when parsed as a MIME type (including any codecs described by
+       the <code title="">codec</code> parameter), represents <span>a
+       type that the user agent knows it cannot render</span>.</li>
 
-        <p>This indicates that the resource is usable. The user agent
-        must follow these substeps:</p>
+       <li>The <var title="">candidate</var> element has a <code
+       title="attr-source-media">media</code> attribute whose value,
+       when processed according to the rules for <a href="#mq">media
+       queries</a>, does not match the current environment. <a
+       href="#refsMQ">[MQ]</a></li>
 
-        <ol>
+      </ul>
 
-         <li><p>Set the <span>current playback position</span> to the
-         <var>earliest possible position</var>.</p></li>
+     </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>Set the <code
+     title="dom-media-networkState">networkState</code> to <code
+     title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code> again,
+     in case it was set to <code
+     title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</code>
+     above.</p></li>
+
+     <li><p>Run the <span
+     title="concept-media-load-resource">resource-load
+     algorithm</span> with the <span>absolute URL</span> that resulted
+     from <span title="resolve a url">resolving</span> the
+     <span>URL</span> given by the <var title="">candidate</var>
+     element's <code title="attr-source-src">src</code> attribute
+     relative to <var title="">candidate</var>. If that algorithm
+     returns without aborting <em>this</em> one, then the load
+     failed.</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><p>Return to the step labeled <i>search loop</i>.</p></li>
 
-         <li>
+     <li><p><i>Waiting:</i> Set the <code
+     title="dom-media-error">error</code> attribute to a new
+     <code>MediaError</code> object whose <code
+     title="dom-MediaError-code">code</code> attribute is set to <code
+     title="dom-MediaError-MEDIA_ERR_NONE_SUPPORTED">MEDIA_ERR_NONE_SUPPORTED</code>.</p></li>
 
-          <p>Set the <code title="dom-media-duration">duration</code>
-          attribute to the duration of the resource.</p>
+     <li><p>Set the element's <code
+     title="dom-media-networkState">networkState</code> attribute to
+     the <span
+     title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</span>
+     value</p></li>
 
-          <p class="note">The user agent <a
-          href="#durationChange">will</a> <span>queue a task</span> to
-          <span>fire a simple event</span> called <code
-          title="event-durationchange">durationchange</code> at the
-          element at this point.</p>
+     <li><p><span>Queue a task</span> to <span>fire a progress
+     event</span> called <code title="event-error">error</code> at the
+     <span>media element</span>.</p></li>
 
-         </li>
+     <li><p>Set the element's <span>delaying-the-load-event flag</span>
+     to false. This stops <span title="delay the load event">delaying
+     the load event</span>.</p></li>
 
-         <li id="fire-loadedmetadata"><p><span>Queue a task</span> to
-         <span>fire a simple event</span> called <code
-         title="event-loadedmetadata">loadedmetadata</code> at the
-         element.</li>
+     <li><p>Wait until the node after <var title="">painter</var> is a
+     node other than the end of the list. (This step might wait
+     forever.)</p></li>
 
-         <li>
+     <li><p>Set the element's <span>delaying-the-load-event
+     flag</span> back to true. This <span title="delay the load
+     event">delays the load event</span> again, in case it hasn't gone
+     been fired yet.</p></li>
 
-          <p>If either the <span>media resource</span> or the address
-          of the <var title="">current media resource</var> indicate a
-          particular start time, then <span
-          title="dom-media-seek">seek</span> to that time. Ignore any
-          resulting exceptions (if the position is out of range, it is
-          effectively ignored).</p>
+    </ol>
 
-          <p class="example">For example, a fragment identifier could be
-          used to indicate a start position.</p>
+   </li>
 
-         </li>
+  </ol>
 
-         <li><p>Set the element's <span>delaying-the-load-event
-         flag</span> to false. This stops <span title="delay the load
-         event">delaying the load event</span>.</p></li>
+  <p>The <dfn title="concept-media-load-resource">resource-load
+  algorithm</dfn> for a <span>media element</span> and a given
+  <span>absolute URL</span> is as follows:</p>
 
-        </ol>
+  <ol>
 
-        <p class="note">The user agent is <em>required</em> to
-        determine the duration of the <span>media resource</span> and
-        go through this step before playing.</p> <!-- actually defined
-        in the 'duration' section -->
+   <li><p>Let the <var title="">current media resource</var> be the
+   resource given by the <span>absolute URL</span> passed to this
+   algorithm. This is now the element's <span>media
+   resource</span>.</p></li>
 
-       </dd>
+   <li><p>Set the <code
+   title="dom-media-currentSrc">currentSrc</code> attribute to the
+   <span>absolute URL</span> of the <var title="">current media
+   resource</var>.</p></li>
 
+   <li>
 
-       <dt>If the connection is interrupted, causing the user agent to
-       give up trying to fetch the resource</dt>
+    <p>Begin to <span>fetch</span> the <var title="">current media
+    resource</var>.</p>
+
+    <p>Every 350ms (&#xB1;200ms) or for every byte received,
+    whichever is <em>least</em> frequent, <span>queue a task</span>
+    to <span>fire a progress event</span> called <code
+    title="event-progress">progress</code> at the element.</p>
+
+    <p>If at any point the user agent has received no data for more
+    than about three seconds, then <span>queue a task</span> to
+    <span>fire a progress event</span> called <code
+    title="event-stalled">stalled</code> at the element.</p>
+
+    <p>User agents may allow users to selectively block or slow
+    <span>media data</span> downloads. When a <span>media
+    element</span>'s download has been blocked altogether, the user
+    agent must act as if it was stalled (as opposed to acting as if
+    the connection was closed). The rate of the download may also be
+    throttled automatically by the user agent, e.g. to balance the
+    download with other connections sharing the same bandwidth.</p>
+
+    <p>User agents may decide to not download more content at any
+    time, e.g. after buffering five minutes of a one hour media
+    resource, while waiting for the user to decide whether to play
+    the resource or not, or while waiting for user input in an
+    interactive resource. When a <span>media element</span>'s
+    download has been suspended, the user agent must set the <code
+    title="dom-media-networkState">networkState</code> to <code
+    title="dom-media-NETWORK_IDLE">NETWORK_IDLE</code> and
+    <span>queue a task</span> to <span>fire a progress event</span>
+    called <code title="event-suspend">suspend</code> at the
+    element. If and when downloading of the resource resumes, the
+    user agent must set the <code
+    title="dom-media-networkState">networkState</code> to <code
+    title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p>
+
+    <p>The user agent may use whatever means necessary to fetch the
+    resource (within the constraints put forward by this and other
+    specifications); for example, reconnecting to the server in the
+    face of network errors, using HTTP partial range requests, or
+    switching to a streaming protocol. The user agent must consider a
+    resource erroneous only if it has given up trying to fetch it.</p>
+
+    <p>The <span>networking task source</span> <span
+    title="concept-task">tasks</span> to process the data as it is
+    being fetched must, when appropriate, include the relevant
+    substeps from the following list:</p>
 
-       <dd>
+    <dl class="switch">
 
-        <p>Fatal network errors that occur after the user agent has
-        established whether the <var title="">current media
-        resource</var> is usable must cause the user agent to execute
-        the following steps:</p>
+     <dt>If the <span>media data</span> cannot be fetched at all, due
+     to network errors, causing the user agent to give up trying to
+     fetch the resource</dt>
 
-        <ol>
+     <dt>If the <span>media data</span> can be fetched but is in an
+     unsupported format, or can otherwise not be rendered at
+     all</dt>
 
-         <li>The user agent should cancel the fetching process.</li>
+     <dd>
 
-         <li>Set the <code title="dom-media-error">error</code>
-         attribute to a new <code>MediaError</code> object whose <code
-         title="dom-MediaError-code">code</code> attribute is set to
-         <code
-         title="dom-MediaError-MEDIA_ERR_NETWORK">MEDIA_ERR_NETWORK</code>.</li>
+      <p>DNS errors, HTTP 4xx and 5xx errors (and equivalents in
+      other protocols), and other fatal network errors that occur
+      before the user agent has established whether the <var
+      title="">current media resource</var> is usable, as well as
+      the file using an unsupported container format, or using
+      unsupported codecs for all the data, must cause the user agent
+      to execute the following steps:</p>
 
-         <li>Set the <span>begun flag</span> to false and <span>queue
-         a task</span> to <span>fire a progress event</span> called
-         <code title="event-error">error</code> at the <span>media
-         element</span>.</li>
+      <ol>
 
-         <li>Set the element's <code
-         title="dom-media-networkState">networkState</code> attribute
-         to the <span
-         title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</span> value
-         and <span>queue a task</span> to <span>fire a simple
-         event</span> called <code
-         title="event-emptied">emptied</code> at the element.</li>
+       <li><p>The user agent should cancel the fetching
+       process.</p></li>
 
-         <li><p>Set the element's <span>delaying-the-load-event
-         flag</span> to false. This stops <span title="delay the load
-         event">delaying the load event</span>.</p></li>
+       <li><p>Abort this subalgorithm, returning to the <span
+       title="concept-media-load-algorithm">load algorithm</span>.</p>
 
-         <li>Abort the overall <code
-         title="dom-media-load">load()</code> method algorithm.</li>
+      </ol>
 
-        </ol>
+     </dd>
 
-       </dd>
 
-       <dt id="fatal-decode-error">If the <span>media data</span> is
-       corrupted</dt>
+     <dt id="getting-media-metadata">Once enough of the <span>media
+     data</span> has been fetched to determine the duration of the
+     <span>media resource</span>, its dimensions, and other
+     metadata</dt>
 
-       <dd>
+     <dd>
 
-        <p>Fatal errors in decoding the <span>media data</span> that
-        occur after the user agent has established whether the <var
-        title="">current media resource</var> is usable must cause the
-        user agent to execute the following steps:</p>
+      <p>This indicates that the resource is usable. The user agent
+      must follow these substeps:</p>
 
-        <ol>
+      <ol>
 
-         <li>The user agent should cancel the fetching process.</li>
+       <li><p>Set the <span>current playback position</span> to the
+       <var>earliest possible position</var>.</p></li>
 
-         <li>Set the <code title="dom-media-error">error</code>
-         attribute to a new <code>MediaError</code> object whose <code
-         title="dom-MediaError-code">code</code> attribute is set to
-         <code
-         title="dom-MediaError-MEDIA_ERR_DECODE">MEDIA_ERR_DECODE</code>.</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>Set the <span>begun flag</span> to false and <span>queue
-         a task</span> to <span>fire a progress event</span> called
-         <code title="event-error">error</code> at the <span>media
-         element</span>.</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>Set the element's <code
-         title="dom-media-networkState">networkState</code> attribute
-         to the <span
-         title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</span> value
-         and <span>queue a task</span> to <span>fire a simple
-         event</span> called <code
-         title="event-emptied">emptied</code> at the element.</li>
+       <li>
 
-         <li><p>Set the element's <span>delaying-the-load-event
-         flag</span> to false. This stops <span title="delay the load
-         event">delaying the load event</span>.</p></li>
+        <p>Set the <code title="dom-media-duration">duration</code>
+        attribute to the duration of the resource.</p>
 
-         <li>Abort the overall <code
-         title="dom-media-load">load()</code> method algorithm.</li>
+        <p class="note">The user agent <a
+        href="#durationChange">will</a> <span>queue a task</span> to
+        <span>fire a simple event</span> called <code
+        title="event-durationchange">durationchange</code> at the
+        element at this point.</p>
 
-        </ol>
+       </li>
 
-       </dd>
+       <li id="fire-loadedmetadata"><p><span>Queue a task</span> to
+       <span>fire a simple event</span> called <code
+       title="event-loadedmetadata">loadedmetadata</code> at the
+       element.</li>
 
-       <dt>If the <span>media data</span> fetching process is aborted by
-       the user</dt>
+       <li>
 
-       <dd>
+        <p>If either the <span>media resource</span> or the address
+        of the <var title="">current media resource</var> indicate a
+        particular start time, then <span
+        title="dom-media-seek">seek</span> to that time. Ignore any
+        resulting exceptions (if the position is out of range, it is
+        effectively ignored).</p>
 
-        <p>The fetching process is aborted by the user, e.g. because
-        the user navigated the browsing context to another page, the
-        user agent must execute the following steps. These steps are
-        not followed if the <code title="dom-media-load">load()</code>
-        method itself is reinvoked, as the steps above handle that
-        particular kind of abort.</p>
+        <p class="example">For example, a fragment identifier could be
+        used to indicate a start position.</p>
 
-        <ol>
+       </li>
 
-         <li>The user agent should cancel the fetching process.</li>
-
-         <li>Set the <code title="dom-media-error">error</code>
-         attribute to a new <code>MediaError</code> object whose <code
-         title="dom-MediaError-code">code</code> attribute is set to
-         <code
-         title="dom-MediaError-MEDIA_ERR_ABORT">MEDIA_ERR_ABORT</code>.</li>
-
-         <li>Set the <span>begun flag</span> to false and <span>queue
-         a task</span> to <span>fire a progress event</span> called
-         <code title="event-abort">abort</code> at the <span>media
-         element</span>.</li>
-
-         <li>If the <span>media element</span>'s <code
-         title="dom-media-readyState">readyState</code> attribute has
-         a value equal to <code
-         title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>, set the
-         element's <code
-         title="dom-media-networkState">networkState</code> attribute
-         to the <span
-         title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</span> value
-         and <span>queue a task</span> to <span>fire a simple
-         event</span> called <code
-         title="event-emptied">emptied</code> at the element. (If the
-         <code title="dom-media-readyState">readyState</code>
-         attribute has a value greater than <code
-         title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>, then this
-         doesn't happen; the available data, if any, will be
-         playable.)</li>
-
-         <li><p>Set the element's <span>delaying-the-load-event
-         flag</span> to false. This stops <span title="delay the load
-         event">delaying the load event</span>.</p></li>
-
-         <li>Abort the overall <code
-         title="dom-media-load">load()</code> method algorithm.</li>
+       <li><p>Set the element's <span>delaying-the-load-event
+       flag</span> to false. This stops <span title="delay the load
+       event">delaying the load event</span>.</p></li>
 
-        </ol>
+      </ol>
 
-       </dd>
+      <p class="note">The user agent is <em>required</em> to
+      determine the duration of the <span>media resource</span> and
+      go through this step before playing.</p> <!-- actually defined
+      in the 'duration' section -->
+
+     </dd>
 
-       <dt id="non-fatal-media-error">If the <span>media data</span> can
-       be fetched but has non-fatal errors or uses, in part, codecs that
-       are unsupported, preventing the user agent from rendering the
-       content completely correctly but not preventing playback
-       altogether</dt>
 
-       <dd>
+     <dt>If the connection is interrupted, causing the user agent to
+     give up trying to fetch the resource</dt>
 
-        <p>The server returning data that is partially usable but cannot
-        be optimally rendered must cause the user agent to execute the
-        following steps.</p>
+     <dd>
 
-        <ol>
+      <p>Fatal network errors that occur after the user agent has
+      established whether the <var title="">current media
+      resource</var> is usable must cause the user agent to execute
+      the following steps:</p>
 
-         <li class="XXX">Should we fire a 'warning' event? Set the
-         'error' flag to 'MEDIA_ERR_SUBOPTIMAL' or something?</li>
+      <ol>
 
-        </ol>
+       <li><p>The user agent should cancel the fetching
+       process.</p></li>
 
-       </dd>
+       <li><p>Set the <code title="dom-media-error">error</code>
+       attribute to a new <code>MediaError</code> object whose <code
+       title="dom-MediaError-code">code</code> attribute is set to
+       <code
+       title="dom-MediaError-MEDIA_ERR_NETWORK">MEDIA_ERR_NETWORK</code>.</p></li>
 
-      </dl>
+       <li><p><span>Queue a task</span> to <span>fire a progress
+       event</span> called <code title="event-error">error</code> at
+       the <span>media element</span>.</p></li>
 
-      <p>When the user agent has completely fetched of the entire
-      <span>media resource</span>, it must move on to the next
-      step. This might never happen, e.g. when streaming an infinite
-      resource such as Web radio.</p>
+       <li><p>Set the element's <code
+       title="dom-media-networkState">networkState</code> attribute to
+       the <span title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</span>
+       value and <span>queue a task</span> to <span>fire a simple
+       event</span> called <code title="event-emptied">emptied</code>
+       at the element.</p></li>
 
-     </li>
+       <li><p>Set the element's <span>delaying-the-load-event
+       flag</span> to false. This stops <span title="delay the load
+       event">delaying the load event</span>.</p></li>
 
-     <li><p>If the fetching process completes without errors, then set
-     the <span>begun flag</span> to false, set the <code
-     title="dom-media-networkState">networkState</code> attribute to
-     <code title="dom-media-NETWORK_LOADED">NETWORK_LOADED</code>, and
-     <span>queue a task</span> to <span>fire a progress event</span>
-     called <code title="event-load">load</code> at the
-     element.</p></li>
+       <li><p>Abort the overall <span
+       title="concept-media-load-algorithm">load
+       algorithm</span>.</p></li>
 
-     <li>Then, abort the overall <code
-     title="dom-media-load">load()</code> method algorithm.</li>
+      </ol>
 
-    </ol>
+     </dd>
 
-   </li>
+     <dt id="fatal-decode-error">If the <span>media data</span> is
+     corrupted</dt>
 
-   <li>
+     <dd>
 
-    <p><i>Failure step</i>: No usable resource was found. Run the
-    following steps:</p>
+      <p>Fatal errors in decoding the <span>media data</span> that
+      occur after the user agent has established whether the <var
+      title="">current media resource</var> is usable must cause the
+      user agent to execute the following steps:</p>
 
-    <ol>
+      <ol>
 
-     <li>Set the <code title="dom-media-error">error</code> attribute
-     to a new <code>MediaError</code> object whose <code
-     title="dom-MediaError-code">code</code> attribute is set to <code
-     title="dom-MediaError-MEDIA_ERR_NONE_SUPPORTED">MEDIA_ERR_NONE_SUPPORTED</code>.</li>
+       <li><p>The user agent should cancel the fetching
+       process.</p></li>
 
-     <li>Set the <span>begun flag</span> to false and <span>queue a
-     task</span> to <span>fire a progress event</span> called <code
-     title="event-error">error</code> at the <span>media
-     element</span>.</li>
+       <li><p>Set the <code title="dom-media-error">error</code>
+       attribute to a new <code>MediaError</code> object whose <code
+       title="dom-MediaError-code">code</code> attribute is set to
+       <code
+       title="dom-MediaError-MEDIA_ERR_DECODE">MEDIA_ERR_DECODE</code>.</p></li>
 
-     <li>Set the element's <code
-     title="dom-media-networkState">networkState</code> attribute to
-     the <span title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</span>
-     value and <span>queue a task</span> to <span>fire a simple
-     event</span> called <code title="event-emptied">emptied</code> at
-     the element.</li>
+       <li><p><span>Queue a task</span> to <span>fire a progress
+       event</span> called <code title="event-error">error</code> at
+       the <span>media element</span>.</p></li>
 
-     <li><p>Set the element's <span>delaying-the-load-event
-     flag</span> to false. This stops <span title="delay the load
-     event">delaying the load event</span>.</p></li>
+       <li><p>Set the element's <code
+       title="dom-media-networkState">networkState</code> attribute to
+       the <span title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</span>
+       value and <span>queue a task</span> to <span>fire a simple
+       event</span> called <code title="event-emptied">emptied</code>
+       at the element.</p></li>
 
-    </ol>
+       <li><p>Set the element's <span>delaying-the-load-event
+       flag</span> to false. This stops <span title="delay the load
+       event">delaying the load event</span>.</p></li>
+
+       <li><p>Abort the overall <span
+       title="concept-media-load-algorithm">load
+       algorithm</span>.</p></li>
+
+      </ol>
+
+     </dd>
+
+     <dt>If the <span>media data</span> fetching process is aborted by
+     the user</dt>
+
+     <dd>
+
+      <p>The fetching process is aborted by the user, e.g. because the
+      user navigated the browsing context to another page, the user
+      agent must execute the following steps. These steps are not
+      followed if the <code title="dom-media-load">load()</code>
+      method itself is invoked while these steps are running, as the
+      steps above handle that particular kind of abort.</p>
+
+      <ol>
+
+       <li><p>The user agent should cancel the fetching
+       process.</p></li>
+
+       <li><p>Set the <code title="dom-media-error">error</code>
+       attribute to a new <code>MediaError</code> object whose <code
+       title="dom-MediaError-code">code</code> attribute is set to
+       <code
+       title="dom-MediaError-MEDIA_ERR_ABORT">MEDIA_ERR_ABORT</code>.</p></li>
+
+       <li><p><span>Queue a task</span> to <span>fire a progress
+       event</span> called <code title="event-abort">abort</code> at
+       the <span>media element</span>.</p></li>
+
+       <li><p>If the <span>media element</span>'s <code
+       title="dom-media-readyState">readyState</code> attribute has a
+       value equal to <code
+       title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>, set the
+       element's <code
+       title="dom-media-networkState">networkState</code> attribute to
+       the <span title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</span>
+       value and <span>queue a task</span> to <span>fire a simple
+       event</span> called <code title="event-emptied">emptied</code>
+       at the element. Otherwise, set set the element's <code
+       title="dom-media-networkState">networkState</code> attribute to
+       the <span title="dom-media-NETWORK_IDLE">NETWORK_IDLE</span>
+       value.</p></li>
+
+       <li><p>Set the element's <span>delaying-the-load-event
+       flag</span> to false. This stops <span title="delay the load
+       event">delaying the load event</span>.</p></li>
+
+       <li><p>Abort the overall <span
+       title="concept-media-load-algorithm">load
+       algorithm</span>.</p></li>
+
+      </ol>
+
+     </dd>
+
+     <dt id="non-fatal-media-error">If the <span>media data</span> can
+     be fetched but has non-fatal errors or uses, in part, codecs that
+     are unsupported, preventing the user agent from rendering the
+     content completely correctly but not preventing playback
+     altogether</dt>
+
+     <dd>
+
+      <p>The server returning data that is partially usable but cannot
+      be optimally rendered must cause the user agent to execute the
+      following steps.</p>
+
+      <ol>
+
+       <li class="XXX">Should we fire a 'warning' event? Set the
+       'error' flag to 'MEDIA_ERR_SUBOPTIMAL' or something?</li>
+
+      </ol>
+
+     </dd>
+
+    </dl>
+
+    <p>When the user agent has completely fetched of the entire
+    <span>media resource</span>, it must move on to the next
+    step. This might never happen, e.g. when streaming an infinite
+    resource such as Web radio.</p>
 
    </li>
 
+   <li><p>If the fetching process completes without errors, then set
+   the <code title="dom-media-networkState">networkState</code>
+   attribute to <code
+   title="dom-media-NETWORK_LOADED">NETWORK_LOADED</code>, and
+   <span>queue a task</span> to <span>fire a progress event</span>
+   called <code title="event-load">load</code> at the
+   element.</p></li>
+
+   <li><p>Then, abort the overall <span
+   title="concept-media-load-algorithm">load
+   algorithm</span>.</p></li>
+
   </ol>
 
   <p>If a <span>media element</span> whose <code
   title="dom-media-networkState">networkState</code> has the value
   <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> is <span
   title="insert an element into a document">inserted into a
-  document</span>, the user agent must <span>queue a task</span> that
-  implicitly invokes the <code title="dom-media-load">load()</code>
-  method on the <span>media element</span>, and ignores any resulting
-  exceptions. The <span>task source</span> for this task is the
-  <span>media element</span>'s own <span>media element new resource
-  task source</span>.</p>
+  document</span>, the user agent must asynchronously invoke the
+  <span>media element</span>'s <span
+  title="concept-media-load-algorithm">load algorithm</span>.</p>
 
   <p>The <dfn
   title="dom-media-bufferingRate"><code>bufferingRate</code></dfn>
   attribute must return the average number of bits received per second
   for the current download over the past few seconds. If there is no
   download in progress, the attribute must return 0.</p>
 
   <p>The <dfn
   title="dom-media-bufferingThrottled"><code>bufferingThrottled</code></dfn>
   attribute must return true if the user agent is intentionally
@@ -20976,24 +21042,23 @@ interface <dfn>CueRangeCallback</dfn> {
   <p>When the <dfn title="dom-media-play"><code>play()</code></dfn>
   method on a <span>media element</span> is invoked, the user agent
   must run the following steps.</p>
 
   <ol>
 
    <li><p>If the <span>media element</span>'s <code
    title="dom-media-networkState">networkState</code> attribute has
    the value <code
    title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then the user
-   agent must invoke the <code title="dom-media-load">load()</code>
-   method and wait for it to return. If that raises an exception, that
-   exception must be reraised by the <code
-   title="dom-media-play">play()</code> method.</p></li>
+   agent must invoke the <span>media element</span>'s <span
+   title="concept-media-load-algorithm">load
+   algorithm</span>.</p></li>
 
    <li>
 
     <p>If the <span title="ended playback">playback has ended</span>,
     then the user agent must <span title="dom-media-seek">seek</span>
     to the <var>earliest possible position</var> of the <span>media
     resource</span>.</p>
 
     <p class="note">This <a href="#seekUpdate">will cause</a> the user
     agent to <span>queue a task</span> to <span>fire a simple
@@ -21004,41 +21069,43 @@ interface <dfn>CueRangeCallback</dfn> {
 
    </li>
 
    <li>
 
     <p>If the <span>media element</span>'s <code
     title="dom-media-paused">paused</code> attribute is true, it must
     be set to false.</p>
 
     <p>If this changed the value of <code
-    title="dom-media-paused">paused</code>, the user agent must run the following substeps:</p>
+    title="dom-media-paused">paused</code>, the user agent must run
+    the following substeps:</p>
 
     <ol>
 
      <li><p><span>Queue a task</span> to <span>fire a simple event</span>
      called <code title="event-play">play</code> at the element.</p></li>
 
      <li><p>If the <span>media element</span>'s <code
      title="dom-media-readyState">readyState</code> attribute has the
-     value <code title="dom-media-HAVE_METADATA">HAVE_METADATA</code>
-     or <code
+     value <code title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>,
+     <code title="dom-media-HAVE_METADATA">HAVE_METADATA</code>, or
+     <code
      title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code>,
      <span>queue a task</span> to <span>fire a simple event</span>
      called <code title="event-waiting">waiting</code> at the
      element.</p></li>
 
      <li><p>Otherwise, the <span>media element</span>'s <code
-     title="dom-media-readyState">readyState</code> attribute has the value
-     <code title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>
-     or <code
-     title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</code>;
+     title="dom-media-readyState">readyState</code> attribute has the
+     value <code
+     title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code> or
+     <code title="dom-media-HAVE_ENOUGH_DATA">HAVE_ENOUGH_DATA</code>;
      <span>queue a task</span> to <span>fire a simple event</span>
      called <code title="event-playing">playing</code> at the
      element.</p></li>
 
     </ol>
 
    </li>
 
    <li><p>The <span>media element</span>'s <span>autoplaying
    flag</span> must be set to false.</p></li>
@@ -21051,34 +21118,31 @@ interface <dfn>CueRangeCallback</dfn> {
 
   <p>When the <dfn title="dom-media-pause"><code>pause()</code></dfn>
   method is invoked, the user agent must run the following steps:</p>
 
   <ol>
 
    <li><p>If the <span>media element</span>'s <code
    title="dom-media-networkState">networkState</code> attribute has
    the value <code
    title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then the user
-   agent must invoke the <code title="dom-media-load">load()</code>
-   method and wait for it to return. If that raises an exception, that
-   exception must be reraised by the <code
-   title="dom-media-play">pause()</code> method.</p></li>
+   agent must invoke the <span>media element</span>'s <span
+   title="concept-media-load-algorithm">load
+   algorithm</span>.</p></li>
 
    <li><p>If the <span>media element</span>'s <code
    title="dom-media-paused">paused</code> attribute is false, it must
    be set to true.</p></li>
 
    <li><p>The <span>media element</span>'s <span>autoplaying
    flag</span> must be set to false.</p></li>
 
-   <li><p>The method must then return.</p></li>
-
    <li><p>If the second step above changed the value of <code
    title="dom-media-paused">paused</code>, then the user agent must
    <span>queue a task</span> to <span>fire a simple event</span>
    called <code title="event-timeupdate">timeupdate</code> at the
    element, and <span>queue a task</span> to <span>fire a simple
    event</span> called <code title="event-pause">pause</code> at the
    element.</p></li>
 
   </ol>
 
@@ -21481,53 +21545,53 @@ interface <dfn>CueRangeCallback</dfn> {
     <tr>
      <th>Event name
      <th>Interface
      <th>Dispatched when...
      <th>Preconditions
 
    <tbody>
     <tr>
      <td><dfn title="event-loadstart"><code>loadstart</code></dfn>
      <td><code>ProgressEvent</code> <a href="#refsPROGRESS">[PROGRESS]</a>
-     <td>The user agent begins fetching the <span>media data</span>, synchronously during the <code title="dom-media-load">load()</code> method call.
+     <td>The user agent begins looking for <span>media data</span>, as part of the <span title="concept-media-load-algorithm">load algorithm</span>.
      <td><code title="dom-media-networkState">networkState</code> equals <code title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>
     <tr>
      <td><dfn title="event-progress"><code>progress</code></dfn>
      <td><code>ProgressEvent</code> <a href="#refsPROGRESS">[PROGRESS]</a>
      <td>The user agent is fetching <span>media data</span>.
      <td><code title="dom-media-networkState">networkState</code> equals <code title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>
     <tr>
      <td><dfn title="event-suspend"><code>suspend</code></dfn>
      <td><code>ProgressEvent</code> <a href="#refsPROGRESS">[PROGRESS]</a>
      <td>The user agent is intentionally not currently fetching <span>media data</span>, but does not have the entire <span>media resource</span> downloaded.
      <td><code title="dom-media-networkState">networkState</code> equals <code title="dom-media-NETWORK_IDLE">NETWORK_IDLE</code>
     <tr>
      <td><dfn title="event-load"><code>load</code></dfn>
      <td><code>ProgressEvent</code> <a href="#refsPROGRESS">[PROGRESS]</a>
      <td>The user agent finishes fetching the entire <span>media resource</span>.
      <td><code title="dom-media-networkState">networkState</code> equals <code title="dom-media-NETWORK_LOADED">NETWORK_LOADED</code>
     <tr>
      <td><dfn title="event-abort"><code>abort</code></dfn>
      <td><code>ProgressEvent</code> <a href="#refsPROGRESS">[PROGRESS]</a>
-     <td>The user agent stops fetching the <span>media data</span> before it is completely downloaded. This can be fired synchronously during the <code title="dom-media-load">load()</code> method call.
+     <td>The user agent stops fetching the <span>media data</span> before it is completely downloaded.
      <td><code title="dom-media-error">error</code> is an object with the code <code title="dom-MediaError-MEDIA_ERR_ABORTED">MEDIA_ERR_ABORTED</code>.
          <code title="dom-media-networkState">networkState</code> equals either <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> or <code title="dom-media-NETWORK_LOADED">NETWORK_LOADED</code>, depending on when the download was aborted.
     <tr>
      <td><dfn title="event-error"><code>error</code></dfn>
      <td><code>ProgressEvent</code> <a href="#refsPROGRESS">[PROGRESS]</a>
      <td>An error occurs while fetching the <span>media data</span>.
      <td><code title="dom-media-error">error</code> is an object with the code <code title="dom-MediaError-MEDIA_ERR_NETWORK">MEDIA_ERR_NETWORK</code> or higher.
          <code title="dom-media-networkState">networkState</code> equals either <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> or <code title="dom-media-NETWORK_LOADED">NETWORK_LOADED</code>, depending on when the download was aborted.
     <tr>
      <td><dfn title="event-emptied"><code>emptied</code></dfn>
      <td><code>Event</code>
-     <td>A <span>media element</span> whose <code title="dom-media-networkState">networkState</code> was previously not in the <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> state has just switched to that state (either because of a fatal error during load that's about to be reported, or because the <code title="dom-media-load">load()</code> method was reinvoked, in which case it is fired synchronously during the <code title="dom-media-load">load()</code> method call).
+     <td>A <span>media element</span> whose <code title="dom-media-networkState">networkState</code> was previously not in the <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> state has just switched to that state (either because of a fatal error during load that's about to be reported, or because the <code title="dom-media-load">load()</code> method was invoked while the <span title="concept-media-load-algorithm">load algorithm</span> was already running, in which case it is fired synchronously during the <code title="dom-media-load">load()</code> method call).
      <td><code title="dom-media-networkState">networkState</code> is <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>; all the DOM attributes are in their initial states.
     <tr>
      <td><dfn title="event-stalled"><code>stalled</code></dfn>
      <td><code>ProgressEvent</code>
      <td>The user agent is trying to fetch <span>media data</span>, but data is unexpectedly not forthcoming.
      <td><code title="dom-media-networkState">networkState</code> is <code title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.
 
    <tbody>
     <tr>
      <td><dfn title="event-play"><code>play</code></dfn>

|