Skip to content

Commit

Permalink
[gow] (2) New plan. Introduce a 'playing' event for when the playback…
Browse files Browse the repository at this point in the history
… actually begins.

git-svn-id: http://svn.whatwg.org/webapps@2498 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Dec 1, 2008
1 parent cf9a9b5 commit ccd12ab
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 45 deletions.
67 changes: 46 additions & 21 deletions index
Expand Up @@ -17859,8 +17859,16 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<dt>If the prevous ready state was <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or
less, and the new ready state is <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code></dt>

<dd><p>The user agent must <a href=#queue-a-task>queue a task</a> to
<a href=#fire-a-simple-event>fire a simple event</a> called <code title=event-canplay><a href=#event-canplay>canplay</a></code>.</dd>
<dd>

<p>The user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
simple event</a> called <code title=event-canplay><a href=#event-canplay>canplay</a></code>.</p>

<p>If the element is <a href=#potentially-playing>potentially playing</a>, 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-playing><a href=#event-playing>playing</a></code>.</p>

</dd>

<!-- going up to enough -->
<dt>If the new ready state is <code title=dom-media-HAVE_ENOUGH_DATA><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code></dt>
Expand All @@ -17883,6 +17891,11 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
using script to force the video to play, so as to allow the user
to override the behavior if so desired.</p>

<p>If the element is now <a href=#potentially-playing>potentially playing</a>, and the
previous ready state was not <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, the
user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
event</a> called <code title=event-playing><a href=#event-playing>playing</a></code>.</p>

</dd>

</dl><p class=note>It is possible for the ready state of a media
Expand Down Expand Up @@ -18111,15 +18124,26 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<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
<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; if, in
addition, 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 lower than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, the
user agent must also <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.</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>

</li>
<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>,
<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>;
<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>

</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>
Expand Down Expand Up @@ -18221,16 +18245,13 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
steps.</li>

<li><p>If the time was reached through the usual monotonic increase
of the current playback position during normal playback, and if
either the user agent has not fired a <code title=event-timeupdate><a href=#event-timeupdate>timeupdate</a></code> event at the element in
the past 15 to 250ms, or there has been an instant since the last
time such an event was fired that the element was not
<a href=#potentially-playing>potentially playing</a>, 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
element. (In the other cases, such as explicit seeks, relevant
events get fired as part of the overall process of changing the
current playback position.)</p>
of the current playback position during normal playback, and if the
user agent has not fired a <code title=event-timeupdate><a href=#event-timeupdate>timeupdate</a></code> event at the element in
the past 15 to 250ms, 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 element. (In the
other cases, such as explicit seeks, relevant events get fired as
part of the overall process of changing the current playback
position.)</p>

<p class=note>The event thus is not to be fired faster than about
66Hz or slower than 4Hz. User agents are encouraged to vary the
Expand Down Expand Up @@ -18541,7 +18562,7 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael

<tbody><tr><td><dfn id=event-play title=event-play><code>play</code></dfn>
<td><code>Event</code>
<td>Playback has begun. Fired after the <code title=dom-media-play><a href=#dom-media-play>play</a></code> method has returned.
<td>Playback has begun. Fired after the <code title=dom-media-play><a href=#dom-media-play>play()</a></code> method has returned.
<td><code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is newly false.
<tr><td><dfn id=event-pause title=event-pause><code>pause</code></dfn>
<td><code>Event</code>
Expand All @@ -18560,6 +18581,10 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<td><code>Event</code>
<td>Playback has stopped because the next frame is not available, but the user agent expects that frame to become available in due course.
<td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to or less than <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>, and <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is false. Either <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is true, or the <a href=#current-playback-position>current playback position</a> is not contained in any of the ranges in <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>. It is possible for playback to stop for two other reasons without <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> being false, but those two reasons do not fire this event: maybe <a href=#ended-playback title="ended playback">playback ended</a>, or playback <a href=#stopped-due-to-errors>stopped due to errors</a>.
<tr><td><dfn id=event-playing title=event-playing><code>playing</code></dfn>
<td><code>Event</code>
<td>Playback has started.
<td><code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is newly equal to or greater than <code title=dom-media-HAVE_FUTURE_DATA><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, <code title=dom-media-paused><a href=#dom-media-paused>paused</a></code> is false, <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is false, or the <a href=#current-playback-position>current playback position</a> is contained in one of the ranges in <code title=dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>.
<tr><td><dfn id=event-canplay title=event-canplay><code>canplay</code></dfn>
<td><code>Event</code>
<td>The user agent can resume playback of the <a href=#media-data>media data</a>, but estimates that if playback were to be started now, the <a href=#media-resource>media resource</a> could not be rendered at the current playback rate up to its end without having to stop for further buffering of content.
Expand Down
83 changes: 59 additions & 24 deletions source
Expand Up @@ -19299,9 +19299,18 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
less, and the new ready state is <code
title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code></dt>

<dd><p>The user agent must <span>queue a task</span> to
<span>fire a simple event</span> called <code
title="event-canplay">canplay</code>.</p></dd>
<dd>

<p>The user agent must <span>queue a task</span> to <span>fire a
simple event</span> called <code
title="event-canplay">canplay</code>.</p>

<p>If the element is <span>potentially playing</span>, the user
agent must <span>queue a task</span> to <span>fire a simple
event</span> called <code
title="event-playing">playing</code>.</p>

</dd>

<!-- going up to enough -->
<dt>If the new ready state is <code
Expand Down Expand Up @@ -19331,6 +19340,13 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
using script to force the video to play, so as to allow the user
to override the behavior if so desired.</p>

<p>If the element is now <span>potentially playing</span>, and the
previous ready state was not <code
title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>, the
user agent must <span>queue a task</span> to <span>fire a simple
event</span> called <code
title="event-playing">playing</code>.</p>

</dd>

</dl>
Expand Down Expand Up @@ -19614,16 +19630,32 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
be set to false.</p>

<p>If this changed the value of <code
title="dom-media-paused">paused</code>, the user agent must
<span>queue a task</span> to <span>fire a simple event</span>
called <code title="event-play">play</code> at the element; if, in
addition, the <span>media element</span>'s <code
title="dom-media-readyState">readyState</code> attribute has a
value lower than <code
title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>, the
user agent must also <span>queue a task</span> to <span>fire a
simple event</span> called <code
title="event-waiting">waiting</code> at the element.</p>
title="dom-media-paused">paused</code>, the user agent must run the following substeps:</p>

<ol>

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

<li><p>If the <span>media element</span>'s <code
title="dom-media-readyState">readyState</code> attribute has the
value <code title="dom-media-HAVE_METADATA">HAVE_METADATA</code>
or <code
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>;
<span>queue a task</span> to <span>fire a simple event</span>
called <code title="event-playing">playing</code> at the
element.</p></li>

</ol>

</li>

Expand Down Expand Up @@ -19752,17 +19784,15 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
steps.</p></li>

<li><p>If the time was reached through the usual monotonic increase
of the current playback position during normal playback, and if
either the user agent has not fired a <code
of the current playback position during normal playback, and if the
user agent has not fired a <code
title="event-timeupdate">timeupdate</code> event at the element in
the past 15 to 250ms, or there has been an instant since the last
time such an event was fired that the element was not
<span>potentially playing</span>, then the user agent must
<span>queue a task</span> to <span>fire a simple event</span>
called <code title="event-timeupdate">timeupdate</code> at the
element. (In the other cases, such as explicit seeks, relevant
events get fired as part of the overall process of changing the
current playback position.)</p>
the past 15 to 250ms, then the user agent must <span>queue a
task</span> to <span>fire a simple event</span> called <code
title="event-timeupdate">timeupdate</code> at the element. (In the
other cases, such as explicit seeks, relevant events get fired as
part of the overall process of changing the current playback
position.)</p>

<p class="note">The event thus is not to be fired faster than about
66Hz or slower than 4Hz. User agents are encouraged to vary the
Expand Down Expand Up @@ -20120,7 +20150,7 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
<tr>
<td><dfn title="event-play"><code>play</code></dfn>
<td><code>Event</code>
<td>Playback has begun. Fired after the <code title="dom-media-play">play</code> method has returned.
<td>Playback has begun. Fired after the <code title="dom-media-play">play()</code> method has returned.
<td><code title="dom-media-paused">paused</code> is newly false.
<tr>
<td><dfn title="event-pause"><code>pause</code></dfn>
Expand All @@ -20144,6 +20174,11 @@ interface <dfn>HTMLAudioElement</dfn> : <span>HTMLMediaElement</span> {
<td><code>Event</code>
<td>Playback has stopped because the next frame is not available, but the user agent expects that frame to become available in due course.
<td><code title="dom-media-readyState">readyState</code> is newly equal to or less than <code title="dom-media-HAVE_CURRENT_DATA">HAVE_CURRENT_DATA</code>, and <code title="dom-media-paused">paused</code> is false. Either <code title="dom-media-seeking">seeking</code> is true, or the <span>current playback position</span> is not contained in any of the ranges in <code title="dom-media-buffered">buffered</code>. It is possible for playback to stop for two other reasons without <code title="dom-media-paused">paused</code> being false, but those two reasons do not fire this event: maybe <span title="ended playback">playback ended</span>, or playback <span>stopped due to errors</span>.
<tr>
<td><dfn title="event-playing"><code>playing</code></dfn>
<td><code>Event</code>
<td>Playback has started.
<td><code title="dom-media-readyState">readyState</code> is newly equal to or greater than <code title="dom-media-HAVE_FUTURE_DATA">HAVE_FUTURE_DATA</code>, <code title="dom-media-paused">paused</code> is false, <code title="dom-media-seeking">seeking</code> is false, or the <span>current playback position</span> is contained in one of the ranges in <code title="dom-media-buffered">buffered</code>.
<tr>
<td><dfn title="event-canplay"><code>canplay</code></dfn>
<td><code>Event</code>
Expand Down

0 comments on commit ccd12ab

Please sign in to comment.