Skip to content
Permalink
Browse files

[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 334b91b13d34bf4990aa16e6d8159d6ad3a0a4cc
Showing with 179 additions and 116 deletions.
  1. +59 −39 complete.html
  2. +59 −39 index
  3. +61 −38 source

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

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

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

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


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

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

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

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

<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

0 comments on commit 334b91b

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