Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giow] (1) Make video.currentTime return a stable value rather than t…
…he current value. This lets us make setting this attribute always seem to work, so authors don't find the attribute hasn't changed after they set it.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=12541

git-svn-id: http://svn.whatwg.org/webapps@6531 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 29, 2011
1 parent eefd602 commit 334b91b
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 116 deletions.
98 changes: 59 additions & 39 deletions complete.html
Expand Up @@ -239,7 +239,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1>Web Applications 1.0</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 26 August 2011</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 29 August 2011</h2>
</hgroup><dl><dt>Multiple-page version:</dt>
<dd><a href=http://www.whatwg.org/specs/web-apps/current-work/complete/>http://www.whatwg.org/specs/web-apps/current-work/complete/</a></dd>
<dt>One-page version:</dt>
Expand Down Expand Up @@ -27285,7 +27285,9 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the

<p>Set the <a href=#current-playback-position>current playback position</a> to 0.</p>

<p>If this changed the <a href=#current-playback-position>current playback position</a>,
<p>Set the <a href=#official-playback-position>official playback position</a> to 0.</p>

<p>If this changed the <a href=#official-playback-position>official playback position</a>,
then <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
<a href=#media-element>media element</a>.</p>
Expand Down Expand Up @@ -27759,8 +27761,9 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the

</li>

<li><p>Set the <a href=#current-playback-position>current playback position</a> to the
<a href=#earliest-possible-position>earliest possible position</a>.</li>
<li><p>Set the <a href=#current-playback-position>current playback position</a> and the
<a href=#official-playback-position>official playback position</a> to the <a href=#earliest-possible-position>earliest
possible position</a>.</li>

<li>

Expand Down Expand Up @@ -27801,9 +27804,7 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the
<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 set the <a href=#initial-playback-position>initial playback
position</a> to that time, <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time, and let <var title="">jumped</var> be true. Ignore any resulting exceptions
(if the position is out of range, it is effectively
ignored).</p>
position</a> to that time, <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time, and let <var title="">jumped</var> be true.</p>

<p class=example>For example, with media formats that
support the <cite>Media Fragments URI</cite> fragment
Expand Down Expand Up @@ -27835,16 +27836,15 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the
<a href=#current-media-controller>current media controller</a>'s timeline; otherwise,
<a href=#dom-media-seek title=dom-media-seek>seek</a> the <a href=#media-element>media
element</a> to the <a href=#media-controller-position>media controller position</a>,
relative to the <a href=#media-element>media element</a>'s timeline,
discarding any resulting exceptions.</li> <!-- i.e. "bring
the media element up to speed with its new media controller"
--> <!-- we do this because otherwise the fragment identifier
initial position is lost. Basically this means that if you are
attached to a media controller when you load your resource, and
you have a fragment identifier with a start time, you'll jump
the media controller to that time if it's not already past it.
(So if there are several, you'll jump the media controller to
the furthest one in the timeline.) -->
relative to the <a href=#media-element>media element</a>'s timeline.</li>
<!-- i.e. "bring the media element up to speed with its new
media controller" --> <!-- we do this because otherwise the
fragment identifier initial position is lost. Basically this
means that if you are attached to a media controller when you
load your resource, and you have a fragment identifier with a
start time, you'll jump the media controller to that time if
it's not already past it. (So if there are several, you'll jump
the media controller to the furthest one in the timeline.) -->

<li>

Expand Down Expand Up @@ -28180,7 +28180,7 @@ <h5 id=offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets

<dd>

<p>Returns the <a href=#current-playback-position>current playback position</a>, in seconds.</p>
<p>Returns the <a href=#official-playback-position>official playback position</a>, in seconds.</p>

<p>Can be set, to seek to the given time.<p>

Expand Down Expand Up @@ -28290,15 +28290,23 @@ <h5 id=offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets
<a href=#current-playback-position>current playback position</a> is a time on the <a href=#media-timeline>media
timeline</a>.</p>

<p><a href=#media-element title="media element">Media elements</a> also have an
<dfn id=official-playback-position>official playback position</dfn>, which must initially be set
to zero seconds. The <a href=#official-playback-position>official playback position</a> is an
approximation of the <a href=#current-playback-position>current playback position</a>
that is kept stable while scripts are running.</p>

<p>The <dfn id=dom-media-currenttime title=dom-media-currentTime><code>currentTime</code></dfn>
attribute must, on getting, return the <a href=#current-playback-position>current playback
position</a>, expressed in seconds. On setting,
if the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
controller</a>, then it must throw an
<code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception; otherwise,
the user agent
must <a href=#dom-media-seek title=dom-media-seek>seek</a> to the new value
(which might raise an exception).</p>
attribute must, on getting, return the <a href=#official-playback-position>official playback
position</a>, expressed in seconds. On setting, if the
<a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
controller</a>, then the user agent must throw an
<code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception; otherwise, if the
<a href=#media-element>media element</a>'s <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> is <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then it must
raise an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception; otherwise, the it
must set the <a href=#official-playback-position>official playback position</a> to the new
value and then <a href=#dom-media-seek title=dom-media-seek>seek</a> to the new
value.</p>

<p><a href=#media-element title="media element">Media elements</a> have an
<dfn id=initial-playback-position>initial playback position</dfn>, which must initially (i.e. in
Expand Down Expand Up @@ -28871,7 +28879,8 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
true.</li>

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

<li><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> named <code title=event-media-ended><a href=#event-media-ended>ended</a></code>
Expand All @@ -28885,7 +28894,8 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
<ol><li><p>Stop playback.</li>

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

</ol><hr><p>The <dfn id=dom-media-defaultplaybackrate title=dom-media-defaultPlaybackRate><code>defaultPlaybackRate</code></dfn>
attribute gives the desired speed at which the <a href=#media-resource>media
Expand Down Expand Up @@ -28953,9 +28963,9 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the

<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
event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the <a href=#media-element>media
element</a>.</p> <!-- if we're already playing at this point,
it might also fire 'waiting' -->
event</a> named <code title=event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the
<a href=#media-element>media element</a>.</p> <!-- if we're already playing at
this point, it might also fire 'waiting' -->

</li>

Expand Down Expand Up @@ -29028,6 +29038,9 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
event</a> named <code title=event-media-pause><a href=#event-media-pause>pause</a></code>
at the element.</li>

<li><p>Set the <a href=#official-playback-position>official playback position</a> to the
<a href=#current-playback-position>current playback position</a>.</li>

</ol></li>

<li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media
Expand Down Expand Up @@ -29073,6 +29086,11 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
playback rate) the client doesn't actually have to drop or
interpolate any frames.</p>

<p>Any time the user agent <a href=#provide-a-stable-state title="provide a stable
state">provides a stable state</a>, the <a href=#official-playback-position>official playback
position</a> must be set to the <a href=#current-playback-position>current playback
position</a>.</p>

<p>When the <a href=#direction-of-playback>direction of playback</a> is backwards, any
corresponding audio must be muted. When the <a href=#effective-playback-rate>effective playback
rate</a> is so low or so high that the user agent cannot play
Expand Down Expand Up @@ -29350,10 +29368,8 @@ <h5 id=seeking><span class=secno>4.8.10.9 </span>Seeking</h5>
loop</a> algorithm). Steps in that section are marked with
&#8987;.</p>

<ol><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> is <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then raise an
<code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception (if the seek was in
response to a DOM method call or setting of an IDL attribute), and
abort these steps.</li>
<ol><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> is <code title=dom-media-HAVE_NOTHING><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, abort these
steps.</li>

<li><p>If the element's <code title=dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> IDL attribute is true,
then another instance of this algorithm is already running. Abort
Expand Down Expand Up @@ -29406,6 +29422,11 @@ <h5 id=seeking><span class=secno>4.8.10.9 </span>Seeking</h5>
element.</p> <!-- also, timeupdate -->
<!-- also, it will do the "report the controller state" thing -->

<p class=note>The <code title=dom-media-currentTime><a href=#dom-media-currenttime>currentTime</a></code> attribute does
not get updated asynchronously, as it returns the <a href=#official-playback-position>official
playback position</a>, not the <a href=#current-playback-position>current playback
position</a>.</p>

</li>

<li><p>Wait until the user agent has established whether or not the
Expand Down Expand Up @@ -30410,7 +30431,7 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<
speed with its new media controller</dfn>, it must <a href=#dom-media-seek title=dom-media-seek>seek</a> that <a href=#media-element>media element</a>
to the <code><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position>media controller
position</a> relative to the <a href=#media-element>media element</a>'s
timeline, discarding any resulting exceptions.</p>
timeline.</p>

<p>When the user agent is to <dfn id=seek-the-media-controller>seek the media controller</dfn> to
a particular <var title="">new playback position</var>, it must
Expand All @@ -30427,9 +30448,8 @@ <h6 id=media-controllers><span class=secno>4.8.10.11.2 </span>Media controllers<

<li><p><a href=#dom-media-seek title=dom-media-seek>Seek</a> each <a href=#slaved-media-elements title="slaved media elements">slaved media element</a> to the
<var title="">new playback position</var> relative to the
<a href=#media-element>media element</a> timeline, discarding any resulting
exceptions.</li> <!-- i.e. "bring the media element up to speed
with its new media controller" -->
<a href=#media-element>media element</a> timeline.</li> <!-- i.e. "bring the
media element up to speed with its new media controller" -->

</ol><p>A <code><a href=#mediacontroller>MediaController</a></code> is a <dfn id=blocked-media-controller>blocked media
controller</dfn> if the <code><a href=#mediacontroller>MediaController</a></code> is a
Expand Down

0 comments on commit 334b91b

Please sign in to comment.