Skip to content
Permalink
Browse files

[giow] (0) Fire addtrack events whenver a track is added to a media e…

…lement.

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

git-svn-id: http://svn.whatwg.org/webapps@6609 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 30, 2011
1 parent 141309a commit 5cb55466bf564797d74a0aca7cdd6c8493f6ef31
Showing with 237 additions and 10 deletions.
  1. +72 −3 complete.html
  2. +73 −4 index
  3. +92 −3 source
wrong type) -->


<dt id=found-another-audio-track>If the <a href=#media-resource>media
resource</a> is found to have an audio track</dt>

<dd>

<ol><li><p>Create a <code><a href=#audiotrack>AudioTrack</a></code> object to represent the
audio track.</li>

<li><p>Update the <a href=#media-element>media element</a>'s <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> attribute's
<code><a href=#audiotracklist>AudioTrackList</a></code> object with the new
<code><a href=#audiotrack>AudioTrack</a></code> object.</li>

<li><p>Fire an event with the name <code title=event-addtrack>addtrack</code>, that does not bubble and
is not cancelable, and that uses the <code><a href=#trackevent>TrackEvent</a></code>
interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized
to the new <code><a href=#audiotrack>AudioTrack</a></code> object, at this
<code><a href=#audiotracklist>AudioTrackList</a></code> object.</li>

</ol></dd>


<dt id=found-another-video-track>If the <a href=#media-resource>media
resource</a> is found to have a video track</dt>

<dd>

<ol><li><p>Create a <code><a href=#videotrack>VideoTrack</a></code> object to represent the
video track.</li>

<li><p>Update the <a href=#media-element>media element</a>'s <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> attribute's
<code><a href=#videotracklist>VideoTrackList</a></code> object with the new
<code><a href=#videotrack>VideoTrack</a></code> object.</li>

<li><p>Fire an event with the name <code title=event-addtrack>addtrack</code>, that does not bubble and
is not cancelable, and that uses the <code><a href=#trackevent>TrackEvent</a></code>
interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized
to the new <code><a href=#videotrack>VideoTrack</a></code> object, at this
<code><a href=#videotracklist>VideoTrackList</a></code> object.</li>

</ol></dd>


<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,
agent recognises and supports as being equivalent to a <a href=#text-track>text
track</a>, the user agent <a href=#found-a-media-resource-specific-timed-track>runs</a> the
<dfn id=steps-to-expose-a-media-resource-specific-text-track>steps to expose a media-resource-specific text track</dfn>
with the relevant data, as follows:</p>
with the relevant data, as follows.</p>

<!-- this runs synchronously from a fetch task -->

<ol><li><p>Associate the relevant data with a new <a href=#text-track>text
track</a> and its corresponding new <code><a href=#texttrack>TextTrack</a></code>
<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>

<li><p>Fire an event with the name <code title=event-addtrack>addtrack</code>, that does not bubble and is
not cancelable, and that uses the <code><a href=#trackevent>TrackEvent</a></code>
interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code>
attribute initialized to the <a href=#text-track>text track</a>'s
<code><a href=#texttrack>TextTrack</a></code> object, at the <a href=#media-element>media element</a>'s
<code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
<code><a href=#texttracklist>TextTrackList</a></code> object.</li>

</ol><p>When a <a href=#media-element>media element</a> is to <dfn id="forget-the-media-element's-media-resource-specific-text-tracks">forget the media
element's media-resource-specific text tracks</dfn>, the user
agent must remove from the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list
the new parent is a <a href=#media-element>media element</a>, then the user agent
must add the <code><a href=#the-track-element>track</a></code> element's corresponding <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>.</p>
tracks</a>, and then <a href=#queue-a-task>queue a task</a> to fire an event
with the name <code title=event-addtrack>addtrack</code>, that
does not bubble and is not cancelable, and that uses the
<code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to
the <a href=#text-track>text track</a>'s <code><a href=#texttrack>TextTrack</a></code> object, at the
<a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
<code><a href=#texttracklist>TextTrackList</a></code> object.</p>

<p>When a <code><a href=#the-track-element>track</a></code> element's parent element changes and
the old parent was a <a href=#media-element>media element</a>, then the user agent
must remove the <code><a href=#the-track-element>track</a></code> element's corresponding
<a href=#text-track>text track</a> from the <a href=#media-element>media element</a>'s
<a href=#list-of-text-tracks>list of text tracks</a>.</p>
<a href=#list-of-text-tracks>list of text tracks</a>.</p> <!-- removetrack -->

<p>When a <a href=#text-track>text track</a> corresponding to a
<code><a href=#the-track-element>track</a></code> element is added to a <a href=#media-element>media

</li>

<li>

<p><a href=#queue-a-task>Queue a task</a> to fire an event with the name <code title=event-addtrack>addtrack</code>, that does not bubble and
is not cancelable, and that uses the <code><a href=#trackevent>TrackEvent</a></code>
interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to
the new <a href=#text-track>text track</a>'s <code><a href=#mutabletexttrack>MutableTextTrack</a></code>
object, at the <a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
<code><a href=#texttracklist>TextTrackList</a></code> object.</p>

</li>

<li>

<p>Return the new <code><a href=#mutabletexttrack>MutableTextTrack</a></code> object.</p>
77 index
wrong type) -->


<dt id=found-another-audio-track>If the <a href=#media-resource>media
resource</a> is found to have an audio track</dt>

<dd>

<ol><li><p>Create a <code><a href=#audiotrack>AudioTrack</a></code> object to represent the
audio track.</li>

<li><p>Update the <a href=#media-element>media element</a>'s <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> attribute's
<code><a href=#audiotracklist>AudioTrackList</a></code> object with the new
<code><a href=#audiotrack>AudioTrack</a></code> object.</li>

<li><p>Fire an event with the name <code title=event-addtrack>addtrack</code>, that does not bubble and
is not cancelable, and that uses the <code><a href=#trackevent>TrackEvent</a></code>
interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized
to the new <code><a href=#audiotrack>AudioTrack</a></code> object, at this
<code><a href=#audiotracklist>AudioTrackList</a></code> object.</li>

</ol></dd>


<dt id=found-another-video-track>If the <a href=#media-resource>media
resource</a> is found to have a video track</dt>

<dd>

<ol><li><p>Create a <code><a href=#videotrack>VideoTrack</a></code> object to represent the
video track.</li>

<li><p>Update the <a href=#media-element>media element</a>'s <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> attribute's
<code><a href=#videotracklist>VideoTrackList</a></code> object with the new
<code><a href=#videotrack>VideoTrack</a></code> object.</li>

<li><p>Fire an event with the name <code title=event-addtrack>addtrack</code>, that does not bubble and
is not cancelable, and that uses the <code><a href=#trackevent>TrackEvent</a></code>
interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized
to the new <code><a href=#videotrack>VideoTrack</a></code> object, at this
<code><a href=#videotracklist>VideoTrackList</a></code> object.</li>

</ol></dd>


<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,
agent recognises and supports as being equivalent to a <a href=#text-track>text
track</a>, the user agent <a href=#found-a-media-resource-specific-timed-track>runs</a> the
<dfn id=steps-to-expose-a-media-resource-specific-text-track>steps to expose a media-resource-specific text track</dfn>
with the relevant data, as follows:</p>
with the relevant data, as follows.</p>

<!-- this runs synchronously from a fetch task -->

<ol><li><p>Associate the relevant data with a new <a href=#text-track>text
track</a> and its corresponding new <code><a href=#texttrack>TextTrack</a></code>
<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>

<li><p>Fire an event with the name <code title=event-addtrack>addtrack</code>, that does not bubble and is
not cancelable, and that uses the <code><a href=#trackevent>TrackEvent</a></code>
interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code>
attribute initialized to the <a href=#text-track>text track</a>'s
<code><a href=#texttrack>TextTrack</a></code> object, at the <a href=#media-element>media element</a>'s
<code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
<code><a href=#texttracklist>TextTrackList</a></code> object.</li>

</ol><p>When a <a href=#media-element>media element</a> is to <dfn id="forget-the-media-element's-media-resource-specific-text-tracks">forget the media
element's media-resource-specific text tracks</dfn>, the user
agent must remove from the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list
the new parent is a <a href=#media-element>media element</a>, then the user agent
must add the <code><a href=#the-track-element>track</a></code> element's corresponding <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>.</p>
tracks</a>, and then <a href=#queue-a-task>queue a task</a> to fire an event
with the name <code title=event-addtrack>addtrack</code>, that
does not bubble and is not cancelable, and that uses the
<code><a href=#trackevent>TrackEvent</a></code> interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to
the <a href=#text-track>text track</a>'s <code><a href=#texttrack>TextTrack</a></code> object, at the
<a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
<code><a href=#texttracklist>TextTrackList</a></code> object.</p>

<p>When a <code><a href=#the-track-element>track</a></code> element's parent element changes and
the old parent was a <a href=#media-element>media element</a>, then the user agent
must remove the <code><a href=#the-track-element>track</a></code> element's corresponding
<a href=#text-track>text track</a> from the <a href=#media-element>media element</a>'s
<a href=#list-of-text-tracks>list of text tracks</a>.</p>
<a href=#list-of-text-tracks>list of text tracks</a>.</p> <!-- removetrack -->

<p>When a <a href=#text-track>text track</a> corresponding to a
<code><a href=#the-track-element>track</a></code> element is added to a <a href=#media-element>media

</li>

<li>

<p><a href=#queue-a-task>Queue a task</a> to fire an event with the name <code title=event-addtrack>addtrack</code>, that does not bubble and
is not cancelable, and that uses the <code><a href=#trackevent>TrackEvent</a></code>
interface, with the <code title=dom-TrackEvent-track><a href=#dom-trackevent-track>track</a></code> attribute initialized to
the new <a href=#text-track>text track</a>'s <code><a href=#mutabletexttrack>MutableTextTrack</a></code>
object, at the <a href=#media-element>media element</a>'s <code title=dom-media-textTracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
<code><a href=#texttracklist>TextTrackList</a></code> object.</p>

</li>

<li>

<p>Return the new <code><a href=#mutabletexttrack>MutableTextTrack</a></code> object.</p>

<!-- this is filler to make sure the TCP packet boundary doesn't fall in the middle of one of the NCRs below -->
<!-- (because otherwise the parser in anolis screws it up) -->
<p><img alt="The top of the em square is roughly at the top of the glyphs in a font, the hanging baseline is where some glyphs like &#2310; are anchored, the middle is half-way between the top of the em square and the bottom of the em square, the alphabetic baseline is where characters like &Aacute;, " height=300 src=http://images.whatwg.org/baselines.png width=738>x00FF;, f, and &Omega; are anchored, the ideographic baseline is where glyphs like &#31169; and &#36948; are anchored, and the bottom of the em square is roughly at the bottom of the glyphs in a font. The top and bottom of the bounding box can be far from these baselines, due to glyphs extending far outside the em square."&gt;</p>
<p><img alt="The top of the em square is roughly at the top of the glyphs in a font, the hanging baseline is where some glyphs like &#2310; are anchored, the middle is half-way between the top of the em square and the bottom of the em square, the alphabetic baseline is where characters like &Aacute;, &yuml;, f, and &Omega; are anchored, the ideographic baseline is where glyphs like &#31169; and &#36948; are anchored, and the bottom of the em square is roughly at the bottom of the glyphs in a font. The top and bottom of the bounding box can be far from these baselines, due to glyphs extending far outside the em square." height=300 src=http://images.whatwg.org/baselines.png width=738></p>

<p>The keywords map to these alignment points as follows:</p>

0 comments on commit 5cb5546

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