Clarified ambiguous text and added Acknowledgments section.
--- a/media-source/media-source-respec.html Tue Apr 30 10:33:46 2013 -0700
+++ b/media-source/media-source-respec.html Thu May 02 12:35:13 2013 -0700
@@ -57,6 +57,7 @@
definitionMap: {
MediaSource: function() {},
SourceBuffer: function() {},
+ SourceBufferList: function() {},
AbortMode: function() {},
MediaPlaybackQuality: function() {},
},
@@ -296,27 +297,75 @@
<li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at <var>sourceBuffer</var>.</li>
</ol>
</li>
- <li>Set the the sourceBuffer attribute in all tracks in <var>sourceBuffer</var>.<a def-id="sourcebuffer-audioTracks"></a>, <var>sourceBuffer</var>.<a def-id="sourcebuffer-videoTracks"></a>, and <var>sourceBuffer</var>.<a def-id="sourcebuffer-textTracks"></a> to null.</li>
- <li>Remove all the tracks in <var>sourceBuffer</var>.<a def-id="sourcebuffer-audioTracks"></a>, <var>sourceBuffer</var>.<a def-id="sourcebuffer-videoTracks"></a>, and <var>sourceBuffer</var>.<a def-id="sourcebuffer-textTracks"></a> from the respective <a def-id="audiotracks"></a>, <a def-id="videotracks"></a>, and <a def-id="texttracks"></a> attributes on the HTMLMediaElement.</li>
- <li>Remove all the tracks in <var>sourceBuffer</var>.<a def-id="sourcebuffer-audioTracks"></a>, <var>sourceBuffer</var>.<a def-id="sourcebuffer-videoTracks"></a>, and <var>sourceBuffer</var>.<a def-id="sourcebuffer-textTracks"></a> and <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-removetrack"></a> at the modified lists.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-removetrack"></a> at the HTMLMediaElement track lists that were modified.</li>
- <li>If <var>sourceBuffer</var> is in <a def-id="activeSourceBuffers"></a>, then run the following steps:
+
+ <li>Let <var>SourceBuffer audioTracks list</var> equal the <a def-id="audio-track-list"></a> object returned by <var>sourceBuffer</var>.<a def-id="sourcebuffer-audioTracks"></a>.</li>
+ <li>If the <var>SourceBuffer audioTracks list</var> is not empty, then run the following steps:
<ol>
- <li>Remove <var>sourceBuffer</var> from <a def-id="activeSourceBuffers"></a>.</li>
- <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at <a def-id="activeSourceBuffers"></a>.</li>
- <li>If the <a def-id="videoref" name="dom-videotrack-selected">selected video track</a> was removed from the <a def-id="videotracks"></a>
- attribute on the HTMLMediaElement in a step above, then <a def-id="queue-a-task-to-fire-an-event-named"></a>
- <a def-id="tracklist-change"></a> at the <a def-id="video-track-list"></a> object referenced by the <a def-id="videotracks"></a> attribute.</li>
- <li>If an <a def-id="videoref" name="dom-audiotrack-enabled">enabled audio track</a> was removed from the <a def-id="audiotracks"></a>
- attribute on the HTMLMediaElement in a step above, then <a def-id="queue-a-task-to-fire-an-event-named"></a>
- <a def-id="tracklist-change"></a> at the <a def-id="audio-track-list"></a> object referenced by the <a def-id="audiotracks"></a> attribute.</li>
- <li>If a <a def-id="text-track"></a> with its <a def-id="texttrack-mode"></a> attribute set to
- <a def-id="videoref" name="dom-texttrack-showing">"showing"</a> or <a def-id="videoref" name="dom-texttrack-hidden">"hidden"</a>
- was removed from the <a def-id="texttracks"></a> attribute on the HTMLMediaElement in a step above, then
- <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-change"></a> at the <a def-id="text-track-list"></a> object referenced by the <a def-id="texttracks"></a> attribute.</li>
+ <li>Let <var>HTMLMediaElement audioTracks list</var> equal the <a def-id="audio-track-list"></a> object returned by the <a def-id="audiotracks"></a> attribute on the HTMLMediaElement.</li>
+ <li>Let the <var>removed enabled audio track flag</var> equal false.</li>
+ <li>For each <a def-id="audio-track"></a> object in the <var>SourceBuffer audioTracks list</var>, run the following steps:
+ <ol>
+ <li>Set the <a def-id="audiotrack-sourceBuffer"></a> attribute on the <a def-id="audio-track"></a> object to null.</li>
+ <li>If the <a def-id="audiotrack-enabled"></a> attribute on the <a def-id="audio-track"></a> object is true, then
+ set the <var>removed enabled audio track flag</var> to true.</li>
+ <li>Remove the <a def-id="audio-track"></a> object from the <var>HTMLMediaElement audioTracks list</var>.</li>
+ <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-removetrack"></a> at the <var>HTMLMediaElement audioTracks list</var>.</li>
+ <li>Remove the <a def-id="audio-track"></a> object from the <var>SourceBuffer audioTracks list</var>.</li>
+ <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-removetrack"></a> at the <var>SourceBuffer audioTracks list</var>.</li>
+ </ol>
+ </li>
+ <li>If the <var>removed enabled audio track flag</var> equals true, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-change"></a> at the
+ <var>HTMLMediaElement audioTracks list</var>.</li>
</ol>
</li>
- <li>Remove <var>sourceBuffer</var> from <a def-id="sourceBuffers"></a> and <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at <a def-id="sourceBuffers"></a>.</li>
+
+ <li>Let <var>SourceBuffer videoTracks list</var> equal the <a def-id="video-track-list"></a> object returned by <var>sourceBuffer</var>.<a def-id="sourcebuffer-videoTracks"></a>.</li>
+ <li>If the <var>SourceBuffer videoTracks list</var> is not empty, then run the following steps:
+ <ol>
+ <li>Let <var>HTMLMediaElement videoTracks list</var> equal the <a def-id="video-track-list"></a> object returned by the <a def-id="videotracks"></a> attribute on the HTMLMediaElement.</li>
+ <li>Let the <var>removed selected video track flag</var> equal false.</li>
+ <li>For each <a def-id="video-track"></a> object in the <var>SourceBuffer videoTracks list</var>, run the following steps:
+ <ol>
+ <li>Set the <a def-id="videotrack-sourceBuffer"></a> attribute on the <a def-id="video-track"></a> object to null.</li>
+ <li>If the <a def-id="videotrack-selected"></a> attribute on the <a def-id="video-track"></a> object is true, then
+ set the <var>removed selected video track flag</var> to true.</li>
+ <li>Remove the <a def-id="video-track"></a> object from the <var>HTMLMediaElement videoTracks list</var>.</li>
+ <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-removetrack"></a> at the <var>HTMLMediaElement videoTracks list</var>.</li>
+ <li>Remove the <a def-id="video-track"></a> object from the <var>SourceBuffer videoTracks list</var>.</li>
+ <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-removetrack"></a> at the <var>SourceBuffer videoTracks list</var>.</li>
+ </ol>
+ </li>
+ <li>If the <var>removed selected video track flag</var> equals true, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-change"></a> at the
+ <var>HTMLMediaElement videoTracks list</var>.</li>
+ </ol>
+ </li>
+
+
+ <li>Let <var>SourceBuffer textTracks list</var> equal the <a def-id="text-track-list"></a> object returned by <var>sourceBuffer</var>.<a def-id="sourcebuffer-textTracks"></a>.</li>
+ <li>If the <var>SourceBuffer textTracks list</var> is not empty, then run the following steps:
+ <ol>
+ <li>Let <var>HTMLMediaElement textTracks list</var> equal the <a def-id="text-track-list"></a> object returned by the <a def-id="texttracks"></a> attribute on the HTMLMediaElement.</li>
+ <li>Let the <var>removed enabled text track flag</var> equal false.</li>
+ <li>For each <a def-id="text-track"></a> object in the <var>SourceBuffer textTracks list</var>, run the following steps:
+ <ol>
+ <li>Set the <a def-id="texttrack-sourceBuffer"></a> attribute on the <a def-id="text-track"></a> object to null.</li>
+ <li>If the <a def-id="texttrack-mode"></a> attribute on the <a def-id="text-track"></a> object is set to <a def-id="texttrack-showing"></a> or
+ <a def-id="texttrack-hidden"></a> , then set the <var>removed enabled text track flag</var> to true.</li>
+ <li>Remove the <a def-id="text-track"></a> object from the <var>HTMLMediaElement textTracks list</var>.</li>
+ <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-removetrack"></a> at the <var>HTMLMediaElement textTracks list</var>.</li>
+ <li>Remove the <a def-id="text-track"></a> object from the <var>SourceBuffer textTracks list</var>.</li>
+ <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-removetrack"></a> at the <var>SourceBuffer textTracks list</var>.</li>
+ </ol>
+ </li>
+ <li>If the <var>removed enabled text track flag</var> equals true, then <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="tracklist-change"></a> at the
+ <var>HTMLMediaElement textTracks list</var>.</li>
+ </ol>
+ </li>
+
+ <li>If <var>sourceBuffer</var> is in <a def-id="activeSourceBuffers"></a>, then remove <var>sourceBuffer</var> from <a def-id="activeSourceBuffers"></a> and
+ <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at the <a>SourceBufferList</a> returned by <a def-id="activeSourceBuffers"></a>.</li>
+ <li>Remove <var>sourceBuffer</var> from <a def-id="sourceBuffers"></a> and <a def-id="queue-a-task-to-fire-an-event-named"></a> <a def-id="removesourcebuffer"></a> at
+ the <a>SourceBufferList</a> returned by <a def-id="sourceBuffers"></a>.</li>
<li>Destroy all resources for <var>sourceBuffer</var>.</li>
</ol>
</dd>
@@ -332,7 +381,7 @@
<li>
<a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceended"></a> at the <a>MediaSource</a>.</li>
<li><dl class="switch">
- <dt>If <var>error</var> is not set, null, or an empty string</dt>
+ <dt>If <var>error</var> is not set, is null, or is an empty string</dt>
<dd>
<ol>
<li>Run the <a def-id="duration-change-algorithm"></a> with <var>new duration</var> set to the highest end timestamp across all <a>SourceBuffer</a> objects in <a def-id="sourceBuffers"></a>.<br>
@@ -429,8 +478,8 @@
<section id="mediasource-attach">
<h4>Attaching to a media element</h4>
<p> A <a>MediaSource</a> object can be attached to a media element by assigning a <a def-id="MediaSource-object-URL"></a> to the media element <a def-id="media-src"></a> attribute or the src attribute of a <source> inside a media element. A <a def-id="MediaSource-object-URL"></a> is created by passing a MediaSource object to <a def-id="createObjectURL"></a>.</p>
- <p>If the <a def-id="resource-fetch-algorithm"></a> absolute URL matches the MediaSource object URL, run the following steps right before the "Perform a potentially
- CORS-enabled fetch" step in the <a def-id="resource-fetch-algorithm"></a>.</p>
+ <p>If the <a def-id="resource-fetch-algorithm"></a> absolute URL matches the MediaSource object URL, run the following steps right before the <a def-id="perform-potentially-cors-enabled-fetch"></a>
+ step in the <a def-id="resource-fetch-algorithm"></a>.</p>
<dl class="switch">
<dt>If <a def-id="readyState"></a> is NOT set to <a def-id="closed"></a></dt>
@@ -441,7 +490,9 @@
<li>Set the <a def-id="readyState"></a> attribute to <a def-id="open"></a>.</li>
<li>
<a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceopen"></a> at the <a>MediaSource</a>.</li>
- <li>Allow the <a def-id="resource-fetch-algorithm"></a> to progress based on data passed in via <a def-id="appendBuffer"></a> and <a def-id="appendStream"></a>.</li>
+ <li>Continue the <a def-id="resource-fetch-algorithm"></a> by running the <a def-id="perform-potentially-cors-enabled-fetch"></a> step. Text in the <a def-id="resource-fetch-algorithm"></a>
+ that refers to "the download" or "bytes received" refer to data passed in via <a def-id="appendBuffer"></a> and <a def-id="appendStream"></a>. References to
+ HTTP in the <a def-id="resource-fetch-algorithm"></a> do not apply because the HTMLMediaElement does not fetch media data via HTTP when a <a>MediaSource</a> is attached.</li>
</ol>
</dd>
</dl>
@@ -624,13 +675,17 @@
<h4>Duration change</h4>
<p>Follow these steps when <a def-id="duration"></a> needs to change to a <var>new duration</var>.</p>
<ol>
- <li>If the current value of <a def-id="duration"></a> is equal to <var>new duration</var>, then abort these steps.</li>
+ <li>If the current value of <a def-id="duration"></a> is equal to <var>new duration</var>, then return.</li>
<li>Set <var>old duration</var> to the current value of <a def-id="duration"></a>.
<li>Update <a def-id="duration"></a> to <var>new duration</var>.</li>
<li>If the <var>new duration</var> is less than <var>old duration</var>, then call <code><a href="#widl-SourceBuffer-remove-void-double-start-double-end">remove</a>(<var>new duration</var>, <var>old duration</var>)</code> on all objects in <a def-id="sourceBuffers"></a>.
- <p class="note">This preserves audio frames that start before and end after the <a def-id="duration"></a>. The user agent must end playback at <a def-id="duration"></a> even if the audio frame extends beyond this time.</p>
+ <p class="note">This preserves audio frames and text cues that start before and end after the <a def-id="duration"></a>.</p></li>
+ <li>If a user agent is unable to partially render audio frames or text cues that start before and end after the <a def-id="duration"></a>, then run the following steps:
+ <ol>
+ <li>Update <var>new duration</var> to the highest end timestamp across all <a>SourceBuffer</a> objects in <a def-id="sourceBuffers"></a>.</li>
+ <li>Update <a def-id="duration"></a> to <var>new duration</var>.</li>
+ </ol>
</li>
-
<li>Update the <a def-id="hme-duration"></a> to <var>new duration</var> and run the <a def-id="hme-duration-change-algorithm"></a>.</li>
</ol>
</section>
@@ -2170,6 +2225,11 @@
</div>
</section>
+ <section id="acknowledgements">
+ <h2>Acknowledgments</h2>
+ The editors would like to thank <a def-id="contributors"></a> for their contributions to this specification.
+ </section>
+
<section id="revision-history">
<h2>Revision History</h2>
<table class="old-table">
@@ -2180,7 +2240,17 @@
</tr>
</thead>
<tbody>
- <td>30 April 2013</td>
+ <tr>
+ <td>02 May 2013</td>
+ <td>
+ <ul>
+ <li>Reworked ambiguous text in a variety of places.</li>
+ <li>Added Acknowledgements section.</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ffb76048861e/media-source/media-source.html">30 April 2013</a></td>
<td>
<ul>
<li>Bug 21822 - Fix 'fire ... event ... at the X attribute' text.</li>
--- a/media-source/media-source.html Tue Apr 30 10:33:46 2013 -0700
+++ b/media-source/media-source.html Thu May 02 12:35:13 2013 -0700
@@ -421,7 +421,7 @@
</p>
<h1 class="title" id="title">Media Source Extensions</h1>
- <h2 id="w3c-editor-s-draft-30-april-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 30 April 2013</h2>
+ <h2 id="w3c-editor-s-draft-02-may-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 02 May 2013</h2>
<dl>
<dt>This version:</dt>
@@ -534,7 +534,7 @@
-</section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#goals" class="tocxref"><span class="secno">1.1 </span>Goals</a></li><li class="tocline"><a href="#definitions" class="tocxref"><span class="secno">1.2 </span>Definitions</a></li></ul></li><li class="tocline"><a href="#mediasource" class="tocxref"><span class="secno">2. </span>MediaSource Object</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">2.1 </span>Attributes</a></li><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">2.2 </span>Methods</a></li><li class="tocline"><a href="#mediasource-events" class="tocxref"><span class="secno">2.3 </span>Event Summary</a></li><li class="tocline"><a href="#mediasource-algorithms" class="tocxref"><span class="secno">2.4 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#mediasource-attach" class="tocxref"><span class="secno">2.4.1 </span>Attaching to a media element</a></li><li class="tocline"><a href="#mediasource-detach" class="tocxref"><span class="secno">2.4.2 </span>Detaching from a media element</a></li><li class="tocline"><a href="#mediasource-seeking" class="tocxref"><span class="secno">2.4.3 </span>Seeking</a></li><li class="tocline"><a href="#buffer-monitoring" class="tocxref"><span class="secno">2.4.4 </span>SourceBuffer Monitoring</a></li><li class="tocline"><a href="#active-source-buffer-changes" class="tocxref"><span class="secno">2.4.5 </span>Changes to selected/enabled track state</a></li><li class="tocline"><a href="#duration-change-algorithm" class="tocxref"><span class="secno">2.4.6 </span>Duration change</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebuffer" class="tocxref"><span class="secno">3. </span>SourceBuffer Object</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">3.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">3.2 </span>Methods</a></li><li class="tocline"><a href="#track-buffers" class="tocxref"><span class="secno">3.3 </span>Track Buffers</a></li><li class="tocline"><a href="#sourcebuffer-events" class="tocxref"><span class="secno">3.4 </span>Event Summary</a></li><li class="tocline"><a href="#sourcebuffer-algorithms" class="tocxref"><span class="secno">3.5 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#sourcebuffer-segment-parser-loop" class="tocxref"><span class="secno">3.5.1 </span>Segment Parser Loop</a></li><li class="tocline"><a href="#sourcebuffer-reset-parser-state" class="tocxref"><span class="secno">3.5.2 </span>Reset Parser State</a></li><li class="tocline"><a href="#sourcebuffer-append-error" class="tocxref"><span class="secno">3.5.3 </span>Append Error</a></li><li class="tocline"><a href="#sourcebuffer-buffer-append" class="tocxref"><span class="secno">3.5.4 </span>Buffer Append Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-stream-append-loop" class="tocxref"><span class="secno">3.5.5 </span>Stream Append Loop</a></li><li class="tocline"><a href="#sourcebuffer-init-segment-received" class="tocxref"><span class="secno">3.5.6 </span>Initialization Segment Received</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-processing" class="tocxref"><span class="secno">3.5.7 </span>Coded Frame Processing</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-removal" class="tocxref"><span class="secno">3.5.8 </span>Coded Frame Removal Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-eviction" class="tocxref"><span class="secno">3.5.9 </span>Coded Frame Eviction Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-frame-algorithm" class="tocxref"><span class="secno">3.5.10 </span>Audio Splice Frame Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-rendering-algorithm" class="tocxref"><span class="secno">3.5.11 </span>Audio Splice Rendering Algorithm</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebufferlist" class="tocxref"><span class="secno">4. </span>SourceBufferList Object</a><ul class="toc"><li class="tocline"><a href="#attributes-2" class="tocxref"><span class="secno">4.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-2" class="tocxref"><span class="secno">4.2 </span>Methods</a></li><li class="tocline"><a href="#sourcebufferlist-events" class="tocxref"><span class="secno">4.3 </span>Event Summary</a></li></ul></li><li class="tocline"><a href="#mediaplaybackquality" class="tocxref"><span class="secno">5. </span>MediaPlaybackQuality Object</a><ul class="toc"><li class="tocline"><a href="#attributes-3" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#url" class="tocxref"><span class="secno">6. </span>URL Object Extensions</a><ul class="toc"><li class="tocline"><a href="#methods-3" class="tocxref"><span class="secno">6.1 </span>Methods</a></li></ul></li><li class="tocline"><a href="#htmlmediaelement-extensions" class="tocxref"><span class="secno">7. </span>HTMLMediaElement Extensions</a><ul class="toc"><li class="tocline"><a href="#htmlmediaelement-existing-attributes" class="tocxref"><span class="secno">7.1 </span>Modifications to Existing Attribute Behavior</a></li><li class="tocline"><a href="#htmlmediaelement-new-attributes" class="tocxref"><span class="secno">7.2 </span>New Attributes and Behavior</a><ul class="toc"><li class="tocline"><a href="#attributes-4" class="tocxref"><span class="secno">7.2.1 </span>Attributes</a></li></ul></li></ul></li><li class="tocline"><a href="#audio-track-extensions" class="tocxref"><span class="secno">8. </span>AudioTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-5" class="tocxref"><span class="secno">8.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#video-track-extensions" class="tocxref"><span class="secno">9. </span>VideoTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-6" class="tocxref"><span class="secno">9.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#text-track-extensions" class="tocxref"><span class="secno">10. </span>TextTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-7" class="tocxref"><span class="secno">10.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#byte-stream-formats" class="tocxref"><span class="secno">11. </span>Byte Stream Formats</a><ul class="toc"><li class="tocline"><a href="#webm" class="tocxref"><span class="secno">11.1 </span>WebM Byte Streams</a><ul class="toc"><li class="tocline"><a href="#webm-init-segments" class="tocxref"><span class="secno">11.1.1 </span>Initialization Segments</a></li><li class="tocline"><a href="#webm-media-segments" class="tocxref"><span class="secno">11.1.2 </span>Media Segments</a></li><li class="tocline"><a href="#webm-random-access-points" class="tocxref"><span class="secno">11.1.3 </span>Random Access Points</a></li></ul></li><li class="tocline"><a href="#iso" class="tocxref"><span class="secno">11.2 </span>ISO Base Media File Format Byte Streams</a><ul class="toc"><li class="tocline"><a href="#iso-init-segments" class="tocxref"><span class="secno">11.2.1 </span>Initialization Segments</a></li><li class="tocline"><a href="#iso-media-segments" class="tocxref"><span class="secno">11.2.2 </span>Media Segments</a></li><li class="tocline"><a href="#iso-random-access-points" class="tocxref"><span class="secno">11.2.3 </span>Random Access Points</a></li></ul></li><li class="tocline"><a href="#mpeg2ts" class="tocxref"><span class="secno">11.3 </span>MPEG-2 Transport Stream Byte Streams</a><ul class="toc"><li class="tocline"><a href="#mpeg2ts-general" class="tocxref"><span class="secno">11.3.1 </span>General</a></li><li class="tocline"><a href="#mpeg2ts-init-segments" class="tocxref"><span class="secno">11.3.2 </span>Initialization Segments</a></li><li class="tocline"><a href="#mpeg2ts-media-segments" class="tocxref"><span class="secno">11.3.3 </span>Media Segments</a></li><li class="tocline"><a href="#mpeg2ts-random-access-points" class="tocxref"><span class="secno">11.3.4 </span>Random Access Points</a></li><li class="tocline"><a href="#mpeg2ts-discontinuities" class="tocxref"><span class="secno">11.3.5 </span>Timestamp Rollover & Discontinuities</a></li></ul></li></ul></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">12. </span>Examples</a></li><li class="tocline"><a href="#revision-history" class="tocxref"><span class="secno">13. </span>Revision History</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.1 </span>Informative references</a></li></ul></li></ul></section>
+</section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#goals" class="tocxref"><span class="secno">1.1 </span>Goals</a></li><li class="tocline"><a href="#definitions" class="tocxref"><span class="secno">1.2 </span>Definitions</a></li></ul></li><li class="tocline"><a href="#mediasource" class="tocxref"><span class="secno">2. </span>MediaSource Object</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">2.1 </span>Attributes</a></li><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">2.2 </span>Methods</a></li><li class="tocline"><a href="#mediasource-events" class="tocxref"><span class="secno">2.3 </span>Event Summary</a></li><li class="tocline"><a href="#mediasource-algorithms" class="tocxref"><span class="secno">2.4 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#mediasource-attach" class="tocxref"><span class="secno">2.4.1 </span>Attaching to a media element</a></li><li class="tocline"><a href="#mediasource-detach" class="tocxref"><span class="secno">2.4.2 </span>Detaching from a media element</a></li><li class="tocline"><a href="#mediasource-seeking" class="tocxref"><span class="secno">2.4.3 </span>Seeking</a></li><li class="tocline"><a href="#buffer-monitoring" class="tocxref"><span class="secno">2.4.4 </span>SourceBuffer Monitoring</a></li><li class="tocline"><a href="#active-source-buffer-changes" class="tocxref"><span class="secno">2.4.5 </span>Changes to selected/enabled track state</a></li><li class="tocline"><a href="#duration-change-algorithm" class="tocxref"><span class="secno">2.4.6 </span>Duration change</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebuffer" class="tocxref"><span class="secno">3. </span>SourceBuffer Object</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">3.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">3.2 </span>Methods</a></li><li class="tocline"><a href="#track-buffers" class="tocxref"><span class="secno">3.3 </span>Track Buffers</a></li><li class="tocline"><a href="#sourcebuffer-events" class="tocxref"><span class="secno">3.4 </span>Event Summary</a></li><li class="tocline"><a href="#sourcebuffer-algorithms" class="tocxref"><span class="secno">3.5 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#sourcebuffer-segment-parser-loop" class="tocxref"><span class="secno">3.5.1 </span>Segment Parser Loop</a></li><li class="tocline"><a href="#sourcebuffer-reset-parser-state" class="tocxref"><span class="secno">3.5.2 </span>Reset Parser State</a></li><li class="tocline"><a href="#sourcebuffer-append-error" class="tocxref"><span class="secno">3.5.3 </span>Append Error</a></li><li class="tocline"><a href="#sourcebuffer-buffer-append" class="tocxref"><span class="secno">3.5.4 </span>Buffer Append Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-stream-append-loop" class="tocxref"><span class="secno">3.5.5 </span>Stream Append Loop</a></li><li class="tocline"><a href="#sourcebuffer-init-segment-received" class="tocxref"><span class="secno">3.5.6 </span>Initialization Segment Received</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-processing" class="tocxref"><span class="secno">3.5.7 </span>Coded Frame Processing</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-removal" class="tocxref"><span class="secno">3.5.8 </span>Coded Frame Removal Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-eviction" class="tocxref"><span class="secno">3.5.9 </span>Coded Frame Eviction Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-frame-algorithm" class="tocxref"><span class="secno">3.5.10 </span>Audio Splice Frame Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-rendering-algorithm" class="tocxref"><span class="secno">3.5.11 </span>Audio Splice Rendering Algorithm</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebufferlist" class="tocxref"><span class="secno">4. </span>SourceBufferList Object</a><ul class="toc"><li class="tocline"><a href="#attributes-2" class="tocxref"><span class="secno">4.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-2" class="tocxref"><span class="secno">4.2 </span>Methods</a></li><li class="tocline"><a href="#sourcebufferlist-events" class="tocxref"><span class="secno">4.3 </span>Event Summary</a></li></ul></li><li class="tocline"><a href="#mediaplaybackquality" class="tocxref"><span class="secno">5. </span>MediaPlaybackQuality Object</a><ul class="toc"><li class="tocline"><a href="#attributes-3" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#url" class="tocxref"><span class="secno">6. </span>URL Object Extensions</a><ul class="toc"><li class="tocline"><a href="#methods-3" class="tocxref"><span class="secno">6.1 </span>Methods</a></li></ul></li><li class="tocline"><a href="#htmlmediaelement-extensions" class="tocxref"><span class="secno">7. </span>HTMLMediaElement Extensions</a><ul class="toc"><li class="tocline"><a href="#htmlmediaelement-existing-attributes" class="tocxref"><span class="secno">7.1 </span>Modifications to Existing Attribute Behavior</a></li><li class="tocline"><a href="#htmlmediaelement-new-attributes" class="tocxref"><span class="secno">7.2 </span>New Attributes and Behavior</a><ul class="toc"><li class="tocline"><a href="#attributes-4" class="tocxref"><span class="secno">7.2.1 </span>Attributes</a></li></ul></li></ul></li><li class="tocline"><a href="#audio-track-extensions" class="tocxref"><span class="secno">8. </span>AudioTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-5" class="tocxref"><span class="secno">8.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#video-track-extensions" class="tocxref"><span class="secno">9. </span>VideoTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-6" class="tocxref"><span class="secno">9.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#text-track-extensions" class="tocxref"><span class="secno">10. </span>TextTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-7" class="tocxref"><span class="secno">10.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#byte-stream-formats" class="tocxref"><span class="secno">11. </span>Byte Stream Formats</a><ul class="toc"><li class="tocline"><a href="#webm" class="tocxref"><span class="secno">11.1 </span>WebM Byte Streams</a><ul class="toc"><li class="tocline"><a href="#webm-init-segments" class="tocxref"><span class="secno">11.1.1 </span>Initialization Segments</a></li><li class="tocline"><a href="#webm-media-segments" class="tocxref"><span class="secno">11.1.2 </span>Media Segments</a></li><li class="tocline"><a href="#webm-random-access-points" class="tocxref"><span class="secno">11.1.3 </span>Random Access Points</a></li></ul></li><li class="tocline"><a href="#iso" class="tocxref"><span class="secno">11.2 </span>ISO Base Media File Format Byte Streams</a><ul class="toc"><li class="tocline"><a href="#iso-init-segments" class="tocxref"><span class="secno">11.2.1 </span>Initialization Segments</a></li><li class="tocline"><a href="#iso-media-segments" class="tocxref"><span class="secno">11.2.2 </span>Media Segments</a></li><li class="tocline"><a href="#iso-random-access-points" class="tocxref"><span class="secno">11.2.3 </span>Random Access Points</a></li></ul></li><li class="tocline"><a href="#mpeg2ts" class="tocxref"><span class="secno">11.3 </span>MPEG-2 Transport Stream Byte Streams</a><ul class="toc"><li class="tocline"><a href="#mpeg2ts-general" class="tocxref"><span class="secno">11.3.1 </span>General</a></li><li class="tocline"><a href="#mpeg2ts-init-segments" class="tocxref"><span class="secno">11.3.2 </span>Initialization Segments</a></li><li class="tocline"><a href="#mpeg2ts-media-segments" class="tocxref"><span class="secno">11.3.3 </span>Media Segments</a></li><li class="tocline"><a href="#mpeg2ts-random-access-points" class="tocxref"><span class="secno">11.3.4 </span>Random Access Points</a></li><li class="tocline"><a href="#mpeg2ts-discontinuities" class="tocxref"><span class="secno">11.3.5 </span>Timestamp Rollover & Discontinuities</a></li></ul></li></ul></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">12. </span>Examples</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">13. </span>Acknowledgments</a></li><li class="tocline"><a href="#revision-history" class="tocxref"><span class="secno">14. </span>Revision History</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.1 </span>Informative references</a></li></ul></li></ul></section>
<section id="introduction">
@@ -716,7 +716,7 @@
<li>
<a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceended">sourceended</a></code> at the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a>.</li>
<li><dl class="switch">
- <dt>If <var>error</var> is not set, null, or an empty string</dt>
+ <dt>If <var>error</var> is not set, is null, or is an empty string</dt>
<dd>
<ol>
<li>Run the <a href="#duration-change-algorithm">duration change algorithm</a> with <var>new duration</var> set to the highest end timestamp across all <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.<br>
@@ -731,7 +731,7 @@
<dl class="switch">
<dt>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute equals <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_nothing">HAVE_NOTHING</a></code>
</dt>
- <dd>Run the steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
+ <dd>Run the <span>"<i>If the media data cannot be fetched at all, due to network errors, causing the user agent to give up trying to fetch the resource</i>"</span> steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
<dt>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-readystate">HTMLMediaElement.readyState</a></code> attribute is greater than <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-have_nothing">HAVE_NOTHING</a></code>
</dt>
<dd>Run the "<i>If the connection is interrupted after some media data has been received, causing the user agent to give up trying to fetch the resource</i>" steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
@@ -785,27 +785,75 @@
<li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updateend">updateend</a></code> at <var>sourceBuffer</var>.</li>
</ol>
</li>
- <li>Set the the sourceBuffer attribute in all tracks in <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></code>, <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-videoTracks">videoTracks</a></code>, and <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-textTracks">textTracks</a></code> to null.</li>
- <li>Remove all the tracks in <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></code>, <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-videoTracks">videoTracks</a></code>, and <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-textTracks">textTracks</a></code> from the respective <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code>, <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code>, and <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code> attributes on the HTMLMediaElement.</li>
- <li>Remove all the tracks in <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></code>, <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-videoTracks">videoTracks</a></code>, and <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-textTracks">textTracks</a></code> and <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code> at the modified lists.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code> at the HTMLMediaElement track lists that were modified.</li>
- <li>If <var>sourceBuffer</var> is in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, then run the following steps:
+
+ <li>Let <var>SourceBuffer audioTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotracklist">AudioTrackList</a></code> object returned by <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></code>.</li>
+ <li>If the <var>SourceBuffer audioTracks list</var> is not empty, then run the following steps:
<ol>
- <li>Remove <var>sourceBuffer</var> from <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
- <li>If the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected video track</a> was removed from the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code>
- attribute on the HTMLMediaElement in a step above, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotracklist">VideoTrackList</a></code> object referenced by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code> attribute.</li>
- <li>If an <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled audio track</a> was removed from the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code>
- attribute on the HTMLMediaElement in a step above, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named
- <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotracklist">AudioTrackList</a></code> object referenced by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code> attribute.</li>
- <li>If a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> with its <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-mode">mode</a></code> attribute set to
- <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-showing">"showing"</a> or <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-hidden">"hidden"</a>
- was removed from the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code> attribute on the HTMLMediaElement in a step above, then
- <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttracklist">TextTrackList</a></code> object referenced by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code> attribute.</li>
+ <li>Let <var>HTMLMediaElement audioTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotracklist">AudioTrackList</a></code> object returned by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code> attribute on the HTMLMediaElement.</li>
+ <li>Let the <var>removed enabled audio track flag</var> equal false.</li>
+ <li>For each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object in the <var>SourceBuffer audioTracks list</var>, run the following steps:
+ <ol>
+ <li>Set the <code><a href="#widl-AudioTrack-sourceBuffer">sourceBuffer</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object to null.</li>
+ <li>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object is true, then
+ set the <var>removed enabled audio track flag</var> to true.</li>
+ <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object from the <var>HTMLMediaElement audioTracks list</var>.</li>
+ <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code> at the <var>HTMLMediaElement audioTracks list</var>.</li>
+ <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> object from the <var>SourceBuffer audioTracks list</var>.</li>
+ <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code> at the <var>SourceBuffer audioTracks list</var>.</li>
+ </ol>
+ </li>
+ <li>If the <var>removed enabled audio track flag</var> equals true, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the
+ <var>HTMLMediaElement audioTracks list</var>.</li>
</ol>
</li>
- <li>Remove <var>sourceBuffer</var> from <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> and <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
+
+ <li>Let <var>SourceBuffer videoTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotracklist">VideoTrackList</a></code> object returned by <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-videoTracks">videoTracks</a></code>.</li>
+ <li>If the <var>SourceBuffer videoTracks list</var> is not empty, then run the following steps:
+ <ol>
+ <li>Let <var>HTMLMediaElement videoTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotracklist">VideoTrackList</a></code> object returned by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code> attribute on the HTMLMediaElement.</li>
+ <li>Let the <var>removed selected video track flag</var> equal false.</li>
+ <li>For each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object in the <var>SourceBuffer videoTracks list</var>, run the following steps:
+ <ol>
+ <li>Set the <code><a href="#widl-VideoTrack-sourceBuffer">sourceBuffer</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object to null.</li>
+ <li>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object is true, then
+ set the <var>removed selected video track flag</var> to true.</li>
+ <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object from the <var>HTMLMediaElement videoTracks list</var>.</li>
+ <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code> at the <var>HTMLMediaElement videoTracks list</var>.</li>
+ <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> object from the <var>SourceBuffer videoTracks list</var>.</li>
+ <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code> at the <var>SourceBuffer videoTracks list</var>.</li>
+ </ol>
+ </li>
+ <li>If the <var>removed selected video track flag</var> equals true, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the
+ <var>HTMLMediaElement videoTracks list</var>.</li>
+ </ol>
+ </li>
+
+
+ <li>Let <var>SourceBuffer textTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttracklist">TextTrackList</a></code> object returned by <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-textTracks">textTracks</a></code>.</li>
+ <li>If the <var>SourceBuffer textTracks list</var> is not empty, then run the following steps:
+ <ol>
+ <li>Let <var>HTMLMediaElement textTracks list</var> equal the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttracklist">TextTrackList</a></code> object returned by the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code> attribute on the HTMLMediaElement.</li>
+ <li>Let the <var>removed enabled text track flag</var> equal false.</li>
+ <li>For each <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object in the <var>SourceBuffer textTracks list</var>, run the following steps:
+ <ol>
+ <li>Set the <code><a href="#widl-TextTrack-sourceBuffer">sourceBuffer</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object to null.</li>
+ <li>If the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-mode">mode</a></code> attribute on the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object is set to <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-showing">"showing"</a></code> or
+ <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-hidden">"hidden"</a></code> , then set the <var>removed enabled text track flag</var> to true.</li>
+ <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object from the <var>HTMLMediaElement textTracks list</var>.</li>
+ <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code> at the <var>HTMLMediaElement textTracks list</var>.</li>
+ <li>Remove the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> object from the <var>SourceBuffer textTracks list</var>.</li>
+ <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onremovetrack">removetrack</a></code> at the <var>SourceBuffer textTracks list</var>.</li>
+ </ol>
+ </li>
+ <li>If the <var>removed enabled text track flag</var> equals true, then <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#handler-tracklist-onchange">change</a></code> at the
+ <var>HTMLMediaElement textTracks list</var>.</li>
+ </ol>
+ </li>
+
+ <li>If <var>sourceBuffer</var> is in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>, then remove <var>sourceBuffer</var> from <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> and
+ <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at the <a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a> returned by <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.</li>
+ <li>Remove <var>sourceBuffer</var> from <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> and <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-removesourcebuffer">removesourcebuffer</a></code> at
+ the <a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a> returned by <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
<li>Destroy all resources for <var>sourceBuffer</var>.</li>
</ol></dd></dl></section>
@@ -845,19 +893,21 @@
<section id="mediasource-attach">
<h4><span class="secno">2.4.1 </span>Attaching to a media element</h4>
<p> A <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object can be attached to a media element by assigning a <a href="#mediasource-object-url">MediaSource object URL</a> to the media element <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#attr-media-src">src</a></code> attribute or the src attribute of a <source> inside a media element. A <a href="#mediasource-object-url">MediaSource object URL</a> is created by passing a MediaSource object to <code><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL()</a></code>.</p>
- <p>If the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> absolute URL matches the MediaSource object URL, run the following steps right before the "Perform a potentially
- CORS-enabled fetch" step in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</p>
+ <p>If the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> absolute URL matches the MediaSource object URL, run the following steps right before the <span>"<i>Perform a potentially CORS-enabled fetch</i>"</span>
+ step in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</p>
<dl class="switch">
<dt>If <code><a href="#widl-MediaSource-readyState">readyState</a></code> is NOT set to <code><a href="#idl-def-ReadyState.closed">"closed"</a></code></dt>
- <dd>Run the steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
+ <dd>Run the <span>"<i>If the media data cannot be fetched at all, due to network errors, causing the user agent to give up trying to fetch the resource</i>"</span> steps of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</dd>
<dt>Otherwise</dt>
<dd>
<ol>
<li>Set the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute to <code><a href="#idl-def-ReadyState.open">"open"</a></code>.</li>
<li>
<a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-sourceopen">sourceopen</a></code> at the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a>.</li>
- <li>Allow the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> to progress based on data passed in via <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> and <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code>.</li>
+ <li>Continue the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> by running the <span>"<i>Perform a potentially CORS-enabled fetch</i>"</span> step. Text in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>
+ that refers to "the download" or "bytes received" refer to data passed in via <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> and <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code>. References to
+ HTTP in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> do not apply because the HTMLMediaElement does not fetch media data via HTTP when a <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is attached.</li>
</ol>
</dd>
</dl>
@@ -1040,13 +1090,17 @@
<h4><span class="secno">2.4.6 </span>Duration change</h4>
<p>Follow these steps when <code><a href="#widl-MediaSource-duration">duration</a></code> needs to change to a <var>new duration</var>.</p>
<ol>
- <li>If the current value of <code><a href="#widl-MediaSource-duration">duration</a></code> is equal to <var>new duration</var>, then abort these steps.</li>
+ <li>If the current value of <code><a href="#widl-MediaSource-duration">duration</a></code> is equal to <var>new duration</var>, then return.</li>
<li>Set <var>old duration</var> to the current value of <code><a href="#widl-MediaSource-duration">duration</a></code>.
</li><li>Update <code><a href="#widl-MediaSource-duration">duration</a></code> to <var>new duration</var>.</li>
<li>If the <var>new duration</var> is less than <var>old duration</var>, then call <code><a href="#widl-SourceBuffer-remove-void-double-start-double-end">remove</a>(<var>new duration</var>, <var>old duration</var>)</code> on all objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.
- <div class="note"><div class="note-title"><span>Note</span></div><p class="">This preserves audio frames that start before and end after the <code><a href="#widl-MediaSource-duration">duration</a></code>. The user agent must end playback at <code><a href="#widl-MediaSource-duration">duration</a></code> even if the audio frame extends beyond this time.</p></div>
+ <div class="note"><div class="note-title"><span>Note</span></div><p class="">This preserves audio frames and text cues that start before and end after the <code><a href="#widl-MediaSource-duration">duration</a></code>.</p></div></li>
+ <li>If a user agent is unable to partially render audio frames or text cues that start before and end after the <code><a href="#widl-MediaSource-duration">duration</a></code>, then run the following steps:
+ <ol>
+ <li>Update <var>new duration</var> to the highest end timestamp across all <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</li>
+ <li>Update <code><a href="#widl-MediaSource-duration">duration</a></code> to <var>new duration</var>.</li>
+ </ol>
</li>
-
<li>Update the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-controller-duration">media controller duration</a></code> to <var>new duration</var> and run the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#durationChange">HTMLMediaElement duration change algorithm</a>.</li>
</ol>
</section>
@@ -2533,8 +2587,13 @@
</div>
</section>
+ <section id="acknowledgements">
+ <!--OddPage--><h2><span class="secno">13. </span>Acknowledgments</h2>
+ The editors would like to thank Alex Giladi, Bob Lund, Cyril Concolato, David Dorwin, David Singer, Duncan Rowden, Frank Galligan, Glenn Adams, Jerry Smith, Joe Steele, John Simmons, Kevin Streeter, Mark Vickers, Matt Ward, Michael Thornburgh, Philip Jägenstedt, Pierre Lemieux, Ralph Giles, and Steven Robertson for their contributions to this specification.
+ </section>
+
<section id="revision-history">
- <!--OddPage--><h2><span class="secno">13. </span>Revision History</h2>
+ <!--OddPage--><h2><span class="secno">14. </span>Revision History</h2>
<table class="old-table">
<thead>
<tr>
@@ -2543,7 +2602,17 @@
</tr>
</thead>
<tbody>
- <tr><td>30 April 2013</td>
+ <tr>
+ <td>02 May 2013</td>
+ <td>
+ <ul>
+ <li>Reworked ambiguous text in a variety of places.</li>
+ <li>Added Acknowledgements section.</li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/ffb76048861e/media-source/media-source.html">30 April 2013</a></td>
<td>
<ul>
<li>Bug 21822 - Fix 'fire ... event ... at the X attribute' text.</li>
--- a/media-source/media-source.js Tue Apr 30 10:33:46 2013 -0700
+++ b/media-source/media-source.js Thu May 02 12:35:13 2013 -0700
@@ -65,11 +65,48 @@
}
function fragment_helper(doc, df, id, text) {
- var f = doc.createDocumentFragment()
+ var f = doc.createElement('span')
f.innerHTML = text;
df.appendChild(f);
}
+ function contributors_helper(doc, df, id, text) {
+ var contributors = [
+ "Bob Lund",
+ "Alex Giladi",
+ "Duncan Rowden",
+ "Mark Vickers",
+ "Glenn Adams",
+ "Frank Galligan",
+ "Steven Robertson",
+ "Matt Ward",
+ "David Dorwin",
+ "Kevin Streeter",
+ "Joe Steele",
+ "Michael Thornburgh",
+ "Philip Jägenstedt",
+ "John Simmons",
+ "Jerry Smith",
+ "Pierre Lemieux",
+ "Cyril Concolato",
+ "Ralph Giles",
+ "David Singer",
+ ];
+
+ contributors.sort();
+
+ var str = "";
+ for (var i = 0; i < contributors.length - 1; ++i) {
+ if (i > 0)
+ str += ", ";
+ str += contributors[i];
+ }
+ str += ", and ";
+ str += contributors[contributors.length - 1];
+
+ df.appendChild(doc.createTextNode(str));
+ }
+
var rep = {
'sourceBuffers': { func: idlref_helper, fragment: 'widl-MediaSource-sourceBuffers', link_text: 'sourceBuffers', },
'activeSourceBuffers': { func: idlref_helper, fragment: 'widl-MediaSource-activeSourceBuffers', link_text: 'activeSourceBuffers', },
@@ -268,6 +305,9 @@
'media-data-cannot-be-fetched': { func: fragment_helper, fragment: '', link_text: '"<i>If the media data cannot be fetched at all, due to network errors, causing the user agent to give up trying to fetch the resource</i>"', },
+ 'perform-potentially-cors-enabled-fetch': { func: fragment_helper, fragment: '', link_text: '"<i>Perform a potentially CORS-enabled fetch</i>"', },
+
+ 'contributors': { func: contributors_helper, fragment: '', link_text: '', },
};
function mediaSourcePreProcessor() {