Skip to content

Commit

Permalink
[giow] (3) Try to clean up the mess around when 'change' events are f…
Browse files Browse the repository at this point in the history
…ired for audio and video tracks

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=24977
Affected topics: HTML, Video and Audio

git-svn-id: http://svn.whatwg.org/webapps@8623 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 8, 2014
1 parent 49408f8 commit b00bf6a
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 55 deletions.
73 changes: 56 additions & 17 deletions complete.html
Expand Up @@ -1681,7 +1681,7 @@ <h4 id=extensibility><span class=secno>1.7.3 </span>Extensibility</h4>

<p><i>This section is non-normative.</i></p>

<p>HTML has a wide number of extensibility mechanisms that can be used for adding semantics in a
<p>HTML has a wide array of extensibility mechanisms that can be used for adding semantics in a
safe manner:</p>

<ul><li>Authors can use the <code title=attr-class><a href=#classes>class</a></code> attribute to extend elements,
Expand Down Expand Up @@ -26221,6 +26221,30 @@ <h5 id=loading-the-media-resource><span class=secno>4.7.10.5 </span>Loading the
<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>Let <var title="">enable</var> be <i>unknown</i>.</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 set of audio tracks to enable, or if the user
agent has information that would facilitate the selection of specific audio tracks to
improve the user's experience, then: if this audio track is one of the ones to enable, then
set <var title="">enable</var> to <i>true</i>, otherwise, set <var title="">enable</var>
to <i>false</i>.</p>

<p class=example>This could be triggered by <cite>Media Fragments URI</cite> fragment
identifier syntax, but it could also be triggered e.g. by the user agent selecting a 5.1
surround sound audio track over a stereo audio track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

</li>

<li><p>If <var title="">enable</var> is still <i>unknown</i>, then, if the <a href=#media-element>media
element</a> does not yet have a selected audio track, then set <var title="">enable</var>
to <i>true</i>, otherwise, set <var title="">enable</var> to <i>false</i>.</li>

<li><p>If <var title="">enable</var> is <i>true</i>, then enable this audio track,
otherwise, do not enable this audio track.</li>

<li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></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>
Expand All @@ -26238,6 +26262,30 @@ <h5 id=loading-the-media-resource><span class=secno>4.7.10.5 </span>Loading the
<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>Let <var title="">enable</var> be <i>unknown</i>.</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 set of video tracks to enable, or if the user
agent has information that would facilitate the selection of specific video tracks to
improve the user's experience, then: if this video track is the first such video track, then
set <var title="">enable</var> to <i>true</i>, otherwise, set <var title="">enable</var>
to <i>false</i>.</p>

<p class=example>This could again be triggered by <cite>Media Fragments URI</cite>
fragment identifier syntax.</p>

</li>

<li><p>If <var title="">enable</var> is still <i>unknown</i>, then, if the <a href=#media-element>media
element</a> does not yet have a selected video track, then set <var title="">enable</var>
to <i>true</i>, otherwise, set <var title="">enable</var> to <i>false</i>.</li>

<li><p>If <var title="">enable</var> is <i>true</i>, then select this track and unselect any
previously selected video tracks, otherwise, do not select this video track. If other tracks
are unselected, then <a href=#toggle-video-track>a <code title=event-media-change>change</code> event will be fired.</a></li>

<li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></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>
Expand Down Expand Up @@ -26327,21 +26375,11 @@ <h5 id=loading-the-media-resource><span class=secno>4.7.10.5 </span>Loading the

</li>

<li>

<!--CLEANUP-->
<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 set of audio or video tracks to enable,
or if the user agent has information that would enable it to select specific tracks to improve the user's experience, then the
relevant audio tracks must be enabled in the element's <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> object, and, of the relevant video tracks,
the one that is listed first in the element's <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> object must be selected. All other tracks
must be disabled.</p>
<li><p>If there is no enabled audio track, then enable an audio track. This <a href=#toggle-audio-track>will cause a <code title=event-media-change>change</code> event
to be fired</a>.</li>

<p class=example>This could again be triggered by <cite>Media Fragments URI</cite>
fragment identifier syntax, but it could also be triggered e.g. by the user agent selecting
a 5.1 surround sound audio track over a stereo audio track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

</li>
<li><p>If there is no selected video track, then select a video track. This <a href=#toggle-video-track>will cause a <code title=event-media-change>change</code> event
to be fired</a>.</li>

<li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then:
if <var title="">jumped</var> is true and the <a href=#initial-playback-position>initial playback position</a>,
Expand Down Expand Up @@ -28216,7 +28254,8 @@ <h6 id=audiotracklist-and-videotracklist-objects><span class=secno>4.7.10.10.1 <
longer in an <code><a href=#audiotracklist>AudioTrackList</a></code> object, then the track being enabled or disabled has no
effect beyond changing the value of the attribute on the <code><a href=#audiotrack>AudioTrack</a></code> object.)</p>

<p>Whenever an audio track in an <code><a href=#audiotracklist>AudioTrackList</a></code> is enabled or disabled, the user
<!--CLEANUP-->
<p id=toggle-audio-track>Whenever an audio track in an <code><a href=#audiotracklist>AudioTrackList</a></code> that was disabled is enabled, and whenever one that was enabled is disabled, 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-change><a href=#event-media-change>change</a></code> at the <code><a href=#audiotracklist>AudioTrackList</a></code> object.</p>

<p>The <dfn id=dom-videotracklist-selectedindex title=dom-VideoTrackList-selectedIndex><code>VideoTrackList.selectedIndex</code></dfn> attribute
Expand All @@ -28232,7 +28271,7 @@ <h6 id=audiotracklist-and-videotracklist-objects><span class=secno>4.7.10.10.1 <
being selected or unselected has no effect beyond changing the value of the attribute on the
<code><a href=#videotrack>VideoTrack</a></code> object.)</p>

<p>Whenever a track in a <code><a href=#videotracklist>VideoTrackList</a></code> that was previously not selected is selected,
<p id=toggle-video-track>Whenever a track in a <code><a href=#videotracklist>VideoTrackList</a></code> that was previously not selected is selected,
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-change><a href=#event-media-change>change</a></code> at the <code><a href=#videotracklist>VideoTrackList</a></code> object. This <a href=#concept-task title=concept-task>task</a> must be <a href=#queue-a-task title="queue a task">queued</a> before the
<a href=#concept-task title=concept-task>task</a> that fires the <code title=event-media-resize><a href=#event-media-resize>resize</a></code> event, if any.</p>

Expand Down
73 changes: 56 additions & 17 deletions index
Expand Up @@ -1681,7 +1681,7 @@

<p><i>This section is non-normative.</i></p>

<p>HTML has a wide number of extensibility mechanisms that can be used for adding semantics in a
<p>HTML has a wide array of extensibility mechanisms that can be used for adding semantics in a
safe manner:</p>

<ul><li>Authors can use the <code title=attr-class><a href=#classes>class</a></code> attribute to extend elements,
Expand Down Expand Up @@ -26221,6 +26221,30 @@ interface <dfn id=htmlmediaelement>HTMLMediaElement</dfn> : <a href=#htmlelement
<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>Let <var title="">enable</var> be <i>unknown</i>.</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 set of audio tracks to enable, or if the user
agent has information that would facilitate the selection of specific audio tracks to
improve the user's experience, then: if this audio track is one of the ones to enable, then
set <var title="">enable</var> to <i>true</i>, otherwise, set <var title="">enable</var>
to <i>false</i>.</p>

<p class=example>This could be triggered by <cite>Media Fragments URI</cite> fragment
identifier syntax, but it could also be triggered e.g. by the user agent selecting a 5.1
surround sound audio track over a stereo audio track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

</li>

<li><p>If <var title="">enable</var> is still <i>unknown</i>, then, if the <a href=#media-element>media
element</a> does not yet have a selected audio track, then set <var title="">enable</var>
to <i>true</i>, otherwise, set <var title="">enable</var> to <i>false</i>.</li>

<li><p>If <var title="">enable</var> is <i>true</i>, then enable this audio track,
otherwise, do not enable this audio track.</li>

<li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></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>
Expand All @@ -26238,6 +26262,30 @@ interface <dfn id=htmlmediaelement>HTMLMediaElement</dfn> : <a href=#htmlelement
<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>Let <var title="">enable</var> be <i>unknown</i>.</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 set of video tracks to enable, or if the user
agent has information that would facilitate the selection of specific video tracks to
improve the user's experience, then: if this video track is the first such video track, then
set <var title="">enable</var> to <i>true</i>, otherwise, set <var title="">enable</var>
to <i>false</i>.</p>

<p class=example>This could again be triggered by <cite>Media Fragments URI</cite>
fragment identifier syntax.</p>

</li>

<li><p>If <var title="">enable</var> is still <i>unknown</i>, then, if the <a href=#media-element>media
element</a> does not yet have a selected video track, then set <var title="">enable</var>
to <i>true</i>, otherwise, set <var title="">enable</var> to <i>false</i>.</li>

<li><p>If <var title="">enable</var> is <i>true</i>, then select this track and unselect any
previously selected video tracks, otherwise, do not select this video track. If other tracks
are unselected, then <a href=#toggle-video-track>a <code title=event-media-change>change</code> event will be fired.</a></li>

<li><p><a href=#concept-event-fire title=concept-event-fire>Fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-media-addtrack><a href=#event-media-addtrack>addtrack</a></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>
Expand Down Expand Up @@ -26327,21 +26375,11 @@ interface <dfn id=htmlmediaelement>HTMLMediaElement</dfn> : <a href=#htmlelement

</li>

<li>

<!--CLEANUP-->
<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 set of audio or video tracks to enable,
or if the user agent has information that would enable it to select specific tracks to improve the user's experience, then the
relevant audio tracks must be enabled in the element's <code title=dom-media-audioTracks><a href=#dom-media-audiotracks>audioTracks</a></code> object, and, of the relevant video tracks,
the one that is listed first in the element's <code title=dom-media-videoTracks><a href=#dom-media-videotracks>videoTracks</a></code> object must be selected. All other tracks
must be disabled.</p>
<li><p>If there is no enabled audio track, then enable an audio track. This <a href=#toggle-audio-track>will cause a <code title=event-media-change>change</code> event
to be fired</a>.</li>

<p class=example>This could again be triggered by <cite>Media Fragments URI</cite>
fragment identifier syntax, but it could also be triggered e.g. by the user agent selecting
a 5.1 surround sound audio track over a stereo audio track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>

</li>
<li><p>If there is no selected video track, then select a video track. This <a href=#toggle-video-track>will cause a <code title=event-media-change>change</code> event
to be fired</a>.</li>

<li><p>If the <a href=#media-element>media element</a> has a <a href=#current-media-controller>current media controller</a>, then:
if <var title="">jumped</var> is true and the <a href=#initial-playback-position>initial playback position</a>,
Expand Down Expand Up @@ -28216,7 +28254,8 @@ interface <dfn id=videotrack>VideoTrack</dfn> {
longer in an <code><a href=#audiotracklist>AudioTrackList</a></code> object, then the track being enabled or disabled has no
effect beyond changing the value of the attribute on the <code><a href=#audiotrack>AudioTrack</a></code> object.)</p>

<p>Whenever an audio track in an <code><a href=#audiotracklist>AudioTrackList</a></code> is enabled or disabled, the user
<!--CLEANUP-->
<p id=toggle-audio-track>Whenever an audio track in an <code><a href=#audiotracklist>AudioTrackList</a></code> that was disabled is enabled, and whenever one that was enabled is disabled, 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-change><a href=#event-media-change>change</a></code> at the <code><a href=#audiotracklist>AudioTrackList</a></code> object.</p>

<p>The <dfn id=dom-videotracklist-selectedindex title=dom-VideoTrackList-selectedIndex><code>VideoTrackList.selectedIndex</code></dfn> attribute
Expand All @@ -28232,7 +28271,7 @@ interface <dfn id=videotrack>VideoTrack</dfn> {
being selected or unselected has no effect beyond changing the value of the attribute on the
<code><a href=#videotrack>VideoTrack</a></code> object.)</p>

<p>Whenever a track in a <code><a href=#videotracklist>VideoTrackList</a></code> that was previously not selected is selected,
<p id=toggle-video-track>Whenever a track in a <code><a href=#videotracklist>VideoTrackList</a></code> that was previously not selected is selected,
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-change><a href=#event-media-change>change</a></code> at the <code><a href=#videotracklist>VideoTrackList</a></code> object. This <a href=#concept-task title=concept-task>task</a> must be <a href=#queue-a-task title="queue a task">queued</a> before the
<a href=#concept-task title=concept-task>task</a> that fires the <code title=event-media-resize><a href=#event-media-resize>resize</a></code> event, if any.</p>

Expand Down

0 comments on commit b00bf6a

Please sign in to comment.