Skip to content

Commit

Permalink
[gow] (2) Make how <video> loads resources a bit more stable -- setti…
Browse files Browse the repository at this point in the history
…ng src='' once fixes the src to load; <source>s are examined when the DOM is stable; error events are only fired on <source> (or once on <video> if the UA gave up) when using <source> elements.

git-svn-id: http://svn.whatwg.org/webapps@3027 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 29, 2009
1 parent 0790208 commit 455f7f6
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 68 deletions.
80 changes: 47 additions & 33 deletions index
Expand Up @@ -19890,7 +19890,7 @@ interface <dfn id=cuerangecallback>CueRangeCallback</dfn> {
const unsigned short <a href=#dom-mediaerror-media_err_aborted title=dom-MediaError-MEDIA_ERR_ABORTED>MEDIA_ERR_ABORTED</a> = 1;
const unsigned short <a href=#dom-mediaerror-media_err_network title=dom-MediaError-MEDIA_ERR_NETWORK>MEDIA_ERR_NETWORK</a> = 2;
const unsigned short <a href=#dom-mediaerror-media_err_decode title=dom-MediaError-MEDIA_ERR_DECODE>MEDIA_ERR_DECODE</a> = 3;
const unsigned short <a href=#dom-mediaerror-media_err_none_supported title=dom-MediaError-MEDIA_ERR_NONE_SUPPORTED>MEDIA_ERR_NONE_SUPPORTED</a> = 4;
const unsigned short <a href=#dom-mediaerror-media_err_src_not_supported title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED>MEDIA_ERR_SRC_NOT_SUPPORTED</a> = 4;
readonly attribute unsigned short <a href=#dom-mediaerror-code title=dom-MediaError-code>code</a>;
};</pre>

Expand Down Expand Up @@ -19927,9 +19927,9 @@ interface <dfn id=cuerangecallback>CueRangeCallback</dfn> {
<a href=#media-resource>media resource</a>, after the resource was established to
be usable.</dd>

<dt><dfn id=dom-mediaerror-media_err_none_supported title=dom-MediaError-MEDIA_ERR_NONE_SUPPORTED><code>MEDIA_ERR_NONE_SUPPORTED</code></dfn> (numeric value 4)</dt>
<dt><dfn id=dom-mediaerror-media_err_src_not_supported title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED><code>MEDIA_ERR_SRC_NOT_SUPPORTED</code></dfn> (numeric value 4)</dt>

<dd>No suitable <a href=#media-resource>media resource</a> could be found.</dd>
<dd>The <a href=#media-resource>media resource</a> indicated by the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was not suitable.</dd>

</dl><h5 id=location-of-the-media-resource><span class=secno>4.8.10.2 </span>Location of the media resource</h5>

Expand Down Expand Up @@ -20257,13 +20257,20 @@ interface <dfn id=cuerangecallback>CueRangeCallback</dfn> {
flag</a> to true (this <a href=#delay-the-load-event title="delay the load
event">delays the load event</a>), and set its <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>If a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was
set before a <code><a href=#the-source-element>source</a></code> element was inserted, let <var title="">src</var> equal the first value that was assigned to the
<code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute after this
algorithm was invoked.</li>

</ol><p>Otherwise, run these substeps:</p>

<ol><li><p>Set the <a href=#media-element>media element</a>'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>), and
set its <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>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, let <var title="">src</var> equal the value of that attribute.</li>

<li><p>Run the remainder of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
algorithm</a> steps asynchronously, allowing the <a href=#concept-task title=concept-task>task</a> that invoked this algorithm to
continue.</li>
Expand All @@ -20279,21 +20286,25 @@ interface <dfn id=cuerangecallback>CueRangeCallback</dfn> {

<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>
<p>If <var title="">src</var> was given a value in the earlier
steps, 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>
<ol><li><p>Let <var title="">absolute URL</var> be the <a href=#absolute-url>absolute
URL</a> that would have resulted from <a href=#resolve-a-url title="resolve a
url">resolving</a> the <a href=#url>URL</a> given by <var title="">src</var> relative to the <a href=#media-element>media element</a>
when the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was
set to <var title="">src</var>.</p> <!-- i.e. changing xml:base
or <base> after src="" has no effect -->

<li><p>If that is successful, then run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch
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>If <var title="">absolute URL</var> was successfully
obtained, then run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch
algorithm</a> with <var title="">absolute URL</var>. 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>
<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_SRC_NOT_SUPPORTED><a href=#dom-mediaerror-media_err_src_not_supported>MEDIA_ERR_SRC_NOT_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>
Expand Down Expand Up @@ -20360,28 +20371,38 @@ interface <dfn id=cuerangecallback>CueRangeCallback</dfn> {

<li>

<p><i>Search loop:</i> Run these substeps atomically (so that
the DOM cannot change while they are running):</p>
<p><i>Search loop:</i> <a href=#queue-a-task>Queue a task</a> to run the
following steps (so that no other tasks are running that could
make the DOM change while these steps are running):</p>

<ol><li><p>Let <var title="">candidate</var> be null.</li>

<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>
<li><p>If the node after <var title="">pointer</var> is the end
of the list, then abort the task.</li>

<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>
be that element.</li>

<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>

<li><p>If <var title="">candidate</var> is null, restart the
step labelled <i>search loop</i> from the first
substep.</li>
<li><p>If <var title="">candidate</var> is null, restart these
substeps from the first substep. Otherwise, abort the
task.</li>

</ol></li>
<li><p><a href=#resolve-a-url title="resolve a url">Resolve</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>.</li>

</ol><p>Wait for the task to run. When the task ends, if <var title="">candidate</var> is null, then jump to the step below
labeled <i>waiting</i>. Otherwise, continue with the next
step.</p>

</li>

<li>

Expand All @@ -20395,7 +20416,7 @@ interface <dfn id=cuerangecallback>CueRangeCallback</dfn> {
<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>
relative to <var title="">candidate</var> failed.</li>

<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
Expand Down Expand Up @@ -20427,17 +20448,10 @@ interface <dfn id=cuerangecallback>CueRangeCallback</dfn> {

<li><p>Return to the step labeled <i>search loop</i>.</li>

<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>

<li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
<li><p><i>Waiting:</i> 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>
Expand Down
86 changes: 51 additions & 35 deletions source
Expand Up @@ -21418,7 +21418,7 @@ interface <dfn>CueRangeCallback</dfn> {
const unsigned short <span title="dom-MediaError-MEDIA_ERR_ABORTED">MEDIA_ERR_ABORTED</span> = 1;
const unsigned short <span title="dom-MediaError-MEDIA_ERR_NETWORK">MEDIA_ERR_NETWORK</span> = 2;
const unsigned short <span title="dom-MediaError-MEDIA_ERR_DECODE">MEDIA_ERR_DECODE</span> = 3;
const unsigned short <span title="dom-MediaError-MEDIA_ERR_NONE_SUPPORTED">MEDIA_ERR_NONE_SUPPORTED</span> = 4;
const unsigned short <span title="dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED">MEDIA_ERR_SRC_NOT_SUPPORTED</span> = 4;
readonly attribute unsigned short <span title="dom-MediaError-code">code</span>;
};</pre>

Expand Down Expand Up @@ -21461,9 +21461,10 @@ interface <dfn>CueRangeCallback</dfn> {
<span>media resource</span>, after the resource was established to
be usable.</dd>

<dt><dfn title="dom-MediaError-MEDIA_ERR_NONE_SUPPORTED"><code>MEDIA_ERR_NONE_SUPPORTED</code></dfn> (numeric value 4)</dt>
<dt><dfn title="dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED"><code>MEDIA_ERR_SRC_NOT_SUPPORTED</code></dfn> (numeric value 4)</dt>

<dd>No suitable <span>media resource</span> could be found.</dd>
<dd>The <span>media resource</span> indicated by the <code
title="attr-media-src">src</code> attribute was not suitable.</dd>

</dl>

Expand Down Expand Up @@ -21865,6 +21866,12 @@ interface <dfn>CueRangeCallback</dfn> {
title="dom-media-networkState">networkState</code> to <code
title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>

<li><p>If a <code title="attr-media-src">src</code> attribute was
set before a <code>source</code> element was inserted, let <var
title="">src</var> equal the first value that was assigned to the
<code title="attr-media-src">src</code> attribute after this
algorithm was invoked.</p></li>

</ol>

<p>Otherwise, run these substeps:</p>
Expand All @@ -21878,6 +21885,10 @@ interface <dfn>CueRangeCallback</dfn> {
to <code
title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>

<li><p>If the <span>media element</span> has a <code
title="attr-media-src">src</code> attribute, let <var
title="">src</var> equal the value of that attribute.</p></li>

<li><p>Run the remainder of the <span
title="concept-media-load-algorithm">resource selection
algorithm</span> steps asynchronously, allowing the <span
Expand All @@ -21897,28 +21908,32 @@ interface <dfn>CueRangeCallback</dfn> {

<li>

<p>If the <span>media element</span> has a <code
title="attr-media-src">src</code> attribute, then run these
substeps:</p>
<p>If <var title="">src</var> was given a value in the earlier
steps, 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>Let <var title="">absolute URL</var> be the <span>absolute
URL</span> that would have resulted from <span title="resolve a
url">resolving</span> the <span>URL</span> given by <var
title="">src</var> relative to the <span>media element</span>
when the <code title="attr-media-src">src</code> attribute was
set to <var title="">src</var>.</p> <!-- i.e. changing xml:base
or <base> after src="" has no effect -->

<li><p>If that is successful, then run the <span
<li><p>If <var title="">absolute URL</var> was successfully
obtained, then run the <span
title="concept-media-load-resource">resource fetch
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>
algorithm</span> with <var title="">absolute URL</var>. If that
algorithm returns without aborting <em>this</em> one, then the
load failed.</p></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">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>
title="dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED">MEDIA_ERR_SRC_NOT_SUPPORTED</code>.</p></li>

<li><p>Set the element's <code
title="dom-media-networkState">networkState</code> attribute to
Expand Down Expand Up @@ -21998,32 +22013,43 @@ interface <dfn>CueRangeCallback</dfn> {

<li>

<p><i>Search loop:</i> Run these substeps atomically (so that
the DOM cannot change while they are running):</p>
<p><i>Search loop:</i> <span>Queue a task</span> to run the
following steps (so that no other tasks are running that could
make the DOM change while these steps are running):</p>

<ol>

<li><p>Let <var title="">candidate</var> be null.</p></li>

<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>
of the list, then abort the task.</p></li>

<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>
be that element.</p></li>

<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>

<li><p>If <var title="">candidate</var> is null, restart the
step labelled <i>search loop</i> from the first
substep.</p></li>
<li><p>If <var title="">candidate</var> is null, restart these
substeps from the first substep. Otherwise, abort the
task.</p></li>

<li><p><span title="resolve a url">Resolve</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>.</p></li>

</ol>

<p>Wait for the task to run. When the task ends, if <var
title="">candidate</var> is null, then jump to the step below
labeled <i>waiting</i>. Otherwise, continue with the next
step.</p>

</li>

<li>
Expand All @@ -22042,7 +22068,7 @@ interface <dfn>CueRangeCallback</dfn> {
<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>
relative to <var title="">candidate</var> failed.</li>

<li>The <var title="">candidate</var> element has a <code
title="attr-source-type">type</code> attribute whose value,
Expand Down Expand Up @@ -22083,22 +22109,12 @@ interface <dfn>CueRangeCallback</dfn> {

<li><p>Return to the step labeled <i>search loop</i>.</p></li>

<li><p><i>Waiting:</i> Set the <code
title="dom-media-error">error</code> attribute to a new
<code>MediaError</code> object whose <code
title="dom-MediaError-code">code</code> attribute is set to <code
title="dom-MediaError-MEDIA_ERR_NONE_SUPPORTED">MEDIA_ERR_NONE_SUPPORTED</code>.</p></li>

<li><p>Set the element's <code
<li><p><i>Waiting:</i> 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><span>Queue a task</span> to <span>fire a progress
event</span> called <code title="event-error">error</code> at the
<span>media element</span>.</p></li>

<li><p>Set the element's <span>delaying-the-load-event flag</span>
to false. This stops <span title="delay the load event">delaying
the load event</span>.</p></li>
Expand Down

0 comments on commit 455f7f6

Please sign in to comment.