[html5] r2849 - [gw] (2) Change the way resources are loaded for media elements to make it actua [...]
whatwg at whatwg.org
whatwg at whatwg.org
Sun Feb 22 23:19:50 PST 2009
Author: ianh
Date: 2009-02-22 23:19:49 -0800 (Sun, 22 Feb 2009)
New Revision: 2849
Modified:
index
source
Log:
[gw] (2) Change the way resources are loaded for media elements to make it actually work.
Modified: index
===================================================================
--- index 2009-02-22 09:28:30 UTC (rev 2848)
+++ index 2009-02-23 07:19:49 UTC (rev 2849)
@@ -34,7 +34,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
- <h2 class="no-num no-toc" id=draft-recommendation-—-date:-01-jan-1901>Draft Recommendation — 22 February 2009</h2>
+ <h2 class="no-num no-toc" id=draft-recommendation-—-date:-01-jan-1901>Draft Recommendation — 23 February 2009</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<dl><dt>Multiple-page version:</dt>
@@ -18006,7 +18006,7 @@
these must return a new <code><a href=#htmlaudioelement>HTMLAudioElement</a></code> object (a new
<code><a href=#audio>audio</a></code> element). If the <var title="">src</var> argument
is present, the object created must have its <code title=dom-media-src><a href=#dom-media-src>src</a></code> content attribute set to the
- provided value, and the user agent must invoke the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method on the object before
+ provided value, and the user agent must invoke the object's <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a> before
returning.</p>
@@ -18155,14 +18155,6 @@
<a href=#media-resource>media resource</a> 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><a href=#the-source-element>source</a></code> element is inserted into a <a href=#media-element>media
- element</a> that is already in a document and whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is in the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> state, the user
- agent must <a href=#queue-a-task>queue a task</a> that implicitly invokes the
- <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method on the <a href=#media-element>media
- element</a>, and ignores any resulting exceptions. The <a href=#task-source>task
- source</a> for this task is the <a href=#media-element>media element</a>'s own
- <a href=#media-element-new-resource-task-source>media element new resource task source</a>.</p>
-
<p>The DOM attributes <dfn id=dom-source-src title=dom-source-src><code>src</code></dfn>, <dfn id=dom-source-type title=dom-source-type><code>type</code></dfn>, and <dfn id=dom-source-media title=dom-source-media><code>media</code></dfn> must
<a href=#reflect>reflect</a> the respective content attributes of the same
name.</p>
@@ -18186,6 +18178,7 @@
const unsigned short <a href=#dom-media-network_idle title=dom-media-NETWORK_IDLE>NETWORK_IDLE</a> = 1;
const unsigned short <a href=#dom-media-network_loading title=dom-media-NETWORK_LOADING>NETWORK_LOADING</a> = 2;
const unsigned short <a href=#dom-media-network_loaded title=dom-media-NETWORK_LOADED>NETWORK_LOADED</a> = 3;
+ const unsigned short <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a> = 4;
readonly attribute unsigned short <a href=#dom-media-networkstate title=dom-media-networkState>networkState</a>;
readonly attribute float <a href=#dom-media-bufferingrate title=dom-media-bufferingRate>bufferingRate</a>;
readonly attribute boolean <a href=#dom-media-bufferingthrottled title=dom-media-bufferingThrottled>bufferingThrottled</a>;
@@ -18276,23 +18269,21 @@
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><a href=#media-element title="media element">Media elements</a> use two <a href=#task-queue title="task queue">task queues</a>, the <dfn id=media-element-event-task-source>media element event
- task source</dfn> for asynchronous events and callbacks, and the
- <dfn id=media-element-new-resource-task-source>media element new resource task source</dfn> for handling
- implicit loads. Unless otherwise specified, the <a href=#task-source>task
- source</a> for all the tasks <a href=#queue-a-task title="queue a
- task">queued</a> in this section and its subsections is the
- <a href=#media-element-event-task-source>media element event task source</a>.</p>
+ <p>Unless otherwise specified, the <a href=#task-source>task source</a> for all
+ the tasks <a href=#queue-a-task title="queue a task">queued</a> in this section
+ and its subsections is the <dfn id=media-element-event-task-source>media element event task
+ source</dfn>.</p>
<h5 id=error-codes><span class=secno>4.8.10.1 </span>Error codes</h5>
<p>All <a href=#media-element title="media element">media elements</a> have an
associated error status, which records the last error the element
- encountered since the <code title=dom-media-load><a href=#dom-media-load>load()</a></code>
- method was last invoked. The <dfn id=dom-media-error title=dom-media-error><code>error</code></dfn> attribute, on
- getting, must return the <code><a href=#mediaerror>MediaError</a></code> object created for
- this last error, or null if there has not been an error.</p>
+ encountered since its <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a> was last
+ invoked. The <dfn id=dom-media-error title=dom-media-error><code>error</code></dfn>
+ attribute, on getting, must return the <code><a href=#mediaerror>MediaError</a></code>
+ object created for this last error, or null if there has not been an
+ error.</p>
<pre class=idl>interface <dfn id=mediaerror>MediaError</dfn> {
const unsigned short <a href=#dom-mediaerror-media_err_aborted title=dom-MediaError-MEDIA_ERR_ABORTED>MEDIA_ERR_ABORTED</a> = 1;
@@ -18334,22 +18325,6 @@
the address of the media resource (video, audio) to show. The
attribute, if present, must contain a <a href=#valid-url>valid URL</a>.</p>
- <p>If the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute of a
- <a href=#media-element>media element</a> that is already in a document and whose
- <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is in the
- <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> state is
- added, changed, or removed, the user agent must <a href=#queue-a-task>queue a
- task</a> that implicitly invokes the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method on the <a href=#media-element>media
- element</a>, and ignores any resulting exceptions. The <a href=#task-source>task
- source</a> for this task is the <a href=#media-element>media element</a>'s own
- <a href=#media-element-new-resource-task-source>media element new resource task source</a>.</p>
-
- <p class=note>If a <code title=attr-media-src><a href=#attr-media-src>src</a></code>
- attribute is specified, the resource it specifies is the <a href=#media-resource>media
- resource</a> that will be used. Otherwise, the resource specified
- by the first suitable <code><a href=#the-source-element>source</a></code> element child of the
- <a href=#media-element>media element</a> is the one used.</p>
-
<p>The <dfn id=dom-media-src title=dom-media-src><code>src</code></dfn> DOM
attribute on <a href=#media-element title="media element">media elements</a> must
<a href=#reflect>reflect</a> the respective content attribute of the same
@@ -18357,88 +18332,18 @@
<p>The <dfn id=dom-media-currentsrc 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><a href=#dom-media-load>load()</a></code> method
+ <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a>
defined below.</p>
- <p>To <dfn id=generate-the-list-of-potential-media-resources>generate the list of potential media resources</dfn> for
- a <a href=#media-element>media element</a>, a user agent must use the following
- steps. These steps return a list of <a href=#absolute-url title="absolute
- URL">absolute URLs</a> giving a resource's address.</p>
+ <p class=note>There are two ways to specify a <a href=#media-resource>media
+ resource</a>, the <code title=attr-media-src><a href=#attr-media-src>src</a></code>
+ attribute, or <code><a href=#the-source-element>source</a></code> elements. The attribute overrides
+ the elements.</p>
- <ol><li>
- <p>If the <a href=#media-element>media element</a> has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute, then run these
- substeps:</p>
- <ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the
- <a href=#url>URL</a> given in that attribute, relative to the
- <a href=#media-element>media element</a>.</p>
+ <h5 id=media-types><span class=secno>4.8.10.3 </span>Media types</h5>
- <li><p>If that is successful, then return a list consisting of
- only one entry, the resulting <a href=#absolute-url>absolute URL</a> as the
- resource's address.</li>
-
- <li><p>Otherwise, return the empty list.</li>
-
- <li><p>Abort the algorithm.</li>
-
- </ol><p>Otherwise, the <code><a href=#the-source-element>source</a></code> elements will be used.</p>
-
- </li>
-
- <li><p>If the <a href=#media-element>media element</a> has no <code><a href=#the-source-element>source</a></code>
- element children, then return the empty the list and abort these
- steps.</li>
-
- <li><p>Let <var title="">result</var> be an empty list.</li>
-
- <li><p>Let <var title="">candidate</var> be the first
- <code><a href=#the-source-element>source</a></code> element child in the <a href=#media-element>media
- element</a>.</li>
-
- <li><p><i>Loop</i>: this is the start of the loop that looks at the
- <code><a href=#the-source-element>source</a></code> elements.</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><a href=#attr-source-src>src</a></code> attribute.</li>
-
- <li><a href=#resolve-a-url title="resolve a url">Resolving</a> the
- <a href=#url>URL</a> given by the <var title="">candidate</var>
- element's <code title=attr-source-src><a href=#attr-source-src>src</a></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><a href=#attr-source-type>type</a></code> attribute, or its <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute's value, when
- parsed as a MIME type (including any codecs described by the
- <code title="">codec</code> parameter), does not represent
- <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot
- render</a>.</li>
-
- <li>The <var title="">candidate</var> element either has no <code title=attr-source-media><a href=#attr-source-media>media</a></code> attribute, or its <code title=attr-source-media><a href=#attr-source-media>media</a></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 <a href=#absolute-url>absolute URL</a> resulting from
- <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a>
- given in that <var title="">candidate</var> element's <code title=attr-source-src><a href=#attr-source-src>src</a></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><a href=#the-source-element>source</a></code> element child in the <a href=#media-element>media
- element</a>, or null if there are no more such
- children.</li>
-
- <li><p>If <var title="">candidate</var> is not null, return to the
- step labeled <i>loop</i>.</li>
-
- <li><p>Return <var title="">result</var>.</li>
-
- </ol><h5 id=media-types><span class=secno>4.8.10.3 </span>Media types</h5>
-
<p>A <a href=#media-resource>media resource</a> 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>
@@ -18521,9 +18426,9 @@
<dt><dfn id=dom-media-network_idle title=dom-media-NETWORK_IDLE><code>NETWORK_IDLE</code></dfn> (numeric value 1)</dt>
- <dd>The element's <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method
- algorithm is active, but it is not actually using the network at
- this time.</dd>
+ <dd>The element's <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a> is active and has selected a resource, but it is
+ not actually using the network at this time.</dd>
<dt><dfn id=dom-media-network_loading title=dom-media-NETWORK_LOADING><code>NETWORK_LOADING</code></dfn> (numeric value 2)</dt>
@@ -18535,8 +18440,14 @@
available to the user agent locally. Network connectivity could be
lost without affecting the media playback.</dd>
- </dl><p>The algorithm for the <code title=dom-media-load><a href=#dom-media-load>load()</a></code>
- method defined below describes exactly when the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute changes
+ <dt><dfn id=dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE><code>NETWORK_NO_SOURCE</code></dfn> (numeric value 4)</dt>
+
+ <dd>The element's <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a> is active, but it has failed to find a resource to
+ use.</dd>
+
+ </dl><p>The <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a> defined below describes exactly when the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></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
@@ -18545,8 +18456,7 @@
<h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the media resource</h5>
- <p>All <a href=#media-element title="media element">media elements</a> have a
- <dfn id=begun-flag>begun flag</dfn>, which must begin in the false state, an
+ <p>All <a href=#media-element title="media element">media elements</a> have an
<dfn id=autoplaying-flag>autoplaying flag</dfn>, which must begin in the true state, and
a <dfn id=delaying-the-load-event-flag>delaying-the-load-event flag</dfn>, which must begin in the
false state. While the <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> is
@@ -18558,32 +18468,27 @@
aborted, e.g. if the <code title=dom-media-load><a href=#dom-media-load>load()</a></code>
method itself is invoked again.</p>
- <ol><li>
+ <ol><li><p>If the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method for
+ this element is already being invoked, then abort these
+ steps.</li>
+ <li><p>Abort any already-running instance of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a> for this
+ element.</li>
+
+ <li>
+
<p>If there are any <a href=#concept-task title=concept-task>tasks</a> from
- the <a href=#media-element>media element</a>'s <a href=#media-element-new-resource-task-source>media element new resource
- task source</a> or its <a href=#media-element-event-task-source>media element event task
+ the <a href=#media-element>media element</a>'s <a href=#media-element-event-task-source>media element event task
source</a> in one of the <a href=#task-queue title="task queue">task
queues</a>, 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.</li>
-
- <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a>
- to true. This <a href=#delay-the-load-event title="delay the load event">delays the load
- event</a>.</li>
-
- <li><p>If the element's <a href=#begun-flag>begun flag</a> is true, then set
- the <a href=#begun-flag>begun flag</a> to false, set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
+ <li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is set to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code> or <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
<code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to <code title=dom-MediaError-MEDIA_ERR_ABORTED><a href=#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a></code>,
and <a href=#fire-a-progress-event>fire a progress event</a> called <code title=event-abort><a href=#event-abort>abort</a></code> at the <a href=#media-element>media
element</a>.</li>
@@ -18595,10 +18500,12 @@
value of the <code title=dom-media-defaultPlaybackRate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
attribute.</li>
- <li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is not set to
- <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then
- run these substeps:</p>
+ <li>
+ <p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is not set to
+ <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then
+ run these substeps:</p>
+
<ol><li><p>If a fetching process is in progress for the <a href=#media-element>media
element</a>, the user agent should stop it.</li>
@@ -18635,348 +18542,496 @@
</ol></li>
- <li><p><a href=#generate-the-list-of-potential-media-resources>Generate the list of potential media resources</a>
- and let the resulting list be <var title="">candidates</var>.</li>
+ <li><p>Asynchronously invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a>.</li>
- <li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
-
- <li><p>Set the <a href=#begun-flag>begun flag</a> to true and <a href=#queue-a-task>queue a
- task</a> to <a href=#fire-a-progress-event>fire a progress event</a> called <code title=event-loadstart><a href=#event-loadstart>loadstart</a></code> at the <a href=#media-element>media
- element</a>.</li>
-
<li>
- <p>The method must return, but these steps must continue.</p>
-
<p class=note>Playback of any previously playing <a href=#media-resource>media
resource</a> for this element stops.</p>
</li>
+ </ol><p>The <dfn id=concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</dfn> for a <a href=#media-element>media element</a> is as follows. This
+ algorithm is always invoked asynchronously, meaning that it runs in
+ the background with scripts and other <a href=#concept-task title=concept-task>tasks</a> running in parallel.</p>
- <!-- SYNCHRONOUS / ASYNCHRONOUS BOUNDARY FOR EVENT DISPATCH -->
+ <ol><li><p>While the <a href=#media-element>media element</a> has neither a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute nor any
+ <code><a href=#the-source-element>source</a></code> element children, wait. (This steps might wait
+ forever.)</li>
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a>
+ to true. This <a href=#delay-the-load-event title="delay the load event">delays the load
+ event</a>.</li>
+ <li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
+ event</a> called <code title=event-loadstart><a href=#event-loadstart>loadstart</a></code>
+ at the <a href=#media-element>media element</a>.</li>
+
<li>
- <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>If the <a href=#media-element>media element</a> has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute, then run these
+ substeps:</p>
- <ol><li><p>Let the <var title="">current media resource</var> be the
- resource given by the <a href=#absolute-url>absolute URL</a> for the current
- item in <var title="">candidates</var>. This is now the element's
- <a href=#media-resource>media resource</a>.</li>
+ <ol><li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the
+ <a href=#url>URL</a> given in that attribute, relative to the
+ <a href=#media-element>media element</a>.</p>
- <li><p>Set the <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to the
- <a href=#absolute-url>absolute URL</a> of the <var title="">current media
- resource</var>.</li>
+ <li><p>If that is successful, then run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource-load
+ algorithm</a> with the resulting <a href=#absolute-url>absolute URL</a>. If
+ that algorithm returns without aborting <em>this</em> one, then
+ the load failed.</li>
+ <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><a href=#dom-media-error>error</a></code> attribute to a new
+ <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to <code title=dom-MediaError-MEDIA_ERR_NONE_SUPPORTED><a href=#dom-mediaerror-media_err_none_supported>MEDIA_ERR_NONE_SUPPORTED</a></code>.</li>
+
+ <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a>
+ value.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
+ event</a> called <code title=event-error><a href=#event-error>error</a></code> at the
+ <a href=#media-element>media element</a>.</li>
+
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a>
+ to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying
+ the load event</a>.</li>
+
+ <li><p>Abort these steps. Until the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method is invoked, the
+ element won't attempt to load another resource.</li>
+ <!-- it took its ball and went home, sulking. -->
+
+ </ol><p>Otherwise, the <code><a href=#the-source-element>source</a></code> elements will be used; run
+ these substeps:</p>
+
+ <ol><li>
+
+ <p>Let <var title="">pointer</var> be a position defined by two
+ adjacent nodes in the <a href=#media-element>media element</a>'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
+ <a href=#media-element>media element</a>, if there are any, or the end of the
+ list, if it is empty).</p>
+
+ <p>As elements are inserted and removed into the <a href=#media-element>media
+ element</a>, <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 <a href=#fetch>fetch</a> the <var title="">current media
- resource</var>.</p>
+ <p><i>Search loop:</i> Run these substeps atomically (so that
+ the DOM cannot change while they are running):</p>
- <p>Every 350ms (±200ms) or for every byte received,
- whichever is <em>least</em> frequent, <a href=#queue-a-task>queue a task</a>
- to <a href=#fire-a-progress-event>fire a progress event</a> called <code title=event-progress><a href=#event-progress>progress</a></code> at the element.</p>
+ <ol><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>.</li>
- <p>If at any point the user agent has received no data for more
- than about three seconds, then <a href=#queue-a-task>queue a task</a> to
- <a href=#fire-a-progress-event>fire a progress event</a> called <code title=event-stalled><a href=#event-stalled>stalled</a></code> at the element.</p>
+ <li><p>If the node after <var title="">pointer</var> is a
+ <code><a href=#the-source-element>source</a></code> element, let <var title="">candidate</var>
+ be that element; otherwise, let <var title="">candidate</var>
+ be null.</li>
- <p>User agents may allow users to selectively block or slow
- <a href=#media-data>media data</a> downloads. When a <a href=#media-element>media
- element</a>'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>
+ <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>.</li>
- <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 <a href=#media-element>media element</a>'s
- download has been suspended, the user agent must set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> and
- <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-progress-event>fire a progress event</a>
- called <code title=event-suspend><a href=#event-suspend>suspend</a></code> at the
- element. If and when downloading of the resource resumes, the
- user agent must set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</p>
+ <li><p>If <var title="">candidate</var> is null, restart the
+ step labelled <i>search loop</i> from the first
+ substep.</li>
- <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>
+ </ol></li>
- <p>The <a href=#networking-task-source>networking task source</a> <a href=#concept-task title=concept-task>tasks</a> to process the data as it is
- being fetched must, when appropriate, include the relevant
- substeps from the following list:</p>
+ <li>
- <dl class=switch><dt>If the <a href=#media-data>media data</a> cannot be fetched at all, due
- to network errors, causing the user agent to give up trying to
- fetch the resource</dt>
+ <p>If any of the following conditions are true, then jump back
+ to the step labelled <i>search loop</i>:</p>
- <dt>If the <a href=#media-data>media data</a> can be fetched but is in an
- unsupported format, or can otherwise not be rendered at
- all</dt>
+ <ul><li>The <var title="">candidate</var> element does not have a
+ <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute.</li>
- <dd>
+ <li><a href=#resolve-a-url title="resolve a url">Resolving</a> the
+ <a href=#url>URL</a> given by the <var title="">candidate</var>
+ element's <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute
+ relative to <var title="">candidate</var> fails.</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>The <var title="">candidate</var> element has a <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute whose value,
+ when parsed as a MIME type (including any codecs described by
+ the <code title="">codec</code> parameter), represents <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a
+ type that the user agent knows it cannot render</a>.</li>
- <ol><li><p>The user agent should cancel the fetching
- process.</li>
+ <li>The <var title="">candidate</var> element has a <code title=attr-source-media><a href=#attr-source-media>media</a></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>
- <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>
+ </ul></li>
- </ol></dd>
+ <li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code> again,
+ in case it was set to <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code>
+ above.</li>
+ <li><p>Run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource-load
+ algorithm</a> with the <a href=#absolute-url>absolute URL</a> that resulted
+ from <a href=#resolve-a-url title="resolve a url">resolving</a> the
+ <a href=#url>URL</a> given by the <var title="">candidate</var>
+ element's <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute
+ relative to <var title="">candidate</var>. If that algorithm
+ returns without aborting <em>this</em> one, then the load
+ failed.</li>
- <dt id=getting-media-metadata>Once enough of the <a href=#media-data>media
- data</a> has been fetched to determine the duration of the
- <a href=#media-resource>media resource</a>, its dimensions, and other
- metadata</dt>
+ <li><p>Return to the step labeled <i>search loop</i>.</li>
- <dd>
+ <li><p><i>Waiting:</i> Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
+ <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to <code title=dom-MediaError-MEDIA_ERR_NONE_SUPPORTED><a href=#dom-mediaerror-media_err_none_supported>MEDIA_ERR_NONE_SUPPORTED</a></code>.</li>
- <p>This indicates that the resource is usable. The user agent
- must follow these substeps:</p>
+ <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a>
+ value</li>
- <ol><li><p>Set the <a href=#current-playback-position>current playback position</a> to the
- <var><a href=#earliest-possible-position>earliest possible position</a></var>.</li>
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
+ event</a> called <code title=event-error><a href=#event-error>error</a></code> at the
+ <a href=#media-element>media element</a>.</li>
- <li><p>Set the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute to
- <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>.</li>
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a>
+ to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying
+ the load event</a>.</li>
- <li><p>For <code><a href=#video>video</a></code> elements, set the <code title=dom-video-videoWidth><a href=#dom-video-videowidth>videoWidth</a></code> and <code title=dom-video-videoHeight><a href=#dom-video-videoheight>videoHeight</a></code>
- attributes.</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.)</li>
- <li>
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> back to true. This <a href=#delay-the-load-event title="delay the load
+ event">delays the load event</a> again, in case it hasn't gone
+ been fired yet.</li>
- <p>Set the <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code>
- attribute to the duration of the resource.</p>
+ </ol></li>
- <p class=note>The user agent <a href=#durationChange>will</a> <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-durationchange><a href=#event-durationchange>durationchange</a></code> at the
- element at this point.</p>
+ </ol><p>The <dfn id=concept-media-load-resource title=concept-media-load-resource>resource-load
+ algorithm</dfn> for a <a href=#media-element>media element</a> and a given
+ <a href=#absolute-url>absolute URL</a> is as follows:</p>
- </li>
+ <ol><li><p>Let the <var title="">current media resource</var> be the
+ resource given by the <a href=#absolute-url>absolute URL</a> passed to this
+ algorithm. This is now the element's <a href=#media-resource>media
+ resource</a>.</li>
- <li id=fire-loadedmetadata><p><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-loadedmetadata><a href=#event-loadedmetadata>loadedmetadata</a></code> at the
- element.</li>
+ <li><p>Set the <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to the
+ <a href=#absolute-url>absolute URL</a> of the <var title="">current media
+ resource</var>.</li>
- <li>
+ <li>
- <p>If either the <a href=#media-resource>media resource</a> or the address
- of the <var title="">current media resource</var> indicate a
- particular start time, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time. Ignore any
- resulting exceptions (if the position is out of range, it is
- effectively ignored).</p>
+ <p>Begin to <a href=#fetch>fetch</a> the <var title="">current media
+ resource</var>.</p>
- <p class=example>For example, a fragment identifier could be
- used to indicate a start position.</p>
+ <p>Every 350ms (±200ms) or for every byte received,
+ whichever is <em>least</em> frequent, <a href=#queue-a-task>queue a task</a>
+ to <a href=#fire-a-progress-event>fire a progress event</a> called <code title=event-progress><a href=#event-progress>progress</a></code> at the element.</p>
- </li>
+ <p>If at any point the user agent has received no data for more
+ than about three seconds, then <a href=#queue-a-task>queue a task</a> to
+ <a href=#fire-a-progress-event>fire a progress event</a> called <code title=event-stalled><a href=#event-stalled>stalled</a></code> at the element.</p>
- <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
- flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
- event">delaying the load event</a>.</li>
+ <p>User agents may allow users to selectively block or slow
+ <a href=#media-data>media data</a> downloads. When a <a href=#media-element>media
+ element</a>'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>
- </ol><p class=note>The user agent is <em>required</em> to
- determine the duration of the <a href=#media-resource>media resource</a> and
- go through this step before playing.</p> <!-- actually defined
- in the 'duration' section -->
+ <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 <a href=#media-element>media element</a>'s
+ download has been suspended, the user agent must set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> and
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-progress-event>fire a progress event</a>
+ called <code title=event-suspend><a href=#event-suspend>suspend</a></code> at the
+ element. If and when downloading of the resource resumes, the
+ user agent must set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</p>
- </dd>
+ <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 <a href=#networking-task-source>networking task source</a> <a href=#concept-task title=concept-task>tasks</a> to process the data as it is
+ being fetched must, when appropriate, include the relevant
+ substeps from the following list:</p>
- <dt>If the connection is interrupted, causing the user agent to
- give up trying to fetch the resource</dt>
+ <dl class=switch><dt>If the <a href=#media-data>media data</a> cannot be fetched at all, due
+ to network errors, causing the user agent to give up trying to
+ fetch the resource</dt>
- <dd>
+ <dt>If the <a href=#media-data>media data</a> can be fetched but is in an
+ unsupported format, or can otherwise not be rendered at
+ all</dt>
- <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>
+ <dd>
- <ol><li>The user agent should cancel the fetching process.</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 <code title=dom-media-error><a href=#dom-media-error>error</a></code>
- attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
- <code title=dom-MediaError-MEDIA_ERR_NETWORK><a href=#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a></code>.</li>
+ <ol><li><p>The user agent should cancel the fetching
+ process.</li>
- <li>Set the <a href=#begun-flag>begun flag</a> to false and <a href=#queue-a-task>queue
- a task</a> to <a href=#fire-a-progress-event>fire a progress event</a> called
- <code title=event-error><a href=#event-error>error</a></code> at the <a href=#media-element>media
- element</a>.</li>
+ <li><p>Abort this subalgorithm, returning to the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a>.</p>
- <li>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
- to the <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a> value
- and <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-emptied><a href=#event-emptied>emptied</a></code> at the element.</li>
+ </ol></dd>
- <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
- flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
- event">delaying the load event</a>.</li>
- <li>Abort the overall <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method algorithm.</li>
+ <dt id=getting-media-metadata>Once enough of the <a href=#media-data>media
+ data</a> has been fetched to determine the duration of the
+ <a href=#media-resource>media resource</a>, its dimensions, and other
+ metadata</dt>
- </ol></dd>
+ <dd>
- <dt id=fatal-decode-error>If the <a href=#media-data>media data</a> is
- corrupted</dt>
+ <p>This indicates that the resource is usable. The user agent
+ must follow these substeps:</p>
- <dd>
+ <ol><li><p>Set the <a href=#current-playback-position>current playback position</a> to the
+ <var><a href=#earliest-possible-position>earliest possible position</a></var>.</li>
- <p>Fatal errors in decoding the <a href=#media-data>media data</a> 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><p>Set the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute to
+ <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>.</li>
- <ol><li>The user agent should cancel the fetching process.</li>
+ <li><p>For <code><a href=#video>video</a></code> elements, set the <code title=dom-video-videoWidth><a href=#dom-video-videowidth>videoWidth</a></code> and <code title=dom-video-videoHeight><a href=#dom-video-videoheight>videoHeight</a></code>
+ attributes.</li>
- <li>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
- attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
- <code title=dom-MediaError-MEDIA_ERR_DECODE><a href=#dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE</a></code>.</li>
+ <li>
- <li>Set the <a href=#begun-flag>begun flag</a> to false and <a href=#queue-a-task>queue
- a task</a> to <a href=#fire-a-progress-event>fire a progress event</a> called
- <code title=event-error><a href=#event-error>error</a></code> at the <a href=#media-element>media
- element</a>.</li>
+ <p>Set the <code title=dom-media-duration><a href=#dom-media-duration>duration</a></code>
+ attribute to the duration of the resource.</p>
- <li>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
- to the <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a> value
- and <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-emptied><a href=#event-emptied>emptied</a></code> at the element.</li>
+ <p class=note>The user agent <a href=#durationChange>will</a> <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-durationchange><a href=#event-durationchange>durationchange</a></code> at the
+ element at this point.</p>
- <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
- flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
- event">delaying the load event</a>.</li>
+ </li>
- <li>Abort the overall <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method algorithm.</li>
+ <li id=fire-loadedmetadata><p><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-loadedmetadata><a href=#event-loadedmetadata>loadedmetadata</a></code> at the
+ element.</li>
- </ol></dd>
+ <li>
- <dt>If the <a href=#media-data>media data</a> fetching process is aborted by
- the user</dt>
+ <p>If either the <a href=#media-resource>media resource</a> or the address
+ of the <var title="">current media resource</var> indicate a
+ particular start time, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time. Ignore any
+ resulting exceptions (if the position is out of range, it is
+ effectively ignored).</p>
- <dd>
+ <p class=example>For example, a fragment identifier could be
+ used to indicate a start position.</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><a href=#dom-media-load>load()</a></code>
- method itself is reinvoked, as the steps above handle that
- particular kind of abort.</p>
+ </li>
- <ol><li>The user agent should cancel the fetching process.</li>
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</li>
- <li>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
- attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
- <code title=dom-MediaError-MEDIA_ERR_ABORT>MEDIA_ERR_ABORT</code>.</li>
+ </ol><p class=note>The user agent is <em>required</em> to
+ determine the duration of the <a href=#media-resource>media resource</a> and
+ go through this step before playing.</p> <!-- actually defined
+ in the 'duration' section -->
- <li>Set the <a href=#begun-flag>begun flag</a> to false and <a href=#queue-a-task>queue
- a task</a> to <a href=#fire-a-progress-event>fire a progress event</a> called
- <code title=event-abort><a href=#event-abort>abort</a></code> at the <a href=#media-element>media
- element</a>.</li>
+ </dd>
- <li>If the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute has
- a value equal to <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, set the
- element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
- to the <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a> value
- and <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-emptied><a href=#event-emptied>emptied</a></code> at the element. (If the
- <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code>
- attribute has a value greater than <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then this
- doesn't happen; the available data, if any, will be
- playable.)</li>
- <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
- flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
- event">delaying the load event</a>.</li>
+ <dt>If the connection is interrupted, causing the user agent to
+ give up trying to fetch the resource</dt>
- <li>Abort the overall <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method algorithm.</li>
+ <dd>
- </ol></dd>
+ <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 id=non-fatal-media-error>If the <a href=#media-data>media data</a> 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>
+ <ol><li><p>The user agent should cancel the fetching
+ process.</li>
- <dd>
+ <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
+ attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
+ <code title=dom-MediaError-MEDIA_ERR_NETWORK><a href=#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a></code>.</li>
- <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>
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
+ event</a> called <code title=event-error><a href=#event-error>error</a></code> at
+ the <a href=#media-element>media element</a>.</li>
- <ol><li class=XXX>Should we fire a 'warning' event? Set the
- 'error' flag to 'MEDIA_ERR_SUBOPTIMAL' or something?</li>
+ <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a>
+ value and <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-emptied><a href=#event-emptied>emptied</a></code>
+ at the element.</li>
- </ol></dd>
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</li>
- </dl><p>When the user agent has completely fetched of the entire
- <a href=#media-resource>media resource</a>, 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>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a>.</li>
- </li>
+ </ol></dd>
- <li><p>If the fetching process completes without errors, then set
- the <a href=#begun-flag>begun flag</a> to false, set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
- <code title=dom-media-NETWORK_LOADED><a href=#dom-media-network_loaded>NETWORK_LOADED</a></code>, and
- <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-progress-event>fire a progress event</a>
- called <code title=event-load><a href=#event-load>load</a></code> at the
- element.</li>
+ <dt id=fatal-decode-error>If the <a href=#media-data>media data</a> is
+ corrupted</dt>
- <li>Then, abort the overall <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method algorithm.</li>
+ <dd>
- </ol></li>
+ <p>Fatal errors in decoding the <a href=#media-data>media data</a> 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>
+ <ol><li><p>The user agent should cancel the fetching
+ process.</li>
- <p><i>Failure step</i>: No usable resource was found. Run the
- following steps:</p>
+ <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
+ attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
+ <code title=dom-MediaError-MEDIA_ERR_DECODE><a href=#dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE</a></code>.</li>
- <ol><li>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute
- to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to <code title=dom-MediaError-MEDIA_ERR_NONE_SUPPORTED><a href=#dom-mediaerror-media_err_none_supported>MEDIA_ERR_NONE_SUPPORTED</a></code>.</li>
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
+ event</a> called <code title=event-error><a href=#event-error>error</a></code> at
+ the <a href=#media-element>media element</a>.</li>
- <li>Set the <a href=#begun-flag>begun flag</a> to false and <a href=#queue-a-task>queue a
- task</a> to <a href=#fire-a-progress-event>fire a progress event</a> called <code title=event-error><a href=#event-error>error</a></code> at the <a href=#media-element>media
- element</a>.</li>
+ <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a>
+ value and <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-emptied><a href=#event-emptied>emptied</a></code>
+ at the element.</li>
- <li>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
- the <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a>
- value and <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-emptied><a href=#event-emptied>emptied</a></code> at
- the element.</li>
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</li>
- <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
- flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
- event">delaying the load event</a>.</li>
+ <li><p>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a>.</li>
- </ol></li>
+ </ol></dd>
+ <dt>If the <a href=#media-data>media data</a> 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><a href=#dom-media-load>load()</a></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.</li>
+
+ <li><p>Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code>
+ attribute to a new <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to
+ <code title=dom-MediaError-MEDIA_ERR_ABORT>MEDIA_ERR_ABORT</code>.</li>
+
+ <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
+ event</a> called <code title=event-abort><a href=#event-abort>abort</a></code> at
+ the <a href=#media-element>media element</a>.</li>
+
+ <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> attribute has a
+ value equal to <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, set the
+ element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <a href=#dom-media-network_empty title=dom-media-NETWORK_EMPTY>NETWORK_EMPTY</a>
+ value and <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-emptied><a href=#event-emptied>emptied</a></code>
+ at the element. Otherwise, set set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+ the <a href=#dom-media-network_idle title=dom-media-NETWORK_IDLE>NETWORK_IDLE</a>
+ value.</li>
+
+ <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+ flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+ event">delaying the load event</a>.</li>
+
+ <li><p>Abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a>.</li>
+
+ </ol></dd>
+
+ <dt id=non-fatal-media-error>If the <a href=#media-data>media data</a> 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
+ <a href=#media-resource>media resource</a>, 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><a href=#dom-media-networkstate>networkState</a></code>
+ attribute to <code title=dom-media-NETWORK_LOADED><a href=#dom-media-network_loaded>NETWORK_LOADED</a></code>, and
+ <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-progress-event>fire a progress event</a>
+ called <code title=event-load><a href=#event-load>load</a></code> at the
+ element.</li>
+
+ <li><p>Then, abort the overall <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a>.</li>
+
</ol><p>If a <a href=#media-element>media element</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> has the value
<code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> is <a href=#insert-an-element-into-a-document title="insert an element into a document">inserted into a
- document</a>, the user agent must <a href=#queue-a-task>queue a task</a> that
- implicitly invokes the <code title=dom-media-load><a href=#dom-media-load>load()</a></code>
- method on the <a href=#media-element>media element</a>, and ignores any resulting
- exceptions. The <a href=#task-source>task source</a> for this task is the
- <a href=#media-element>media element</a>'s own <a href=#media-element-new-resource-task-source>media element new resource
- task source</a>.</p>
+ document</a>, the user agent must asynchronously invoke the
+ <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a>.</p>
<p>The <dfn id=dom-media-bufferingrate title=dom-media-bufferingRate><code>bufferingRate</code></dfn>
attribute must return the average number of bits received per second
@@ -19421,9 +19476,8 @@
<ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has
the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then the user
- agent must invoke the <code title=dom-media-load><a href=#dom-media-load>load()</a></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><a href=#dom-media-play>play()</a></code> method.</li>
+ agent must invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a>.</li>
<li>
@@ -19445,21 +19499,23 @@
<p>If the <a href=#media-element>media element</a>'s <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is true, it must
be set to false.</p>
- <p>If this changed the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code>, the user agent must run the following substeps:</p>
+ <p>If this changed the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code>, the user agent must run
+ the following substeps:</p>
<ol><li><p><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-play><a href=#event-play>play</a></code> at the element.</li>
<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> attribute has the
- value <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>
- or <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>,
+ value <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>,
+ <code title=dom-media-HAVE_METADATA><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, or
+ <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>,
<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-waiting><a href=#event-waiting>waiting</a></code> at the
element.</li>
- <li><p>Otherwise, the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute has the value
- <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>
- or <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>;
+ <li><p>Otherwise, the <a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute has the
+ value <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or
+ <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>;
<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-playing><a href=#event-playing>playing</a></code> at the
element.</li>
@@ -19476,9 +19532,8 @@
<ol><li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute has
the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then the user
- agent must invoke the <code title=dom-media-load><a href=#dom-media-load>load()</a></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><a href=#dom-media-play>pause()</a></code> method.</li>
+ agent must invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load
+ algorithm</a>.</li>
<li><p>If the <a href=#media-element>media element</a>'s <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, it must
be set to true.</li>
@@ -19486,8 +19541,6 @@
<li><p>The <a href=#media-element>media element</a>'s <a href=#autoplaying-flag>autoplaying
flag</a> must be set to false.</li>
- <li><p>The method must then return.</li>
-
<li><p>If the second step above changed the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code>, then the user agent must
<a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a>
called <code title=event-timeupdate><a href=#event-timeupdate>timeupdate</a></code> at the
@@ -19849,7 +19902,7 @@
<tbody><tr><td><dfn id=event-loadstart title=event-loadstart><code>loadstart</code></dfn>
<td><code>ProgressEvent</code> <a href=#refsPROGRESS>[PROGRESS]</a>
- <td>The user agent begins fetching the <a href=#media-data>media data</a>, synchronously during the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method call.
+ <td>The user agent begins looking for <a href=#media-data>media data</a>, as part of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a>.
<td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>
<tr><td><dfn id=event-progress title=event-progress><code>progress</code></dfn>
<td><code>ProgressEvent</code> <a href=#refsPROGRESS>[PROGRESS]</a>
@@ -19865,7 +19918,7 @@
<td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals <code title=dom-media-NETWORK_LOADED><a href=#dom-media-network_loaded>NETWORK_LOADED</a></code>
<tr><td><dfn id=event-abort title=event-abort><code>abort</code></dfn>
<td><code>ProgressEvent</code> <a href=#refsPROGRESS>[PROGRESS]</a>
- <td>The user agent stops fetching the <a href=#media-data>media data</a> before it is completely downloaded. This can be fired synchronously during the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method call.
+ <td>The user agent stops fetching the <a href=#media-data>media data</a> before it is completely downloaded.
<td><code title=dom-media-error><a href=#dom-media-error>error</a></code> is an object with the code <code title=dom-MediaError-MEDIA_ERR_ABORTED><a href=#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a></code>.
<code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals either <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> or <code title=dom-media-NETWORK_LOADED><a href=#dom-media-network_loaded>NETWORK_LOADED</a></code>, depending on when the download was aborted.
<tr><td><dfn id=event-error title=event-error><code>error</code></dfn>
@@ -19875,7 +19928,7 @@
<code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> equals either <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> or <code title=dom-media-NETWORK_LOADED><a href=#dom-media-network_loaded>NETWORK_LOADED</a></code>, depending on when the download was aborted.
<tr><td><dfn id=event-emptied title=event-emptied><code>emptied</code></dfn>
<td><code>Event</code>
- <td>A <a href=#media-element>media element</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> was previously not in the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></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><a href=#dom-media-load>load()</a></code> method was reinvoked, in which case it is fired synchronously during the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method call).
+ <td>A <a href=#media-element>media element</a> whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> was previously not in the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></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><a href=#dom-media-load>load()</a></code> method was invoked while the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>load algorithm</a> was already running, in which case it is fired synchronously during the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method call).
<td><code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>; all the DOM attributes are in their initial states.
<tr><td><dfn id=event-stalled title=event-stalled><code>stalled</code></dfn>
<td><code>ProgressEvent</code>
Modified: source
===================================================================
--- source 2009-02-22 09:28:30 UTC (rev 2848)
+++ source 2009-02-23 07:19:49 UTC (rev 2849)
@@ -19291,8 +19291,8 @@
<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>
@@ -19455,16 +19455,6 @@
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
@@ -19491,6 +19481,7 @@
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>;
@@ -19586,25 +19577,22 @@
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;
@@ -19652,23 +19640,6 @@
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
@@ -19677,109 +19648,16 @@
<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>
+ <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>
- <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>
-
-
-
<h5>Media types</h5>
<p>A <span>media resource</span> can be described in terms of its
@@ -19874,9 +19752,9 @@
<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>
@@ -19888,10 +19766,16 @@
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>
@@ -19902,8 +19786,7 @@
<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
@@ -19917,32 +19800,31 @@
<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
@@ -19960,11 +19842,13 @@
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
@@ -20008,439 +19892,621 @@
</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>
- <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>
+ <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>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><i>Search loop:</i> Run these substeps atomically (so that
+ the DOM cannot change while they are running):</p>
- <p>Every 350ms (±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>
+ <ol>
- <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>
+ <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>
- <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>
+ <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>
- <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>
+ <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>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>
+ <li><p>If <var title="">candidate</var> is null, restart the
+ step labelled <i>search loop</i> from the first
+ substep.</p></li>
- <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>
+ </ol>
- <dl class="switch">
+ </li>
- <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>
- <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>
+ <p>If any of the following conditions are true, then jump back
+ to the step labelled <i>search loop</i>:</p>
- <dd>
+ <ul>
- <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>The <var title="">candidate</var> element does not have a
+ <code title="attr-source-src">src</code> attribute.</li>
- <ol>
+ <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>
- <li><p>The user agent should cancel the fetching
- process.</p></li>
+ <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>
- <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>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>
- </dd>
+ </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>
- <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><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>
- <dd>
+ <li><p>Return to the step labeled <i>search loop</i>.</p></li>
- <p>This indicates that the resource is usable. The user agent
- must follow these substeps:</p>
+ <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>
- <ol>
+ <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><p>Set the <span>current playback position</span> to the
- <var>earliest possible position</var>.</p></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 <code
- title="dom-media-readyState">readyState</code> attribute to
- <code
- title="dom-media-HAVE_METADATA">HAVE_METADATA</code>.</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>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>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>Set the <code title="dom-media-duration">duration</code>
- attribute to the duration of the resource.</p>
+ </ol>
- <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>
- </li>
+ </ol>
- <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>
+ <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>
- <li>
+ <ol>
- <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>
+ <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>
- <p class="example">For example, a fragment identifier could be
- used to indicate a start position.</p>
+ <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>
+ <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>Begin to <span>fetch</span> the <var title="">current media
+ resource</var>.</p>
- </ol>
+ <p>Every 350ms (±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 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 -->
+ <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>
- </dd>
+ <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>
- <dt>If the connection is interrupted, causing the user agent to
- give up trying to fetch the resource</dt>
+ <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>
- <dd>
+ <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>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>
+ <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>The user agent should cancel the fetching process.</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>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>
+ <dd>
- <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>
+ <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 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>
+ <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>The user agent should cancel the fetching
+ process.</p></li>
- <li>Abort the overall <code
- title="dom-media-load">load()</code> method algorithm.</li>
+ <li><p>Abort this subalgorithm, returning to the <span
+ title="concept-media-load-algorithm">load algorithm</span>.</p>
- </ol>
+ </ol>
- </dd>
+ </dd>
- <dt id="fatal-decode-error">If the <span>media data</span> is
- corrupted</dt>
- <dd>
+ <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>
- <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>
+ <dd>
- <ol>
+ <p>This indicates that the resource is usable. The user agent
+ must follow these substeps:</p>
- <li>The user agent should cancel the fetching process.</li>
+ <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_DECODE">MEDIA_ERR_DECODE</code>.</li>
+ <li><p>Set the <span>current playback position</span> to the
+ <var>earliest possible position</var>.</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-readyState">readyState</code> attribute to
+ <code
+ title="dom-media-HAVE_METADATA">HAVE_METADATA</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>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>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>
- <li>Abort the overall <code
- title="dom-media-load">load()</code> method algorithm.</li>
+ <p>Set the <code title="dom-media-duration">duration</code>
+ attribute to the duration of the resource.</p>
- </ol>
+ <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>
- </dd>
+ </li>
- <dt>If the <span>media data</span> fetching process is aborted by
- the user</dt>
+ <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>
- <dd>
+ <li>
- <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>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>The user agent should cancel the fetching process.</li>
+ </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><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>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>
+ </ol>
- <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>
+ <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>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>
+ </dd>
- <li>Abort the overall <code
- title="dom-media-load">load()</code> method algorithm.</li>
- </ol>
+ <dt>If the connection is interrupted, causing the user agent to
+ give up trying to fetch the resource</dt>
- </dd>
+ <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>
+ <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>
- <dd>
+ <ol>
- <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>
+ <li><p>The user agent should cancel the fetching
+ process.</p></li>
- <ol>
+ <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>
- <li class="XXX">Should we fire a 'warning' event? Set the
- 'error' flag to 'MEDIA_ERR_SUBOPTIMAL' or something?</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>
- </ol>
+ <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>
- </dd>
+ <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>
- </dl>
+ <li><p>Abort the overall <span
+ title="concept-media-load-algorithm">load
+ algorithm</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>
+ </ol>
- </li>
+ </dd>
- <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>
+ <dt id="fatal-decode-error">If the <span>media data</span> is
+ corrupted</dt>
- <li>Then, abort the overall <code
- title="dom-media-load">load()</code> method algorithm.</li>
+ <dd>
- </ol>
+ <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>
- </li>
+ <ol>
- <li>
+ <li><p>The user agent should cancel the fetching
+ process.</p></li>
- <p><i>Failure step</i>: No usable resource was found. Run the
- following steps:</p>
+ <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>
- <ol>
+ <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>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>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>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 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>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>Abort the overall <span
+ title="concept-media-load-algorithm">load
+ algorithm</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>
+ </ol>
- </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>
@@ -20983,10 +21049,9 @@
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>
@@ -21011,7 +21076,8 @@
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>
@@ -21020,18 +21086,19 @@
<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>
@@ -21058,10 +21125,9 @@
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
@@ -21070,8 +21136,6 @@
<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>
@@ -21488,7 +21552,7 @@
<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>
@@ -21508,7 +21572,7 @@
<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>
@@ -21520,7 +21584,7 @@
<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>
More information about the Commit-Watchers
mailing list