Skip to content
Permalink
Browse files

[e] (0) Clean up the play() and pause() algorithms.

git-svn-id: http://svn.whatwg.org/webapps@3992 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Sep 24, 2009
1 parent 88f89ba commit bc96eb635e05c6b362db1ad7e62b6affe02ff08e
Showing with 60 additions and 53 deletions.
  1. +27 −26 index
  2. +33 −27 source
53 index
must run the following steps.</p>

<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 <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, invoke the
<a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
algorithm</a>.</li>

<li>

<p>If the <a href=#ended-playback title="ended playback">playback has ended</a>,
then the user agent must <a href=#dom-media-seek title=dom-media-seek>seek</a>
to the <a href=#earliest-possible-position>earliest possible position</a> of the <a href=#media-resource>media
resource</a>.</p>
<a href=#dom-media-seek title=dom-media-seek>seek</a> to the <a href=#earliest-possible-position>earliest
possible position</a> of the <a href=#media-resource>media resource</a>.</p>

<p class=note>This <a href=#seekUpdate>will cause</a> the user
agent to <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple

<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 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
<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, 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>
<ol><li><p>Change the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> to false.</li>

<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-media-play><a href=#event-media-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

</ol></li>

<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>Set the <a href=#media-element>media element</a>'s <a href=#autoplaying-flag>autoplaying
flag</a> to false.</li>

</ol><hr><p>When the <dfn id=dom-media-pause title=dom-media-pause><code>pause()</code></dfn>
method is invoked, the user agent must run the following steps:</p>

<ol><li><p>If the <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 <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
the value <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, invoke the
<a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
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>
<li><p>Set the <a href=#media-element>media element</a>'s <a href=#autoplaying-flag>autoplaying
flag</a> to false.</li>

<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>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, run the
following steps:</p>

<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-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
element, 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-media-pause><a href=#event-media-pause>pause</a></code> at the
element.</li>
<ol><li><p>Change the value of <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> to true.</li>

<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-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
element.</li>

<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-media-pause><a href=#event-media-pause>pause</a></code>
at the element.</li>

</ol></li>

</ol><hr><p id=media-playback>When a <a href=#media-element>media element</a> is
<a href=#potentially-playing>potentially playing</a> and its <code>Document</code> is an
60 source
<li><p>If the <span>media element</span>'s <code
title="dom-media-networkState">networkState</code> attribute has
the value <code
title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then the user
agent must invoke the <span>media element</span>'s <span
title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, invoke the
<span>media element</span>'s <span
title="concept-media-load-algorithm">resource selection
algorithm</span>.</p></li>

<li>

<p>If the <span title="ended playback">playback has ended</span>,
then the user agent must <span title="dom-media-seek">seek</span>
to the <span>earliest possible position</span> of the <span>media
resource</span>.</p>
<span title="dom-media-seek">seek</span> to the <span>earliest
possible position</span> of the <span>media resource</span>.</p>

<p class="note">This <a href="#seekUpdate">will cause</a> the user
agent to <span>queue a task</span> to <span>fire a simple
<li>

<p>If the <span>media element</span>'s <code
title="dom-media-paused">paused</code> attribute is true, it must
be set to false.</p>

<p>If this changed the value of <code
title="dom-media-paused">paused</code>, the user agent must run
title="dom-media-paused">paused</code> attribute is true, run
the following substeps:</p>

<ol>

<li><p>Change the value of <code
title="dom-media-paused">paused</code> to false.</p></li>

<li><p><span>Queue a task</span> to <span>fire a simple event</span>
called <code title="event-media-play">play</code> at the element.</p></li>


</li>

<li><p>The <span>media element</span>'s <span>autoplaying
flag</span> must be set to false.</p></li>

<li><p>The method must then return.</p></li>
<li><p>Set the <span>media element</span>'s <span>autoplaying
flag</span> to false.</p></li>

</ol>

<li><p>If the <span>media element</span>'s <code
title="dom-media-networkState">networkState</code> attribute has
the value <code
title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then the user
agent must invoke the <span>media element</span>'s <span
title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, invoke the
<span>media element</span>'s <span
title="concept-media-load-algorithm">resource selection
algorithm</span>.</p></li>

<li><p>Set the <span>media element</span>'s <span>autoplaying
flag</span> to false.</p></li>

<li><p>If the <span>media element</span>'s <code
title="dom-media-paused">paused</code> attribute is false, it must
be set to true.</p></li>
title="dom-media-paused">paused</code> attribute is false, run the
following steps:</p>

<li><p>The <span>media element</span>'s <span>autoplaying
flag</span> must be set to false.</p></li>
<ol>

<li><p>If the second step above changed the value of <code
title="dom-media-paused">paused</code>, then the user agent must
<span>queue a task</span> to <span>fire a simple event</span>
called <code title="event-media-timeupdate">timeupdate</code> at the
element, and <span>queue a task</span> to <span>fire a simple
event</span> called <code title="event-media-pause">pause</code> at the
element.</p></li>
<li><p>Change the value of <code
title="dom-media-paused">paused</code> to true.</p></li>

<li><p><span>Queue a task</span> to <span>fire a simple
event</span> called <code
title="event-media-timeupdate">timeupdate</code> at the
element.</p></li>

<li><p><span>Queue a task</span> to <span>fire a simple
event</span> called <code title="event-media-pause">pause</code>
at the element.</p></li>

</ol>

</li>

</ol>

0 comments on commit bc96eb6

Please sign in to comment.
You can’t perform that action at this time.