Bug 20758 - Make remove() asynchronous.
authorAaron Colwell <acolwell@chromium.org>
Wed, 30 Jan 2013 16:00:55 -0800
changeset 83b35722b0cd8f
parent 82 aae26333e7d1
child 84 77975abeec41
Bug 20758 - Make remove() asynchronous.
media-source/media-source-respec.html
media-source/media-source.html
media-source/media-source.js
     1.1 --- a/media-source/media-source-respec.html	Tue Jan 29 15:44:22 2013 -0800
     1.2 +++ b/media-source/media-source-respec.html	Wed Jan 30 16:00:55 2013 -0800
     1.3 @@ -288,6 +288,7 @@
     1.4            <ol>
     1.5              <li>If the value being set is negative or NaN then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
     1.6              <li>If the <a def-id="readyState"></a> attribute is not <a def-id="open"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
     1.7 +            <li>If the <a def-id="updating"></a> attribute equals true on any <a>SourceBuffer</a> in <a def-id="sourceBuffers"></a>, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
     1.8              <li>Run the <a def-id="duration-change-algorithm"></a> with <var>new duration</var> set to the value being assigned to this attribute.
     1.9  	      <p class="note"><a def-id="appendArrayBuffer"></a>, <a def-id="appendStream"></a> and <a def-id="endOfStream"></a> can update the duration under certain circumstances.</p>
    1.10              </li>
    1.11 @@ -316,6 +317,14 @@
    1.12            <ol class="method-algorithm">
    1.13              <li>If <var>sourceBuffer</var> is null then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
    1.14              <li>If <var>sourceBuffer</var> specifies an object that is not in <a def-id="sourceBuffers"></a> then throw a <a def-id="not-found-err"></a> exception and abort these steps.</li>
    1.15 +            <li>If the <var>sourceBuffer</var>.<a def-id="updating"></a> attribute equals true, then run the following steps:
    1.16 +              <ol>
    1.17 +                <li>Abort the <a def-id="stream-append-loop"></a> algorithm if it is running.</li>
    1.18 +                <li>Set the <var>sourceBuffer</var>.<a def-id="updating"></a> attribute to false.</li>
    1.19 +                <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateabort"></a> at <var>sourceBuffer</var>.</li>
    1.20 +                <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at <var>sourceBuffer</var>.</li>
    1.21 +              </ol>
    1.22 +            </li>
    1.23              <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>
    1.24              <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>
    1.25              <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-change"></a> at the modified lists.</li>
    1.26 @@ -332,6 +341,7 @@
    1.27  
    1.28            <ol class="method-algorithm">
    1.29              <li>If the <a def-id="readyState"></a> attribute is not in the <a def-id="open"></a> state then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.30 +            <li>If the <a def-id="updating"></a> attribute equals true on any <a>SourceBuffer</a> in <a def-id="sourceBuffers"></a>, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.31              <li>Change the <a def-id="readyState"></a> attribute value to <a def-id="ended"></a>.</li>
    1.32              <li>
    1.33                <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="sourceended"></a> at the <a>MediaSource</a>.</li>
    1.34 @@ -646,9 +656,10 @@
    1.35        <p class="issue"><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=20327">Bug 20327</a> - Continuous splice flag</p>
    1.36  
    1.37        <dl title="interface SourceBuffer : EventTarget" class="idl">
    1.38 -        <dt>readonly attribute boolean appending</dt>
    1.39 +        <dt>readonly attribute boolean updating</dt>
    1.40          <dd>
    1.41 -          <p>Indicates whether an <a def-id="appendArrayBuffer"></a> or <a def-id="appendStream"></a> operation is still being processed.</p>
    1.42 +          <p>Indicates whether an <a def-id="appendArrayBuffer"></a>, <a def-id="appendStream"></a>, or <a def-id="remove"></a> operation is still being
    1.43 +            processed.</p>
    1.44          </dd>
    1.45  
    1.46          <dt>readonly attribute TimeRanges buffered</dt>
    1.47 @@ -668,6 +679,7 @@
    1.48            <p>On setting, run the following steps:</p>
    1.49            <ol>
    1.50              <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a>, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.51 +            <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.52              <li>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is not in the <a def-id="open"></a> state, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.53              <li>If this object is waiting for the end of a <a def-id="media-segment"></a> to be appended, then throw an <a def-id="invalid-state-err"></a> and abort these steps.</li>
    1.54              <li>Update the attribute to the new value.</li>
    1.55 @@ -697,7 +709,7 @@
    1.56            <ol class="method-algorithm">
    1.57              <li>If <var>data</var> is null then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
    1.58              <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.59 -            <li>If the <a def-id="appending"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.60 +            <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.61              <li>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is in the <a def-id="closed"></a> state then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.62              <li>
    1.63                <p>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is in the <a def-id="ended"></a> state then run the following steps:</p>
    1.64 @@ -713,8 +725,8 @@
    1.65                <p class="note">The web application must use <a def-id="remove"></a> to free up space in the <a>SourceBuffer</a>.</p>
    1.66              </li>
    1.67              <li>Add <var>data</var> to the end of the <a def-id="input-buffer"></a>.</li>
    1.68 -            <li>Set the <a def-id="appending"></a> attribute to true.</li>
    1.69 -            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="appendstart"></a> at this <a>SourceBuffer</a> object.</li>
    1.70 +            <li>Set the <a def-id="updating"></a> attribute to true.</li>
    1.71 +            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updatestart"></a> at this <a>SourceBuffer</a> object.</li>
    1.72              <li>Asynchronously run the <a def-id="segment-parser-loop"></a> algorithm.</li>
    1.73            </ol>
    1.74          </dd>
    1.75 @@ -729,7 +741,7 @@
    1.76                an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.77              <li>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is in the <a def-id="closed"></a> state then throw
    1.78                an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.79 -            <li>If the <a def-id="appending"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these
    1.80 +            <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these
    1.81                steps.</li>
    1.82              <li>
    1.83                <p>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is in the <a def-id="ended"></a> state then run
    1.84 @@ -743,8 +755,8 @@
    1.85                <p>If the <a def-id="buffer-full-flag"></a> equals true, then throw a <a def-id="quota-exceeded-err"></a> exception and abort these step.</p>
    1.86                <p class="note">The web application must use <a def-id="remove"></a> to free up space in the <a>SourceBuffer</a>.</p>
    1.87              </li>
    1.88 -            <li>Set the <a def-id="appending"></a> attribute to true.</li>
    1.89 -            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="appendstart"></a> at this <a>SourceBuffer</a> object.</li>
    1.90 +            <li>Set the <a def-id="updating"></a> attribute to true.</li>
    1.91 +            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updatestart"></a> at this <a>SourceBuffer</a> object.</li>
    1.92              <li>Asynchronously run the <a def-id="stream-append-loop"></a> algorithm with <var>stream</var> and <var>maxSize</var>.</li>
    1.93            </ol>
    1.94          </dd>
    1.95 @@ -756,14 +768,15 @@
    1.96            <ol class="method-algorithm">
    1.97              <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.98              <li>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is not in the <a def-id="open"></a> state then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
    1.99 -            <li>Run the <a def-id="reset-parser-state-algorithm"></a>.</li>
   1.100 -            <li>If the <a def-id="appending"></a> attribute equals true, then run the following steps:
   1.101 +            <li>If the <a def-id="updating"></a> attribute equals true, then run the following steps:
   1.102                <ol>
   1.103 -                <li>Set the <a def-id="appending"></a> attribute to false.</li>
   1.104 -                <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="appendabort"></a> at this <a>SourceBuffer</a> object.</li>
   1.105 -                <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="appendend"></a> at this <a>SourceBuffer</a> object.</li>
   1.106 +                <li>Abort the <a def-id="stream-append-loop"></a> algorithm if it is running.</li>
   1.107 +                <li>Set the <a def-id="updating"></a> attribute to false.</li>
   1.108 +                <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateabort"></a> at this <a>SourceBuffer</a> object.</li>
   1.109 +                <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
   1.110                </ol>
   1.111              </li>
   1.112 +            <li>Run the <a def-id="reset-parser-state-algorithm"></a>.</li>
   1.113            </ol>
   1.114          </dd>
   1.115  
   1.116 @@ -775,7 +788,11 @@
   1.117              <li>If <var>start</var> is negative or greater than <a def-id="duration"></a>, then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
   1.118              <li>If <var>end</var> is less than or equal to <var>start</var>, then throw an <a def-id="invalid-access-err"></a> exception and abort these steps.</li>
   1.119              <li>If this object has been removed from the <a def-id="sourceBuffers"></a> attribute of the <a def-id="parent-media-source"></a> then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
   1.120 +            <li>If the <a def-id="updating"></a> attribute equals true, then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
   1.121              <li>If the <a def-id="readyState"></a> attribute of the <a def-id="parent-media-source"></a> is not in the <a def-id="open"></a> state then throw an <a def-id="invalid-state-err"></a> exception and abort these steps.</li>
   1.122 +            <li>Set the <a def-id="updating"></a> attribute to true.</li>
   1.123 +            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updatestart"></a> at this <a>SourceBuffer</a> object.</li>
   1.124 +            <li>Return control to the caller and run the rest of the steps asynchronously.</li>
   1.125              <li>
   1.126                <p>For each <a def-id="track-buffer"></a> in this source buffer, run the following steps:</p>
   1.127                <ol>
   1.128 @@ -793,6 +810,8 @@
   1.129              </li>
   1.130              <li>If <a def-id="buffer-full-flag"></a> equals true and this object is ready to accept more bytes, then set 
   1.131                the <a def-id="buffer-full-flag"></a> to false.</li>
   1.132 +            <li>Set the <a def-id="updating"></a> attribute to false.</li>
   1.133 +            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
   1.134         </ol>
   1.135  
   1.136          </dd>
   1.137 @@ -821,14 +840,14 @@
   1.138            </thead>
   1.139            <tbody>
   1.140              <tr>
   1.141 -              <td><a def-id="eventdfn">appendstart</a></td>
   1.142 +              <td><a def-id="eventdfn">updatestart</a></td>
   1.143                <td><code>Event</code></td>
   1.144 -              <td><a def-id="appending"></a> transitions from false to true.</td>
   1.145 +              <td><a def-id="updating"></a> transitions from false to true.</td>
   1.146              </tr>
   1.147              <tr>
   1.148 -              <td><a def-id="eventdfn">appendend</a></td>
   1.149 +              <td><a def-id="eventdfn">updateend</a></td>
   1.150                <td><code>Event</code></td>
   1.151 -              <td><a def-id="appending"></a> transitions from true to false.</td>
   1.152 +              <td><a def-id="updating"></a> transitions from true to false.</td>
   1.153              </tr>
   1.154              <tr>
   1.155                <td><a def-id="eventdfn">error</a></td>
   1.156 @@ -838,7 +857,7 @@
   1.157              <tr>
   1.158                <td><a def-id="eventdfn">abort</a></td>
   1.159                <td><code>Event</code></td>
   1.160 -              <td>The append was aborted by an <a def-id="abort"></a> call.</td>
   1.161 +              <td>The append or remove was aborted by an <a def-id="abort"></a> call.</td>
   1.162              </tr>
   1.163            </tbody>
   1.164          </table>
   1.165 @@ -922,8 +941,8 @@
   1.166  	      </ol>
   1.167              </li>
   1.168              <li><i>Need more data:</i> If the <a def-id="stream-append-loop"></a> algorithm is running and still has data to read, then abort these steps.
   1.169 -            <li>Set the <a def-id="appending"></a> attribute to false.</li>
   1.170 -            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="appendend"></a> at this <a>SourceBuffer</a> object.</li>
   1.171 +            <li>Set the <a def-id="updating"></a> attribute to false.</li>
   1.172 +            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
   1.173            </ol>
   1.174          </section>
   1.175  
   1.176 @@ -944,12 +963,12 @@
   1.177            <ol>
   1.178              <li>Run the <a def-id="reset-parser-state-algorithm"></a>.</li>
   1.179              <li>Abort the <a def-id="stream-append-loop"></a> algorithm if it is running.</li>
   1.180 -            <li>Set the <a def-id="appending"></a> attribute to false.</li>
   1.181 +            <li>Set the <a def-id="updating"></a> attribute to false.</li>
   1.182              <li>
   1.183 -              <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="appenderror"></a> at this <a>SourceBuffer</a> object.
   1.184 +              <a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateerror"></a> at this <a>SourceBuffer</a> object.
   1.185                <p class="issue">Need a way to convey error information.</p>
   1.186              </li>
   1.187 -            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="appendend"></a> at this <a>SourceBuffer</a> object.</li>
   1.188 +            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
   1.189            </ol>
   1.190          </section>
   1.191  
   1.192 @@ -984,8 +1003,8 @@
   1.193              <li>Add <var>data</var> to the end of the <a def-id="input-buffer"></a>.</li>
   1.194              <li>Run the <a def-id="segment-parser-loop"></a> algorithm.</li>
   1.195              <li>Jump to the <i>loop top</i> step above.</li>
   1.196 -            <li><i>Loop Done: </i>Set the <a def-id="appending"></a> attribute to false.</li>
   1.197 -            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="appendend"></a> at this <a>SourceBuffer</a> object.</li>
   1.198 +            <li><i>Loop Done: </i>Set the <a def-id="updating"></a> attribute to false.</li>
   1.199 +            <li><a def-id="Queue-a-task-to-fire-an-event-named"></a> <a def-id="updateend"></a> at this <a>SourceBuffer</a> object.</li>
   1.200            </ol>
   1.201          </section>
   1.202  
   1.203 @@ -1632,12 +1651,12 @@
   1.204      // Append the initialization segment.
   1.205      var firstAppendHandler = function(e) {
   1.206        var sourceBuffer = e.target;
   1.207 -      sourceBuffer.removeEventListener('appendend', firstAppendHandler);
   1.208 +      sourceBuffer.removeEventListener('updateend', firstAppendHandler);
   1.209  
   1.210        // Append some initial media data.
   1.211        appendNextMediaSegment(mediaSource);
   1.212      };
   1.213 -    sourceBuffer.addEventListener('appendend', firstAppendHandler);
   1.214 +    sourceBuffer.addEventListener('updateend', firstAppendHandler);
   1.215      sourceBuffer.appendArrayBuffer(initSegment);
   1.216    }
   1.217  
   1.218 @@ -1709,7 +1728,16 @@
   1.219          </thead>
   1.220          <tbody>
   1.221            <tr>
   1.222 -	    <td>30 January 2013</td>
   1.223 +	    <td>31 January 2013</td>
   1.224 +            <td>
   1.225 +              <ul>
   1.226 +                <li>Make remove() asynchronous.</li>
   1.227 +                <li>Added steps to various algorithms to throw an INVALID_STATE_ERR exception when async appends or remove() are pending.</li>
   1.228 +              </ul>
   1.229 +            </td>
   1.230 +          </tr>
   1.231 +          <tr>
   1.232 +	    <td><a href="http://dvcs.w3.org/hg/html-media/raw-file/aae26333e7d1/media-source/media-source.html">30 January 2013</a></td>
   1.233              <td>
   1.234                <ul>
   1.235                  <li>Remove early abort step on 0-byte appends so the same events fire as a normal append with bytes.</li>
   1.236 @@ -1773,7 +1801,7 @@
   1.237              </td>
   1.238            </tr>
   1.239            <tr>
   1.240 -	    <td><a href="http://dvcs.w3.org/hg/html-media/rev/0c638da9a67a">28 November 2012</a></td>
   1.241 +	    <td><a href="http://dvcs.w3.org/hg/html-media/raw-file/0c638da9a67a/media-source/media-source.html">28 November 2012</a></td>
   1.242              <td>
   1.243                <ul>
   1.244                  <li>Added transition to HAVE_METADATA when current playback position is removed.</li>
     2.1 --- a/media-source/media-source.html	Tue Jan 29 15:44:22 2013 -0800
     2.2 +++ b/media-source/media-source.html	Wed Jan 30 16:00:55 2013 -0800
     2.3 @@ -388,7 +388,7 @@
     2.4      border-collapse:    collapse;
     2.5      width:  100%;
     2.6  }
     2.7 -</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='http://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
     2.8 +</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
     2.9    <body><div class="head">
    2.10    <p>
    2.11      
    2.12 @@ -397,7 +397,7 @@
    2.13    </p>
    2.14    <h1 class="title" id="title">Media Source Extensions</h1>
    2.15    
    2.16 -  <h2 id="w3c-editor-s-draft-30-january-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 30 January 2013</h2>
    2.17 +  <h2 id="w3c-editor-s-draft-31-january-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 31 January 2013</h2>
    2.18    <dl>
    2.19      
    2.20        <dt>This version:</dt>
    2.21 @@ -698,6 +698,7 @@
    2.22            <ol>
    2.23              <li>If the value being set is negative or NaN then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
    2.24              <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not <code><a href="#idl-def-ReadyState">"open"</a></code> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.25 +            <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true on any <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.26              <li>Run the <a href="#duration-change-algorithm">duration change algorithm</a> with <var>new duration</var> set to the value being assigned to this attribute.
    2.27  	      <div class="note"><div class="note-title"><span>Note</span></div><p class=""><code><a href="#widl-SourceBuffer-appendArrayBuffer-void-ArrayBuffer-data">appendArrayBuffer()</a></code>, <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> and <code><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream()</a></code> can update the duration under certain circumstances.</p></div>
    2.28              </li>
    2.29 @@ -724,6 +725,7 @@
    2.30            
    2.31          <table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">error</td><td class="prmType"><code><a href="#idl-def-EndOfStreamError" class="idlType"><code>EndOfStreamError</code></a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc"></td></tr></table><div><em>Return type: </em><code><a>void</a></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
    2.32              <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute is not in the <code><a href="#idl-def-ReadyState">"open"</a></code> state then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.33 +            <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true on any <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.34              <li>Change the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute value to <code><a href="#idl-def-ReadyState">"ended"</a></code>.</li>
    2.35              <li>
    2.36                <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>
    2.37 @@ -789,6 +791,14 @@
    2.38          <table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">sourceBuffer</td><td class="prmType"><code><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr></table><div><em>Return type: </em><code><a>void</a></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
    2.39              <li>If <var>sourceBuffer</var> is null then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
    2.40              <li>If <var>sourceBuffer</var> specifies an object that is not in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> then throw a <code><a href="http://dom.spec.whatwg.org/#dom-domexception-not_found_err">NOT_FOUND_ERR</a></code> exception and abort these steps.</li>
    2.41 +            <li>If the <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then run the following steps:
    2.42 +              <ol>
    2.43 +                <li>Abort the <a href="#sourcebuffer-stream-append-loop">stream append loop</a> algorithm if it is running.</li>
    2.44 +                <li>Set the <var>sourceBuffer</var>.<code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
    2.45 +                <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-abort">abort</a></code> at <var>sourceBuffer</var>.</li>
    2.46 +                <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>
    2.47 +              </ol>
    2.48 +            </li>
    2.49              <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>
    2.50              <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>
    2.51              <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-onchange">change</a></code> at the modified lists.</li>
    2.52 @@ -1047,7 +1057,7 @@
    2.53        <div class="issue"><div class="issue-title"><span>Issue 3</span></div><p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=20327">Bug 20327</a> - Continuous splice flag</p></div>
    2.54  
    2.55        <pre class="idl"><span class="idlInterface" id="idl-def-SourceBuffer">interface <span class="idlInterfaceID">SourceBuffer</span> : <span class="idlSuperclass"><a>EventTarget</a></span> {
    2.56 -<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>boolean</a></span>        <span class="idlAttrName"><a href="#widl-SourceBuffer-appending">appending</a></span>;</span>
    2.57 +<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>boolean</a></span>        <span class="idlAttrName"><a href="#widl-SourceBuffer-updating">updating</a></span>;</span>
    2.58  <span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>TimeRanges</a></span>     <span class="idlAttrName"><a href="#widl-SourceBuffer-buffered">buffered</a></span>;</span>
    2.59  <span class="idlAttribute">             attribute <span class="idlAttrType"><a>double</a></span>         <span class="idlAttrName"><a href="#widl-SourceBuffer-timestampOffset">timestampOffset</a></span>;</span>
    2.60  <span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>AudioTrackList</a></span> <span class="idlAttrName"><a href="#widl-SourceBuffer-audioTracks">audioTracks</a></span>;</span>
    2.61 @@ -1057,9 +1067,7 @@
    2.62  <span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream</a></span> (<span class="idlParam"><span class="idlParamType"><a>Stream</a></span> <span class="idlParamName">stream</span></span>, <span class="idlParam">optional <span class="idlParamType"><a>unsigned long long</a></span> <span class="idlParamName">maxSize</span></span>);</span>
    2.63  <span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-SourceBuffer-abort-void">abort</a></span> ();</span>
    2.64  <span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-SourceBuffer-remove-void-double-start-double-end">remove</a></span> (<span class="idlParam"><span class="idlParamType"><a>double</a></span> <span class="idlParamName">start</span></span>, <span class="idlParam"><span class="idlParamType"><a>double</a></span> <span class="idlParamName">end</span></span>);</span>
    2.65 -};</span></pre><section id="attributes-1"><h3><span class="secno">4.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-SourceBuffer-appending"><code>appending</code> of type <span class="idlAttrType"><a>boolean</a></span>, readonly</dt><dd>
    2.66 -          <p>Indicates whether an <code><a href="#widl-SourceBuffer-appendArrayBuffer-void-ArrayBuffer-data">appendArrayBuffer()</a></code> or <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> operation is still being processed.</p>
    2.67 -        </dd><dt id="widl-SourceBuffer-audioTracks"><code>audioTracks</code> of type <span class="idlAttrType"><a>AudioTrackList</a></span>, readonly</dt><dd>
    2.68 +};</span></pre><section id="attributes-1"><h3><span class="secno">4.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-SourceBuffer-audioTracks"><code>audioTracks</code> of type <span class="idlAttrType"><a>AudioTrackList</a></span>, readonly</dt><dd>
    2.69            The list of <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> objects created by this object.
    2.70          </dd><dt id="widl-SourceBuffer-buffered"><code>buffered</code> of type <span class="idlAttrType"><a>TimeRanges</a></span>, readonly</dt><dd>
    2.71            <p>Indicates what <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRanges</a></code> are buffered in the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p>
    2.72 @@ -1076,11 +1084,15 @@
    2.73            <p>On setting, run the following steps:</p>
    2.74            <ol>
    2.75              <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.76 +            <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.77              <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is not in the <code><a href="#idl-def-ReadyState">"open"</a></code> state, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.78              <li>If this object is waiting for the end of a <a href="#media-segment">media segment</a> to be appended, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> and abort these steps.</li>
    2.79              <li>Update the attribute to the new value.</li>
    2.80            </ol>
    2.81            <div class="issue"><div class="issue-title"><span>Issue 4</span></div><p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=19676">Bug 19676</a> - timestampOffset accuracy</p></div>
    2.82 +        </dd><dt id="widl-SourceBuffer-updating"><code>updating</code> of type <span class="idlAttrType"><a>boolean</a></span>, readonly</dt><dd>
    2.83 +          <p>Indicates whether an <code><a href="#widl-SourceBuffer-appendArrayBuffer-void-ArrayBuffer-data">appendArrayBuffer()</a></code>, <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code>, or <code><a href="#widl-SourceBuffer-remove-void-double-start-double-end">remove()</a></code> operation is still being
    2.84 +            processed.</p>
    2.85          </dd><dt id="widl-SourceBuffer-videoTracks"><code>videoTracks</code> of type <span class="idlAttrType"><a>VideoTrackList</a></span>, readonly</dt><dd>
    2.86            The list of <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> objects created by this object.
    2.87          </dd></dl></section><section id="methods-1"><h3><span class="secno">4.2 </span>Methods</h3><dl class="methods"><dt id="widl-SourceBuffer-abort-void"><code>abort</code></dt><dd>
    2.88 @@ -1090,14 +1102,15 @@
    2.89          <div><em>No parameters.</em></div><div><em>Return type: </em><code><a>void</a></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
    2.90              <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.91              <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is not in the <code><a href="#idl-def-ReadyState">"open"</a></code> state then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
    2.92 -            <li>Run the <a href="#sourcebuffer-reset-parser-state">reset parser state algorithm</a>.</li>
    2.93 -            <li>If the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute equals true, then run the following steps:
    2.94 +            <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then run the following steps:
    2.95                <ol>
    2.96 -                <li>Set the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute to false.</li>
    2.97 +                <li>Abort the <a href="#sourcebuffer-stream-append-loop">stream append loop</a> algorithm if it is running.</li>
    2.98 +                <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
    2.99                  <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-abort">abort</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.100 -                <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-appendend">appendend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.101 +                <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 this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.102                </ol>
   2.103              </li>
   2.104 +            <li>Run the <a href="#sourcebuffer-reset-parser-state">reset parser state algorithm</a>.</li>
   2.105            </ol></dd><dt id="widl-SourceBuffer-appendArrayBuffer-void-ArrayBuffer-data"><code>appendArrayBuffer</code></dt><dd>
   2.106            <p>Appends the segment data in an ArrayBuffer to the source buffer.</p>
   2.107  
   2.108 @@ -1105,7 +1118,7 @@
   2.109          <table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">data</td><td class="prmType"><code><a>ArrayBuffer</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr></table><div><em>Return type: </em><code><a>void</a></code></div><p>When this method is invoked, the user agent must run the following steps:</p><ol class="method-algorithm">
   2.110              <li>If <var>data</var> is null then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
   2.111              <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.112 -            <li>If the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.113 +            <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.114              <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is in the <code><a href="#idl-def-ReadyState">"closed"</a></code> state then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.115              <li>
   2.116                <p>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is in the <code><a href="#idl-def-ReadyState">"ended"</a></code> state then run the following steps:</p>
   2.117 @@ -1121,8 +1134,8 @@
   2.118                <div class="note"><div class="note-title"><span>Note</span></div><p class="">The web application must use <code><a href="#widl-SourceBuffer-remove-void-double-start-double-end">remove()</a></code> to free up space in the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p></div>
   2.119              </li>
   2.120              <li>Add <var>data</var> to the end of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
   2.121 -            <li>Set the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute to true.</li>
   2.122 -            <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-appendstart">appendstart</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.123 +            <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to true.</li>
   2.124 +            <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-updatestart">updatestart</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.125              <li>Asynchronously run the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> algorithm.</li>
   2.126            </ol></dd><dt id="widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize"><code>appendStream</code></dt><dd>
   2.127            <p>Appends segment data to the source buffer from a <a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a>.</p>
   2.128 @@ -1134,7 +1147,7 @@
   2.129                an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.130              <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is in the <code><a href="#idl-def-ReadyState">"closed"</a></code> state then throw
   2.131                an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.132 -            <li>If the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these
   2.133 +            <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these
   2.134                steps.</li>
   2.135              <li>
   2.136                <p>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is in the <code><a href="#idl-def-ReadyState">"ended"</a></code> state then run
   2.137 @@ -1148,8 +1161,8 @@
   2.138                <p>If the <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> equals true, then throw a <code><a href="http://dom.spec.whatwg.org/#dom-domexception-quota_exceeded_err">QUOTA_EXCEEDED_ERR</a></code> exception and abort these step.</p>
   2.139                <div class="note"><div class="note-title"><span>Note</span></div><p class="">The web application must use <code><a href="#widl-SourceBuffer-remove-void-double-start-double-end">remove()</a></code> to free up space in the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p></div>
   2.140              </li>
   2.141 -            <li>Set the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute to true.</li>
   2.142 -            <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-appendstart">appendstart</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.143 +            <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to true.</li>
   2.144 +            <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-updatestart">updatestart</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.145              <li>Asynchronously run the <a href="#sourcebuffer-stream-append-loop">stream append loop</a> algorithm with <var>stream</var> and <var>maxSize</var>.</li>
   2.146            </ol></dd><dt id="widl-SourceBuffer-remove-void-double-start-double-end"><code>remove</code></dt><dd>
   2.147            <p>Removes media for a specific time range.</p>
   2.148 @@ -1160,7 +1173,11 @@
   2.149              <li>If <var>start</var> is negative or greater than <code><a href="#widl-MediaSource-duration">duration</a></code>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
   2.150              <li>If <var>end</var> is less than or equal to <var>start</var>, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</li>
   2.151              <li>If this object has been removed from the <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> attribute of the <a href="#parent-media-source">parent media source</a> then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.152 +            <li>If the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute equals true, then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.153              <li>If the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute of the <a href="#parent-media-source">parent media source</a> is not in the <code><a href="#idl-def-ReadyState">"open"</a></code> state then throw an <code><a href="http://dom.spec.whatwg.org/#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code> exception and abort these steps.</li>
   2.154 +            <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to true.</li>
   2.155 +            <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-updatestart">updatestart</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.156 +            <li>Return control to the caller and run the rest of the steps asynchronously.</li>
   2.157              <li>
   2.158                <p>For each <a href="#track-buffer">track buffer</a> in this source buffer, run the following steps:</p>
   2.159                <ol>
   2.160 @@ -1178,6 +1195,8 @@
   2.161              </li>
   2.162              <li>If <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> equals true and this object is ready to accept more bytes, then set 
   2.163                the <var><a href="#sourcebuffer-buffer-full-flag">buffer full flag</a></var> to false.</li>
   2.164 +            <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
   2.165 +            <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 this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.166         </ol></dd></dl></section>
   2.167  
   2.168        <section id="track-buffers">
   2.169 @@ -1203,14 +1222,14 @@
   2.170            </thead>
   2.171            <tbody>
   2.172              <tr>
   2.173 -              <td><dfn id="dom-evt-appendstart"><code>appendstart</code></dfn></td>
   2.174 +              <td><dfn id="dom-evt-updatestart"><code>updatestart</code></dfn></td>
   2.175                <td><code>Event</code></td>
   2.176 -              <td><code><a href="#widl-SourceBuffer-appending">appending</a></code> transitions from false to true.</td>
   2.177 +              <td><code><a href="#widl-SourceBuffer-updating">updating</a></code> transitions from false to true.</td>
   2.178              </tr>
   2.179              <tr>
   2.180 -              <td><dfn id="dom-evt-appendend"><code>appendend</code></dfn></td>
   2.181 +              <td><dfn id="dom-evt-updateend"><code>updateend</code></dfn></td>
   2.182                <td><code>Event</code></td>
   2.183 -              <td><code><a href="#widl-SourceBuffer-appending">appending</a></code> transitions from true to false.</td>
   2.184 +              <td><code><a href="#widl-SourceBuffer-updating">updating</a></code> transitions from true to false.</td>
   2.185              </tr>
   2.186              <tr>
   2.187                <td><dfn id="dom-evt-error"><code>error</code></dfn></td>
   2.188 @@ -1220,7 +1239,7 @@
   2.189              <tr>
   2.190                <td><dfn id="dom-evt-abort"><code>abort</code></dfn></td>
   2.191                <td><code>Event</code></td>
   2.192 -              <td>The append was aborted by an <code><a href="#widl-SourceBuffer-abort-void">abort()</a></code> call.</td>
   2.193 +              <td>The append or remove was aborted by an <code><a href="#widl-SourceBuffer-abort-void">abort()</a></code> call.</td>
   2.194              </tr>
   2.195            </tbody>
   2.196          </table>
   2.197 @@ -1304,8 +1323,8 @@
   2.198  	      </ol>
   2.199              </li>
   2.200              <li><i>Need more data:</i> If the <a href="#sourcebuffer-stream-append-loop">stream append loop</a> algorithm is running and still has data to read, then abort these steps.
   2.201 -            </li><li>Set the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute to false.</li>
   2.202 -            <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-appendend">appendend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.203 +            </li><li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
   2.204 +            <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 this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.205            </ol>
   2.206          </section>
   2.207  
   2.208 @@ -1326,12 +1345,12 @@
   2.209            <ol>
   2.210              <li>Run the <a href="#sourcebuffer-reset-parser-state">reset parser state algorithm</a>.</li>
   2.211              <li>Abort the <a href="#sourcebuffer-stream-append-loop">stream append loop</a> algorithm if it is running.</li>
   2.212 -            <li>Set the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute to false.</li>
   2.213 +            <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
   2.214              <li>
   2.215                <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-error">error</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.
   2.216                <div class="issue"><div class="issue-title"><span>Issue 5</span></div><p class="">Need a way to convey error information.</p></div>
   2.217              </li>
   2.218 -            <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-appendend">appendend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.219 +            <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 this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.220            </ol>
   2.221          </section>
   2.222  
   2.223 @@ -1366,8 +1385,8 @@
   2.224              <li>Add <var>data</var> to the end of the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
   2.225              <li>Run the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> algorithm.</li>
   2.226              <li>Jump to the <i>loop top</i> step above.</li>
   2.227 -            <li><i>Loop Done: </i>Set the <code><a href="#widl-SourceBuffer-appending">appending</a></code> attribute to false.</li>
   2.228 -            <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-appendend">appendend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.229 +            <li><i>Loop Done: </i>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
   2.230 +            <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 this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
   2.231            </ol>
   2.232          </section>
   2.233  
   2.234 @@ -1994,12 +2013,12 @@
   2.235      // Append the initialization segment.
   2.236      var firstAppendHandler = function(e) {
   2.237        var sourceBuffer = e.target;
   2.238 -      sourceBuffer.removeEventListener('appendend', firstAppendHandler);
   2.239 +      sourceBuffer.removeEventListener('updateend', firstAppendHandler);
   2.240  
   2.241        // Append some initial media data.
   2.242        appendNextMediaSegment(mediaSource);
   2.243      };
   2.244 -    sourceBuffer.addEventListener('appendend', firstAppendHandler);
   2.245 +    sourceBuffer.addEventListener('updateend', firstAppendHandler);
   2.246      sourceBuffer.appendArrayBuffer(initSegment);
   2.247    }
   2.248  
   2.249 @@ -2071,7 +2090,16 @@
   2.250          </thead>
   2.251          <tbody>
   2.252            <tr>
   2.253 -	    <td>30 January 2013</td>
   2.254 +	    <td>31 January 2013</td>
   2.255 +            <td>
   2.256 +              <ul>
   2.257 +                <li>Make remove() asynchronous.</li>
   2.258 +                <li>Added steps to various algorithms to throw an INVALID_STATE_ERR exception when async appends or remove() are pending.</li>
   2.259 +              </ul>
   2.260 +            </td>
   2.261 +          </tr>
   2.262 +          <tr>
   2.263 +	    <td><a href="http://dvcs.w3.org/hg/html-media/raw-file/aae26333e7d1/media-source/media-source.html">30 January 2013</a></td>
   2.264              <td>
   2.265                <ul>
   2.266                  <li>Remove early abort step on 0-byte appends so the same events fire as a normal append with bytes.</li>
   2.267 @@ -2135,7 +2163,7 @@
   2.268              </td>
   2.269            </tr>
   2.270            <tr>
   2.271 -	    <td><a href="http://dvcs.w3.org/hg/html-media/rev/0c638da9a67a">28 November 2012</a></td>
   2.272 +	    <td><a href="http://dvcs.w3.org/hg/html-media/raw-file/0c638da9a67a/media-source/media-source.html">28 November 2012</a></td>
   2.273              <td>
   2.274                <ul>
   2.275                  <li>Added transition to HAVE_METADATA when current playback position is removed.</li>
     3.1 --- a/media-source/media-source.js	Tue Jan 29 15:44:22 2013 -0800
     3.2 +++ b/media-source/media-source.js	Wed Jan 30 16:00:55 2013 -0800
     3.3 @@ -78,7 +78,7 @@
     3.4      'appendStream': { func: idlref_helper, fragment: 'widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize', link_text: 'appendStream()',  },
     3.5      'abort': { func: idlref_helper, fragment: 'widl-SourceBuffer-abort-void', link_text: 'abort()',  },
     3.6      'remove': { func: idlref_helper, fragment: 'widl-SourceBuffer-remove-void-double-start-double-end', link_text: 'remove()',  },
     3.7 -    'appending': { func: idlref_helper, fragment: 'widl-SourceBuffer-appending', link_text: 'appending',  },
     3.8 +    'updating': { func: idlref_helper, fragment: 'widl-SourceBuffer-updating', link_text: 'updating',  },
     3.9      'sourcebuffer-audioTracks': { func: idlref_helper, fragment: 'widl-SourceBuffer-audioTracks', link_text: 'audioTracks',  },
    3.10      'sourcebuffer-videoTracks': { func: idlref_helper, fragment: 'widl-SourceBuffer-videoTracks', link_text: 'videoTracks',  },
    3.11      'sourcebuffer-textTracks': { func: idlref_helper, fragment: 'widl-SourceBuffer-textTracks', link_text: 'textTracks',  },
    3.12 @@ -92,10 +92,10 @@
    3.13      'network': { func: idlref_helper, fragment: 'idl-def-EndOfStreamError', link_text: '"network"',  },
    3.14      'decode': { func: idlref_helper, fragment: 'idl-def-EndOfStreamError', link_text: '"decode"',  },
    3.15  
    3.16 -    'appendstart': { func: eventref_helper, fragment: 'appendstart', link_text: 'appendstart',  },
    3.17 -    'appendend': { func: eventref_helper, fragment: 'appendend', link_text: 'appendend',  },
    3.18 -    'appenderror': { func: eventref_helper, fragment: 'error', link_text: 'error',  },
    3.19 -    'appendabort': { func: eventref_helper, fragment: 'abort', link_text: 'abort',  },
    3.20 +    'updatestart': { func: eventref_helper, fragment: 'updatestart', link_text: 'updatestart',  },
    3.21 +    'updateend': { func: eventref_helper, fragment: 'updateend', link_text: 'updateend',  },
    3.22 +    'updateerror': { func: eventref_helper, fragment: 'error', link_text: 'error',  },
    3.23 +    'updateabort': { func: eventref_helper, fragment: 'abort', link_text: 'abort',  },
    3.24  
    3.25      'sourceopen': { func: eventref_helper, fragment: 'sourceopen', link_text: 'sourceopen',  },
    3.26      'sourceended': { func: eventref_helper, fragment: 'sourceended', link_text: 'sourceended',  },