Skip to content

Commit

Permalink
[giow] (1) <track> loading algorithm updates (part 1)
Browse files Browse the repository at this point in the history
Affected topics: Video Text Tracks, Video and Audio

git-svn-id: http://svn.whatwg.org/webapps@7326 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 7, 2012
1 parent 97d9746 commit 41f8589
Show file tree
Hide file tree
Showing 3 changed files with 261 additions and 237 deletions.
163 changes: 85 additions & 78 deletions complete.html
Expand Up @@ -33513,7 +33513,7 @@ <h6>Ducking</h6>

<p><dfn>Ducking</dfn> is the process of reducing the volume of one
audio track when another audio track is playing, for example
occasionally reducing the volume of a the soundtrack to allow the
occasionally reducing the volume of a soundtrack to allow the
viewer to hear an intermittent commentary track.</p>

(add an "autoduck" attribute that reduces the volume of other media
Expand Down Expand Up @@ -34056,6 +34056,10 @@ <h6 id=sourcing-in-band-text-tracks><span class=secno>4.8.10.12.2 </span>Sourcin
label in that data, then the <a href=#text-track-label title="text track
label">label</a> must be set to the empty string.</li>

<li><p>Associate the <a href=#text-track-list-of-cues>text track list of cues</a> with the
<a href=#rules-for-updating-the-text-track-rendering>rules for updating the text track rendering</a>
appropriate for the format in question.</p>

<li>

<p>If the new <a href=#text-track>text track</a>'s <a href=#text-track-kind title="text track
Expand Down Expand Up @@ -34140,15 +34144,12 @@ <h6 id=sourcing-in-band-text-tracks><span class=secno>4.8.10.12.2 </span>Sourcin
to load the whole media file just to start playing the first
frame... -->

<!-- XXX-MODE-HEURISTIC -->
<li><p>Set the new <a href=#text-track>text track</a>'s <a href=#text-track-mode title="text
track mode">mode</a> to the mode consistent with the user's
preferences and the requirements of the relevant specification for
the data.</li>

<li><p>Leave the <a href=#text-track-list-of-cues>text track list of cues</a> empty, and
associate with it the <a href=#rules-for-updating-the-text-track-rendering>rules for updating the text track
rendering</a> appropriate for the format in question.</p>

<li><p>Add the new <a href=#text-track>text track</a> to the <a href=#media-element>media
element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>.</li>

Expand Down Expand Up @@ -34326,33 +34327,35 @@ <h6 id=sourcing-out-of-band-text-tracks><span class=secno>4.8.10.12.3 </span>Sou
</dl><p>When a <a href=#text-track>text track</a> corresponding to a
<code><a href=#the-track-element>track</a></code> element is created with <a href=#text-track-mode>text track
mode</a> set to <a href=#text-track-hidden title="text track hidden">hidden</a>,
<a href=#text-track-showing title="text track showing">showing</a>, or <a href=#text-track-showing-by-default title="text track showing by default">showing by default</a>,
and when a <a href=#text-track>text track</a> corresponding to a
<code><a href=#the-track-element>track</a></code> element is created with <a href=#text-track-mode>text track
mode</a> set to <a href=#text-track-disabled title="text track
disabled">disabled</a> and subsequently changes its <a href=#text-track-mode>text
track mode</a> to <a href=#text-track-hidden title="text track hidden">hidden</a>,
<a href=#text-track-showing title="text track showing">showing</a>, or <a href=#text-track-showing-by-default title="text track showing by default">showing by default</a> for
the first time, the user agent must immediately and synchronously
run the following algorithm. This algorithm interacts closely with
the <a href=#event-loop>event loop</a> mechanism; in particular, it has a
<a href=#synchronous-section>synchronous section</a> (which is triggered as part of the
<a href=#event-loop>event loop</a> algorithm). The step in that section is
marked with &#8987;.</p>
<a href=#text-track-showing title="text track showing">showing</a>, or <a href=#text-track-showing-by-default title="text track showing by default">showing by default</a>, and
when a <a href=#text-track>text track</a> corresponding to a <code><a href=#the-track-element>track</a></code>
element is created with <a href=#text-track-mode>text track mode</a> set to <a href=#text-track-disabled title="text track disabled">disabled</a> and subsequently changes
its <a href=#text-track-mode>text track mode</a> to <a href=#text-track-hidden title="text track
hidden">hidden</a>, <a href=#text-track-showing title="text track
showing">showing</a>, or <a href=#text-track-showing-by-default title="text track showing by
default">showing by default</a> for the first time, the user
agent must asynchronously run the following
algorithm. This algorithm interacts closely with the <a href=#event-loop>event
loop</a> mechanism; in particular, it has a <a href=#synchronous-section>synchronous
section</a> (which is triggered as part of the <a href=#event-loop>event
loop</a> algorithm). The steps in that section are marked with
&#8987;.</p>

<ol><li><p>Set the <a href=#text-track-readiness-state>text track readiness state</a> to <a href=#text-track-loading title="text track loading">loading</a>.</li>
<ol><li><p><i>Top</i>: <a href=#await-a-stable-state>Await a stable state</a>. The
<a href=#synchronous-section>synchronous section</a> consists of the following steps.
(The steps in the <a href=#synchronous-section>synchronous section</a> are marked with
&#8987;.)</li>

<li><p>Let <var title="">URL</var> be the <a href=#track-url>track URL</a> of
the <code><a href=#the-track-element>track</a></code> element.</li>
<li><p>&#8987; Set the <a href=#text-track-readiness-state>text track readiness state</a> to
<a href=#text-track-loading title="text track loading">loading</a>.</li>

<li><p>Asynchronously run the remaining steps, while continuing
with whatever task was responsible for creating the <a href=#text-track>text
track</a> or changing the <a href=#text-track-mode>text track
mode</a>.</li>
<li><p>&#8987; Let <var title="">URL</var> be the <a href=#track-url>track
URL</a> of the <code><a href=#the-track-element>track</a></code> element.</li>

<li>
<li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the
remaining steps asynchronously.</li>

<p><i>Download</i>: At this point, the text track is downloaded.</p>
<li>

<p>If <var title="">URL</var> is not the empty string, perform a
<a href=#potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of <var title="">URL</var>, with the <i>mode</i> being the state of the
Expand All @@ -34372,13 +34375,19 @@ <h6 id=sourcing-out-of-band-text-tracks><span class=secno>4.8.10.12.3 </span>Sou
algorithm</a> on the <a href=#networking-task-source>networking task source</a> to
process the data as it is being fetched must <!--<span
title="Content-Type sniffing">-->determine the <!--sniffed--> type
of a the resource<!--</span>-->. If the <!--sniffed--> type of the
of the resource<!--</span>-->. If the <!--sniffed--> type of the
resource is not a supported text track format, the load will fail,
as described below. Otherwise, the resource's data must be passed
to the appropriate parser (e.g. the <a href=#webvtt-parser>WebVTT parser</a><!--
if the file starts with the "<code title="">WEBVTT</code>"
signature-->) as it is received, with the <a href=#text-track-list-of-cues>text track list of
cues</a> being used for that parser's output. <a href=#refsWEBVTT>[WEBVTT]</a></p>
cues</a> being used for that parser's output. <a href=#refsWEBVTT>[WEBVTT]</a></p><!-- see also critical block
below, and the word "sniffed" in the paragraph after that -->

<p class=note>The appropriate parser will synchronously (during
these <a href=#networking-task-source>networking task source</a> <a href=#concept-task title=concept-task>tasks</a>) and incrementally (as each such
task is run with whatever data has been received from the network)
update the <a href=#text-track-list-of-cues>text track list of cues</a>.</p>

<p class=critical>This specification does not currently say
whether or how to check the MIME types of text tracks, or whether
Expand All @@ -34396,15 +34405,29 @@ <h6 id=sourcing-out-of-band-text-tracks><span class=secno>4.8.10.12.3 </span>Sou
<p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for
any reason (network error, the server returns an error code, a
cross-origin check fails, etc), if <var title="">URL</var> is the
empty string, or if the sniffed type of the resource is not a
supported text track format, then <a href=#queue-a-task>queue a task</a> to
first change the <a href=#text-track-readiness-state>text track readiness state</a> to <a href=#text-track-failed-to-load title="text track failed to load">failed to load</a> and then
<a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-error>error</code> at the <code><a href=#the-track-element>track</a></code>
element; and then, once that <a href=#concept-task title=concept-task>task</a> is <a href=#queue-a-task title="queue a
task">queued</a>, move on to the step below labeled
<i>monitoring</i>.</p>

<p>If the <a href=#fetch title=fetch>fetching algorithm</a> does not
empty string, or if the <!--sniffed--> type of the resource is not a
supported text track format, then run these steps:

<ol><li><p><a href=#queue-a-task>Queue a task</a> to first change the <a href=#text-track-readiness-state>text
track readiness state</a> to <a href=#text-track-failed-to-load title="text track failed to
load">failed to load</a> and then <a href=#fire-a-simple-event>fire a simple
event</a> named <code title=event-error>error</code> at the
<code><a href=#the-track-element>track</a></code> element.</li>

<li><p>Wait until the <a href=#text-track-readiness-state>text track readiness state</a> is
no longer set to <a href=#text-track-loading title="text track
loading">loading</a>.</li>

<li><p>Wait until the <a href=#track-url>track URL</a> is no longer equal
to <var title="">URL</var>, at the same time as the <a href=#text-track-mode>text
track mode</a> is set to <a href=#text-track-hidden title="text track
hidden">hidden</a>, <a href=#text-track-showing title="text track
showing">showing</a>, or <a href=#text-track-showing-by-default title="text track showing by
default">showing by default</a>.</li>

<li><p>Jump to the step labeled <i>top</i>.</li>

</ol><p>If the <a href=#fetch title=fetch>fetching algorithm</a> does not
fail, then the final <a href=#concept-task title=concept-task>task</a> that
is <a href=#queue-a-task title="queue a task">queued</a> by the
<a href=#networking-task-source>networking task source</a> must run the following
Expand All @@ -34419,16 +34442,23 @@ <h6 id=sourcing-out-of-band-text-tracks><span class=secno>4.8.10.12.3 </span>Sou
event</a> named <code title=event-load>load</code> at the
<code><a href=#the-track-element>track</a></code> element.</p>

<p>If the file was not successfully processed, e.g. the format
in question is an XML format and the file contained a
<p>Otherwise, the file was not successfully processed (e.g. the
format in question is an XML format and the file contained a
well-formedness error that the XML specification requires be
detected and reported to the application, then <a href=#fire-a-simple-event>fire a
simple event</a> named <code title=event-error>error</code>
at the <code><a href=#the-track-element>track</a></code> element.</p>
detected and reported to the application); <a href=#fire-a-simple-event>fire a simple
event</a> named <code title=event-error>error</code> at the
<code><a href=#the-track-element>track</a></code> element.</p>

</li>

<li><p>Jump to the step below labeled <i>monitoring</i>.</li>
<li><p>Wait until the <a href=#track-url>track URL</a> is no longer equal
to <var title="">URL</var>, at the same time as the <a href=#text-track-mode>text
track mode</a> is set to <a href=#text-track-hidden title="text track
hidden">hidden</a>, <a href=#text-track-showing title="text track
showing">showing</a>, or <a href=#text-track-showing-by-default title="text track showing by
default">showing by default</a>.</li>

<li><p>Jump back to the step labeled <i>top</i>.</li>

</ol><p>If, while the <a href=#fetch title=fetch>fetching algorithm</a> is
active, either:</p>
Expand All @@ -34449,47 +34479,24 @@ <h6 id=sourcing-out-of-band-text-tracks><span class=secno>4.8.10.12.3 </span>Sou

<ol><li><p>Abort the <a href=#fetch title=fetch>fetching algorithm</a>,
discarding any pending <a href=#concept-task title=concept-task>tasks</a>
generated by that algorithm.</li>

<li><p>Let <var title="">URL</var> be the new <a href=#track-url>track
URL</a>.</li>
generated by that algorithm (and in particular, not adding any
cues to the <a href=#text-track-list-of-cues>text track list of cues</a> after the moment
the URL changed).</li>

<li><p>Jump back to the top of the step labeled
<i>download</i>.</li>
<li><p>Jump back to the step labeled <i>top</i>.</li>

</ol><p>Until one of the above circumstances occurs, the user agent
must remain on this step.</p>

</li>

<li><p><i>Monitoring</i>: Wait until the <a href=#track-url>track URL</a> is
no longer equal to <var title="">URL</var>, at the same time as the
<a href=#text-track-mode>text track mode</a> is set to <a href=#text-track-hidden title="text track
hidden">hidden</a>, <a href=#text-track-showing title="text track
showing">showing</a>, or <a href=#text-track-showing-by-default title="text track showing by
default">showing by default</a>.</li>

<li><p>Wait until the <a href=#text-track-readiness-state>text track readiness state</a> is
no longer set to <a href=#text-track-loading title="text track
loading">loading</a>.</li>

<li><p><a href=#await-a-stable-state>Await a stable state</a>. The <a href=#synchronous-section>synchronous
section</a> consists of the following step. (The step in the
<a href=#synchronous-section>synchronous section</a> is marked with &#8987;.)</li>
</ol><p>Whenever a <code><a href=#the-track-element>track</a></code> element has its <code title=attr-track-src><a href=#attr-track-src>src</a></code> attribute set, changed, or
removed, the user agent must synchronously empty the element's
<a href=#text-track>text track</a>'s <a href=#text-track-list-of-cues>text track list of cues</a>.
(This also causes the algorithm above to stop adding cues from the
resource being obtained using the previously given URL, if any.)</p>

<li><p>&#8987; Set the <a href=#text-track-readiness-state>text track readiness state</a> to
<a href=#text-track-loading title="text track loading">loading</a>.</li>

<!-- if you add more, change the grammar of the sentences above to
be plural with respect to the number of synchronous steps (both in
the step above and in the intro to the whole algorithm) -->

<li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the
remaining steps asynchronously.</li>

<li><p>Jump to the step labeled <i>download</i>.</li>

</ol></div>
</div>


<div class=impl>
Expand Down Expand Up @@ -34715,7 +34722,7 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
<a href=#text-track>text track</a> that the <code><a href=#texttrack>TextTrack</a></code> object
represents.</p>

<p>The <dfn id=dom-texttrack-inbandmetadatatrackdispatchtype title=dom-TextTrack-inBandMetadataTrackDispatchType>inBandMetadataTrackDispatchType<code></code></dfn>
<p>The <dfn id=dom-texttrack-inbandmetadatatrackdispatchtype title=dom-TextTrack-inBandMetadataTrackDispatchType><code>inBandMetadataTrackDispatchType</code></dfn>
attribute must return the <a href=#text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track
dispatch type</a> of the <a href=#text-track>text track</a> that the
<code><a href=#texttrack>TextTrack</a></code> object represents.</p>
Expand Down

0 comments on commit 41f8589

Please sign in to comment.