Skip to content

Commit

Permalink
[giow] (1) Make setting .currentTime before the media has loaded stil…
Browse files Browse the repository at this point in the history
…l work (by waiting til it is loaded to seek).

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

git-svn-id: http://svn.whatwg.org/webapps@6580 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 23, 2011
1 parent 5f2e6df commit 6bef4b5
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 110 deletions.
79 changes: 44 additions & 35 deletions complete.html
Expand Up @@ -27352,10 +27352,8 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the

<dt id=getting-media-metadata>Once enough of the <a href=#media-data>media
data</a> has been fetched to determine the duration of the
<a href=#media-resource>media resource</a>, its dimensions, and other
metadata,
and once <a href=#the-text-tracks-are-ready>the text tracks are ready</a>
</dt>
<a href=#media-resource>media resource</a>, its dimensions, and other metadata,
and once <a href=#the-text-tracks-are-ready>the text tracks are ready</a> </dt>

<dd>

Expand Down Expand Up @@ -27421,12 +27419,18 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the

<li><p>Let <var title="">jumped</var> be false.</li>

<li><p>If the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback
start position</a> is greater than zero, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time, and let <var title="">jumped</var> be true.</li>

<li><p>Let the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback
start position</a> be zero.</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.</p>
position</a> to that time and, if <var title="">jumped</var> is still false, <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 @@ -27468,26 +27472,22 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the
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>

<p>Once the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute
reaches <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>,
<a href=#fire-loadeddata>after the <code title=event-media-loadeddata>loadeddata</code> event has been
fired</a>, 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>.</p>

<p class=note>A user agent that is attempting to reduce
network usage while still fetching the metadata for each
<a href=#media-resource>media resource</a> would also stop buffering at this
point, following <a href=#resourceSuspend>the rules
described previously</a>, which involve the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
switching to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value and a
<code title=event-suspend>suspend</code> event firing.</p>

</li>

</ol><p class=note>The user agent is <em>required</em> to
</ol><p>Once the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute
reaches <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>,
<a href=#fire-loadeddata>after the <code title=event-media-loadeddata>loadeddata</code> event has been
fired</a>, 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>.</p>

<p class=note>A user agent that is attempting to reduce
network usage while still fetching the metadata for each
<a href=#media-resource>media resource</a> would also stop buffering at this
point, following <a href=#resourceSuspend>the rules
described previously</a>, which involve the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
switching to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value and a
<code title=event-suspend>suspend</code> event firing.</p>

<p class=note>The user agent is <em>required</em> to
determine the duration of the <a href=#media-resource>media resource</a> and
go through this step before playing.</p> <!-- actually defined
in the 'duration' section -->
Expand Down Expand Up @@ -27522,8 +27522,9 @@ <h5 id=loading-the-media-resource><span class=secno>4.8.10.5 </span>Loading the
</dd>


<dt>If the connection is interrupted after some <a href=#media-data>media data</a> has been received, causing the user agent to
give up trying to fetch the resource</dt>
<dt>If the connection is interrupted after some <a href=#media-data>media
data</a> has been received, causing the user agent to give up
trying to fetch the resource</dt>

<dd>

Expand Down Expand Up @@ -27936,17 +27937,25 @@ <h5 id=offsets-into-the-media-resource><span class=secno>4.8.10.6 </span>Offsets
approximation of the <a href=#current-playback-position>current playback position</a>
that is kept stable while scripts are running.</p>

<p><a href=#media-element title="media element">Media elements</a> also have a
<dfn id=default-playback-start-position>default playback start position</dfn>, which must initially be
set to zero seconds. This time is used to allow the element to be
seeked even before the media is loaded.</p>

<p>The <dfn id=dom-media-currenttime title=dom-media-currentTime><code>currentTime</code></dfn>
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
attribute must, on getting, return the <a href=#media-element>media element</a>'s
<a href=#default-playback-start-position>default playback start position</a>, unless that is zero,
in which case it must return the element's <a href=#official-playback-position>official playback
position</a>. The returned value must be 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>
<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 set
the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback start
position</a> to the new value; otherwise, 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. The new
value must be interpreted as being in seconds.</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
79 changes: 44 additions & 35 deletions index
Expand Up @@ -27219,10 +27219,8 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael

<dt id=getting-media-metadata>Once enough of the <a href=#media-data>media
data</a> has been fetched to determine the duration of the
<a href=#media-resource>media resource</a>, its dimensions, and other
metadata,
and once <a href=#the-text-tracks-are-ready>the text tracks are ready</a>
</dt>
<a href=#media-resource>media resource</a>, its dimensions, and other metadata,
and once <a href=#the-text-tracks-are-ready>the text tracks are ready</a> </dt>

<dd>

Expand Down Expand Up @@ -27288,12 +27286,18 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael

<li><p>Let <var title="">jumped</var> be false.</li>

<li><p>If the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback
start position</a> is greater than zero, then <a href=#dom-media-seek title=dom-media-seek>seek</a> to that time, and let <var title="">jumped</var> be true.</li>

<li><p>Let the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback
start position</a> be zero.</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.</p>
position</a> to that time and, if <var title="">jumped</var> is still false, <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 @@ -27335,26 +27339,22 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
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>

<p>Once the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute
reaches <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>,
<a href=#fire-loadeddata>after the <code title=event-media-loadeddata>loadeddata</code> event has been
fired</a>, 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>.</p>

<p class=note>A user agent that is attempting to reduce
network usage while still fetching the metadata for each
<a href=#media-resource>media resource</a> would also stop buffering at this
point, following <a href=#resourceSuspend>the rules
described previously</a>, which involve the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
switching to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value and a
<code title=event-suspend>suspend</code> event firing.</p>

</li>

</ol><p class=note>The user agent is <em>required</em> to
</ol><p>Once the <code title=dom-media-readyState><a href=#dom-media-readystate>readyState</a></code> attribute
reaches <code title=dom-media-HAVE_CURRENT_DATA><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>,
<a href=#fire-loadeddata>after the <code title=event-media-loadeddata>loadeddata</code> event has been
fired</a>, 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>.</p>

<p class=note>A user agent that is attempting to reduce
network usage while still fetching the metadata for each
<a href=#media-resource>media resource</a> would also stop buffering at this
point, following <a href=#resourceSuspend>the rules
described previously</a>, which involve the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute
switching to the <code title=dom-media-NETWORK_IDLE><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value and a
<code title=event-suspend>suspend</code> event firing.</p>

<p class=note>The user agent is <em>required</em> to
determine the duration of the <a href=#media-resource>media resource</a> and
go through this step before playing.</p> <!-- actually defined
in the 'duration' section -->
Expand Down Expand Up @@ -27389,8 +27389,9 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
</dd>


<dt>If the connection is interrupted after some <a href=#media-data>media data</a> has been received, causing the user agent to
give up trying to fetch the resource</dt>
<dt>If the connection is interrupted after some <a href=#media-data>media
data</a> has been received, causing the user agent to give up
trying to fetch the resource</dt>

<dd>

Expand Down Expand Up @@ -27803,17 +27804,25 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
approximation of the <a href=#current-playback-position>current playback position</a>
that is kept stable while scripts are running.</p>

<p><a href=#media-element title="media element">Media elements</a> also have a
<dfn id=default-playback-start-position>default playback start position</dfn>, which must initially be
set to zero seconds. This time is used to allow the element to be
seeked even before the media is loaded.</p>

<p>The <dfn id=dom-media-currenttime title=dom-media-currentTime><code>currentTime</code></dfn>
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
attribute must, on getting, return the <a href=#media-element>media element</a>'s
<a href=#default-playback-start-position>default playback start position</a>, unless that is zero,
in which case it must return the element's <a href=#official-playback-position>official playback
position</a>. The returned value must be 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>
<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 set
the <a href=#media-element>media element</a>'s <a href=#default-playback-start-position>default playback start
position</a> to the new value; otherwise, 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. The new
value must be interpreted as being in seconds.</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

0 comments on commit 6bef4b5

Please sign in to comment.