[html5] r5952 - [giow] (0) Expose readyState on PeerConnection. This isn't entirely fully baked [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Mar 15 22:54:49 PDT 2011


Author: ianh
Date: 2011-03-15 22:54:48 -0700 (Tue, 15 Mar 2011)
New Revision: 5952

Modified:
   complete.html
   index
   source
Log:
[giow] (0) Expose readyState on PeerConnection. This isn't entirely fully baked yet, it'll probably need tweaking (unless I've been very lucky). Let me know what mistakes I made...

Modified: complete.html
===================================================================
--- complete.html	2011-03-14 22:21:01 UTC (rev 5951)
+++ complete.html	2011-03-16 05:54:48 UTC (rev 5952)
@@ -239,7 +239,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1>Web Applications 1.0</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 14 March 2011</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 16 March 2011</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -71706,7 +71706,11 @@
 interface <dfn id=peerconnection>PeerConnection</dfn> {
   void <a href=#dom-peerconnection-signalingmessage title=dom-PeerConnection-signalingMessage>signalingMessage</a>(in DOMString message);
 
-  // <span class=XXX>readyState, etc</span>
+  const unsigned short <a href=#dom-peerconnection-new title=dom-PeerConnection-NEW>NEW</a> = 0;
+  const unsigned short <a href=#dom-peerconnection-negotiating title=dom-PeerConnection-NEGOTIATING>NEGOTIATING</a> = 1;
+  const unsigned short <a href=#dom-peerconnection-active title=dom-PeerConnection-ACTIVE>ACTIVE</a> = 2;
+  const unsigned short <a href=#dom-peerconnection-closed title=dom-PeerConnection-CLOSED>CLOSED</a> = 3;
+  readonly attribute unsigned short <a href=#dom-peerconnection-readystate title=dom-PeerConnection-readyState>readyState</a>;
 
   void <a href=#dom-peerconnection-send title=dom-PeerConnection-send>send</a>(in DOMString text);
   void <a href=#dom-peerconnection-addstream title=dom-PeerConnection-addStream>addStream</a>(in <a href=#stream>Stream</a> stream);
@@ -71714,8 +71718,13 @@
   readonly attribute <a href=#stream>Stream</a>[] <a href=#dom-peerconnection-localstreams title=dom-PeerConnection-localStreams>localStreams</a>;
   readonly attribute <a href=#stream>Stream</a>[] <a href=#dom-peerconnection-remotestreams title=dom-PeerConnection-remoteStreams>remoteStreams</a>;
 
+  void <a href=#dom-peerconnection-close title=dom-PeerConnection-close>close</a>();
+
   // <span class=XXX>connection quality information</span>
-
+           attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onconnecting title=handler-PeerConnection-onconnecting>onconnecting</a>;
+           attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onopen title=handler-PeerConnection-onopen>onopen</a>;
+           attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onerror title=handler-PeerConnection-onerror>onerror</a>;
+           attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onclose title=handler-PeerConnection-onclose>onclose</a>;
            attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onmessage title=handler-PeerConnection-onmessage>onmessage</a>;
            attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onaddstream title=handler-PeerConnection-onaddstream>onaddstream</a>;
            attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onremovestream title=handler-PeerConnection-onremovestream>onremovestream</a>;
@@ -71784,6 +71793,21 @@
    </dd>
 
 
+   <dt><var title="">connection</var> . <code title=dom-PeerConnection-readyState><a href=#dom-peerconnection-readystate>readyState</a></code></dt>
+   <dd>
+    <p>Returns the current readiness state for the connection,
+    represented by a number from the following list:</p>
+    <dl><dt> <code><a href=#peerconnection>PeerConnection</a></code> . <code title=dom-PeerConnection-NEW><a href=#dom-peerconnection-new>NEW</a></code> (0)</dt>
+     <dd>The object was just created, and no networking has yet occurred.</dd>
+     <dt> <code><a href=#peerconnection>PeerConnection</a></code> . <code title=dom-PeerConnection-NEGOTIATING><a href=#dom-peerconnection-negotiating>NEGOTIATING</a></code> (1)</dt>
+     <dd>The user agent is attempting to establish a connection.</dd>
+     <dt> <code><a href=#peerconnection>PeerConnection</a></code> . <code title=dom-PeerConnection-ACTIVE><a href=#dom-peerconnection-active>ACTIVE</a></code> (2)</dt>
+     <dd>The connection is as good as its going to get.</dd>
+     <dt> <code><a href=#peerconnection>PeerConnection</a></code> . <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3)</dt>
+     <dd>The connection is closed.</dd>
+    </dl></dd>
+
+
    <dt><var title="">connection</var> . <code title=dom-PeerConnection-signalingMessage><a href=#dom-peerconnection-signalingmessage>signalingMessage</a></code>(<var title="">message</var>)</dt>
 
    <dd>
@@ -71810,7 +71834,7 @@
     every message will be received.</p>
 
     <p>When a message sent in this manner from the other peer is
-    received, a <code title=event-PeerConnection-message>message</code>
+    received, a <code title=event-stream-message>message</code>
     event is dispatched at the <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
 
    </dd>
@@ -71823,7 +71847,7 @@
     peer.</p>
 
     <p>When the other peer starts sending a stream in this manner, an
-    <code title=event-PeerConnection-addstream>addstream</code>
+    <code title=event-stream-addstream>addstream</code>
     event is dispatched at the <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
 
    </dd>
@@ -71835,7 +71859,7 @@
     <p>Steps sending the given stream to the remote peer.</p>
 
     <p>When the other peer stops sending a stream in this manner, a
-    <code title=event-PeerConnection-removestream>removestream</code>
+    <code title=event-stream-removestream>removestream</code>
     event is dispatched at the <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
 
    </dd>
@@ -71857,7 +71881,7 @@
     <p>Returns a live array containing the streams that the user agent
     is currently receiving from the remote peer.</p>
 
-    <p>This array is updated when <code title=event-PeerConnection-addstream>addstream</code> and <code title=event-PeerConnection-removestream>removestream</code>
+    <p>This array is updated when <code title=event-stream-addstream>addstream</code> and <code title=event-stream-removestream>removestream</code>
     events are fired.</p>
 
    </dd>
@@ -71867,11 +71891,33 @@
   <p>A <code><a href=#peerconnection>PeerConnection</a></code> object has an associated
   <dfn id=peerconnection-signaling-callback><code>PeerConnection</code> signaling callback</dfn>, a
   <dfn id=peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</dfn>, a
-  <dfn id=peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media stream</dfn> and an
+  <dfn id=peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media stream</dfn>, a
+  <dfn id=peerconnection-readiness-state><code>PeerConnection</code> readiness state</dfn> and an
   <dfn id=ice-started-flag>ICE started flag</dfn>. These are initialized when the object
   is created.</p>
 
-  <p>When the <dfn id=dom-peerconnection title=dom-PeerConnection><code>PeerConnection()</code></dfn>
+  <p>The <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> can
+  have the following values:</p>
+
+  <dl><dt><dfn id=dom-peerconnection-new title=dom-PeerConnection-NEW><code>NEW</code></dfn> (numeric value 0)</dt>
+
+   <dd>The object was just created and its ICE Agent has not yet been started.</dd>
+
+   <dt><dfn id=dom-peerconnection-negotiating title=dom-PeerConnection-NEGOTIATING><code>NEGOTIATING</code></dfn> (numeric value 1)</dt>
+
+   <dd>The ICE Agent is actively preforming ICE processing.</dd>
+
+   <dt><dfn id=dom-peerconnection-active title=dom-PeerConnection-ACTIVE><code>ACTIVE</code></dfn> (numeric value 2)</dt>
+
+   <dd>The ICE Agent has concluded ICE processing and media is streaming.</dd>
+
+   <dt><dfn id=dom-peerconnection-closed title=dom-PeerConnection-CLOSED><code>CLOSED</code></dfn> (numeric value 3)</dt>
+
+   <dd>Either the <code title=dom-PeerConnection-close><a href=#dom-peerconnection-close>close()</a></code> method has been
+   invoked, or the other peer removed all the media streams, or the
+   other peer has apparently abruptly stopped sending any media.</dd>
+
+  </dl><p>When the <dfn id=dom-peerconnection title=dom-PeerConnection><code>PeerConnection()</code></dfn>
   constructor is invoked, the user agent must run the following steps.
   This algorithm has a <a href=#synchronous-section>synchronous section</a> (which is
   triggered as part of the <a href=#event-loop>event loop</a> algorithm). Steps
@@ -71973,6 +72019,9 @@
    <a href=#peerconnection-signaling-callback><code>PeerConnection</code> signaling callback</a> be
    <var title="">signalingCallback</var>.</li>
 
+   <li><p>Set <var title="">connection</var>'s
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> to <code title=dom-PeerConnection-NEW><a href=#dom-peerconnection-new>NEW</a></code> (0).</li>
+
    <li><p>Set <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
    flag</a> to false.</li>
 
@@ -71999,11 +72048,21 @@
    <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> and send the
    initial offer. The initial offer must include a media description
    for the <a href=#peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media
-   stream</a> and for all the streams in <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code>. <a href=#refsICE>[ICE]</a></li>
+   stream</a>, marked as "sendrecv", and for all the streams in
+   <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code>
+   (marked as "sendonly"). <a href=#refsICE>[ICE]</a> <a href=#refsSDPOFFERANSWER>[SDPOFFERANSWER]</a></li>
 
    <li><p>⌛ Let <var title="">connection</var>'s <a href=#ice-started-flag>ICE
    started flag</a> be true.</li>
 
+   <li><p>⌛ If <var title="">connection</var>'s
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is still
+   <code title=dom-PeerConnection-NEW><a href=#dom-peerconnection-new>NEW</a></code> (0), then
+   <a href=#queue-a-task>queue a task</a> that sets it to <code title=dom-PeerConnection-NEGOTIATING><a href=#dom-peerconnection-negotiating>NEGOTIATING</a></code> (1) and
+   then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a>
+   named <code title=event-stream-connecting>connecting</code> at the
+   <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
+
   </ol><p>When a <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> is
   required to send SDP offers or answers, the user agent must follow
   these steps:</p>
@@ -72020,7 +72079,12 @@
    <a href=#peerconnection-signaling-callback><code>PeerConnection</code> signaling callback</a> with
    <var title="">message</var> as its argument.</li>
 
-  </ol><p>All SDP media descriptions for streams represented by
+  </ol><p>All streams represented by <code><a href=#stream>Stream</a></code> objects must be
+  marked as "sendonly" by the peer that initially adds the stream to
+  the session. The <code><a href=#peerconnection>PeerConnection</a></code> API does not support
+  bidirectional ("sendrecv") audio or video media streams. <a href=#refsSDPOFFERANSWER>[SDPOFFERANSWER]</a></p>
+
+  <p>All SDP media descriptions for streams represented by
   <code><a href=#stream>Stream</a></code> objects must include a label attribute ("<code title="">a=label:</code>") whose value is the value of the
   <code><a href=#stream>Stream</a></code> object's <code title=dom-stream-label><a href=#dom-stream-label>label</a></code> attribute. <a href=#refsSDP>[SDP]</a> <a href=#refsSDPLABEL>[SDPLABEL]</a></p>
 
@@ -72077,6 +72141,14 @@
   <ol><li><p>Let <var title="">message</var> be the method's
    argument.</li>
 
+   <li><p>Let <var title="">connection</var> be the
+   <code><a href=#peerconnection>PeerConnection</a></code> object on which the method was
+   invoked.</li>
+
+   <li><p>If <var title="">connection</var>'s
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
    <li>
 
     <p>If the first four characters of <var title="">message</var> are
@@ -72094,35 +72166,85 @@
    <li><p>Let <var title="">sdp</var> be the string consisting of all
    but the first four characters of <var title="">message</var>.</li>
 
+   <li><p>If <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
+   flag</a> is true, then pass <var title="">sdp</var> to the
+   <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> as a subsequent
+   offer or answer, to be interpreted as appropriate given the current
+   state of the ICE Agent, and abort these steps. <a href=#refsICE>[ICE]</a></li>
+
    <li>
 
-    <p>If <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
-    flag</a> is still false, start the
+    <p>The <a href=#ice-started-flag>ICE started flag</a> is false. Start the
     <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> and pass it
     <var title="">sdp</var> as the initial offer from the other peer;
     the ICE Agent will then (asynchronously) construct the initial
-    answer and transmit it as described above. The initial answer must
-    include a media description for the
-    <a href=#peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media stream</a> and
-    for all the streams in <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code>. <a href=#refsICE>[ICE]</a></p>
+    answer and transmit it as described above.</p>
 
-    <p>If <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
-    flag</a> is true, then pass <var title="">sdp</var> to the
-    <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> as a subsequent
-    offer or answer, to be interpreted as appropriate given the
-    current state of the ICE Agent. <a href=#refsICE>[ICE]</a></p>
+    <p>If there is a <a href=#remotely-initiated-data-udp-media-stream>remotely-initiated data UDP media
+    stream</a> in the initial offer, and it has an encryption key
+    advertised in its media description that is 16 bytes long, then
+    that is the <a href=#peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media
+    stream</a>.</p>
 
+    <p>After the initial answer has been sent, the ICE Agent must add
+    all the streams in <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code> to the
+    session, as described above. <a href=#refsICE>[ICE]</a></p>
+
    </li>
 
    <li><p>Let <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
    flag</a> be true.</li>
 
-  </ol><p>When the <dfn id=dom-peerconnection-send title=dom-PeerConnection-send><code title="">send()</code></dfn> method is invoked, the
+   <li><p><a href=#queue-a-task>Queue a task</a> that sets <var title="">connection</var>'s <a href=#peerconnection-readiness-state><code>PeerConnection</code>
+   readiness state</a> to <code title=dom-PeerConnection-NEGOTIATING><a href=#dom-peerconnection-negotiating>NEGOTIATING</a></code> (1) and
+   then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a>
+   named <code title=event-stream-connecting>connecting</code> at the
+   <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
+
+  </ol><p>When a <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a>
+  completes ICE processing with any active media streams, the user
+  agent must <a href=#queue-a-task>queue a task</a> that sets the
+  <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> to <code title=dom-PeerConnection-ACTIVE><a href=#dom-peerconnection-active>ACTIVE</a></code> (2) and then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a> named <code title=event-stream-open>open</code> at the <code><a href=#peerconnection>PeerConnection</a></code>
+  object.</p>
+
+  <p>When a <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a>
+  completes ICE processing with no active media streams, the user
+  agent must <a href=#queue-a-task>queue a task</a> that sets the
+  <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> to <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3) and then, if the
+  <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> has ever
+  reached the <code title=dom-PeerConnection-ACTIVE><a href=#dom-peerconnection-active>ACTIVE</a></code>
+  (2) state, <a href=#fire-a-simple-event title="fire a simple event">fires a simple
+  event</a> named <code title=event-stream-close>close</code> at the
+  <code><a href=#peerconnection>PeerConnection</a></code> object, or otherwise <a href=#fire-a-simple-event title="fire a
+  simple event">fires a simple event</a> named <code title=event-stream-error>error</code> at the <code><a href=#peerconnection>PeerConnection</a></code>
+  object.</p>
+
+  <p>When a <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a>
+  restarts ICE processing for any reason (e.g. because a peer is
+  adding or removing a stream), the user agent must <a href=#queue-a-task>queue a
+  task</a> that sets the <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> to <code title=dom-PeerConnection-NEGOTIATING><a href=#dom-peerconnection-negotiating>NEGOTIATING</a></code> (1) and
+  then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a>
+  named <code title=event-stream-connecting>connecting</code> at the
+  <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
+                                   
+  <p>The <dfn id=dom-peerconnection-readystate title=dom-PeerConnection-readyState><code title="">readyState</code></dfn> attribute must return the numeric
+  value of the <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a>.</p>
+
+  <p>When the <dfn id=dom-peerconnection-send title=dom-PeerConnection-send><code title="">send()</code></dfn> method is invoked, the
   user agent must run the following steps:</p>
 
   <ol><li><p>Let <var title="">message</var> be the method's first
    argument.</li>
 
+   <li><p>If the <code><a href=#peerconnection>PeerConnection</a></code> object's
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
    <li><p>Let <var title="">data</var> be <var title="">message</var>
    encoded as UTF-8. <a href=#refsRFC3629>[RFC3629]</a></li>
 
@@ -72147,6 +72269,10 @@
   <ol><li><p>Let <var title="">stream</var> be the method's
    argument.</li>
 
+   <li><p>If the <code><a href=#peerconnection>PeerConnection</a></code> object's
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
    <li><p>If <var title="">stream</var> is null, throw a
    <code>TypeError</code> exception and abort these steps.</li>
 
@@ -72171,6 +72297,10 @@
   <ol><li><p>Let <var title="">stream</var> be the method's
    argument.</li>
 
+   <li><p>If the <code><a href=#peerconnection>PeerConnection</a></code> object's
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
    <li><p>If <var title="">stream</var> is null, throw a
    <code>TypeError</code> exception and abort these steps.</li>
 
@@ -72194,7 +72324,31 @@
   attributes must return the read-only <code><a href=#stream>Stream</a></code> arrays that
   the attributes were respectively set to when the
   <code><a href=#peerconnection>PeerConnection</a></code>'s constructor ran.</p>
+  
+  <p>When the <dfn id=dom-peerconnection-close title=dom-PeerConnection-close><code title="">close()</code></dfn> method is invoked, the user agent must
+  run the following steps:</p>
 
+  <ol><li><p>If the <code><a href=#peerconnection>PeerConnection</a></code> object's
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
+   <li><p>Destroy the <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE
+   Agent</a>, abruptly ending any active ICE processing and any
+   active streaming, and releasing any relevant resources (e.g. TURN
+   permissions).</li>
+
+   <li><p>Set the object's <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness
+   state</a> to <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3).</li>
+
+   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+   event</a> named <code title=event-stream-close>close</code> at the
+   <code><a href=#peerconnection>PeerConnection</a></code> object.</li>
+
+  </ol><p class=note>The <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code> and
+  <code title=dom-PeerConnection-remoteStreams><a href=#dom-peerconnection-remotestreams>remoteStreams</a></code>
+  objects remain in the state they were in when the object was
+  closed.</p>
+
   <hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
   corresponding <a href=#event-handler-event-type title="event handler event type">event handler
   event types</a>) that must be supported, as IDL attributes, by
@@ -72202,7 +72356,11 @@
   interface:</p>
 
   <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
-   <tbody><tr><td><dfn id=handler-peerconnection-onmessage title=handler-PeerConnection-onmessage><code>onmessage</code></dfn> <td> <code title=event-stream-message>message</code>
+   <tbody><tr><td><dfn id=handler-peerconnection-onconnecting title=handler-PeerConnection-onconnecting><code>onconnecting</code></dfn> <td> <code title=event-stream-connecting>connecting</code>
+    <tr><td><dfn id=handler-peerconnection-onopen title=handler-PeerConnection-onopen><code>onopen</code></dfn> <td> <code title=event-stream-open>open</code>
+    <tr><td><dfn id=handler-peerconnection-onerror title=handler-PeerConnection-onerror><code>onerror</code></dfn> <td> <code title=event-stream-error>error</code>
+    <tr><td><dfn id=handler-peerconnection-onclose title=handler-PeerConnection-onclose><code>onclose</code></dfn> <td> <code title=event-stream-close>close</code>
+    <tr><td><dfn id=handler-peerconnection-onmessage title=handler-PeerConnection-onmessage><code>onmessage</code></dfn> <td> <code title=event-stream-message>message</code>
     <tr><td><dfn id=handler-peerconnection-onaddstream title=handler-PeerConnection-onaddstream><code>onaddstream</code></dfn> <td> <code title=event-stream-addstream>addstream</code>
     <tr><td><dfn id=handler-peerconnection-onremovestream title=handler-PeerConnection-onremovestream><code>onremovestream</code></dfn> <td> <code title=event-stream-removestream>removestream</code>
   </table><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this section is the
@@ -72335,21 +72493,10 @@
    <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> has selected a
    destination for the <a href=#data-udp-media-stream>data UDP media stream</a>.</li>
 
-  </ol><p>A <dfn id=remote-data-udp-media-stream>remote data UDP media stream</dfn> is the first UDP media
-  stream whose sender is the remote peer, whose media is "<code title="">application</code>", whose transport protocol is "<code title="">udp</code>", whose media format description is
-  "<code><a href=#application/html-peer-conection-data>application/html-peer-conection-data</a></code>", whose label
-  attribute ("<code title="">a=label:</code>") has the value "<code title="">data</code>", and for which a
-  <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> has selected a
-  destination, if that media stream has an encryption key advertised
-  in its media description, and if that encryption key is 16 bytes
-  long. A <a href=#remote-data-udp-media-stream>remote data UDP media stream</a> is associated with
-  the <code><a href=#peerconnection>PeerConnection</a></code> object for which the
-  <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> in question is
-  operating.</p>
+  </ol><p>When a packet that is part of a <a href=#data-udp-media-stream>data UDP media
+  stream</a> is received, the user agent must run the following
+  steps:</p>
 
-  <p>When a packet from a <a href=#remote-data-udp-media-stream>remote data UDP media stream</a> is
-  received, the user agent must run the following steps:</p>
-
   <ol><li><p>Let <var title="">encrypted message</var> be the UDP
    packet's data.</li>
 
@@ -72357,8 +72504,8 @@
    bytes, then abort these steps.</li>
 
    <li><p>Let <var title="">ice-key</var> be the 16 bytes given as the
-   encryption key for the <a href=#remote-data-udp-media-stream>remote data UDP media stream</a> in
-   the media description for this media stream. <a href=#refsSDP>[SDP]</a></li>
+   encryption key for the <a href=#data-udp-media-stream>data UDP media stream</a> in the
+   media description for this media stream. <a href=#refsSDP>[SDP]</a></li>
 
    <li><p>Let <var title="">masked message with nonce</var> be the
    result of decrypting <var title="">message</var> using AES-128-CTR
@@ -72390,15 +72537,21 @@
    handling</a>.</li>
 
    <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
-   interface, with the name <code title=event-message><a href=#event-message>message</a></code>,
-   which does not bubble, is not cancelable, has no default action,
-   and has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute
-   whose value is <var title="">message</var>, and <a href=#queue-a-task>queue a
-   task</a> to dispatch the event at the
-   <code><a href=#peerconnection>PeerConnection</a></code> object that the <a href=#remote-data-udp-media-stream>remote data UDP
-   media stream</a> is associated with.</li>
+   interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
+   cancelable, has no default action, and has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute whose value is
+   <var title="">message</var>, and <a href=#queue-a-task>queue a task</a> to
+   dispatch the event at the <code><a href=#peerconnection>PeerConnection</a></code> object
+   responsible for this side of the <a href=#data-udp-media-stream>data UDP media
+   stream</a>.</li>
 
-  </ol><p>The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#networking-task-source>networking task
+  </ol><p>A <dfn id=remotely-initiated-data-udp-media-stream>remotely-initiated data UDP media stream</dfn> is the
+  first "sendrecv" media stream in the initial offer whose media is
+  "<code title="">application</code>", whose transport protocol is
+  "<code title="">udp</code>", whose media format description is
+  "<code><a href=#application/html-peer-conection-data>application/html-peer-conection-data</a></code>", and whose label
+  attribute ("<code title="">a=label:</code>") has the value "<code title="">data</code>".</p>
+
+  <p>The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#networking-task-source>networking task
   source</a>.</p>
 
 

Modified: index
===================================================================
--- index	2011-03-14 22:21:01 UTC (rev 5951)
+++ index	2011-03-16 05:54:48 UTC (rev 5952)
@@ -243,7 +243,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 14 March 2011</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 16 March 2011</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -71715,7 +71715,11 @@
 interface <dfn id=peerconnection>PeerConnection</dfn> {
   void <a href=#dom-peerconnection-signalingmessage title=dom-PeerConnection-signalingMessage>signalingMessage</a>(in DOMString message);
 
-  // <span class=XXX>readyState, etc</span>
+  const unsigned short <a href=#dom-peerconnection-new title=dom-PeerConnection-NEW>NEW</a> = 0;
+  const unsigned short <a href=#dom-peerconnection-negotiating title=dom-PeerConnection-NEGOTIATING>NEGOTIATING</a> = 1;
+  const unsigned short <a href=#dom-peerconnection-active title=dom-PeerConnection-ACTIVE>ACTIVE</a> = 2;
+  const unsigned short <a href=#dom-peerconnection-closed title=dom-PeerConnection-CLOSED>CLOSED</a> = 3;
+  readonly attribute unsigned short <a href=#dom-peerconnection-readystate title=dom-PeerConnection-readyState>readyState</a>;
 
   void <a href=#dom-peerconnection-send title=dom-PeerConnection-send>send</a>(in DOMString text);
   void <a href=#dom-peerconnection-addstream title=dom-PeerConnection-addStream>addStream</a>(in <a href=#stream>Stream</a> stream);
@@ -71723,8 +71727,13 @@
   readonly attribute <a href=#stream>Stream</a>[] <a href=#dom-peerconnection-localstreams title=dom-PeerConnection-localStreams>localStreams</a>;
   readonly attribute <a href=#stream>Stream</a>[] <a href=#dom-peerconnection-remotestreams title=dom-PeerConnection-remoteStreams>remoteStreams</a>;
 
+  void <a href=#dom-peerconnection-close title=dom-PeerConnection-close>close</a>();
+
   // <span class=XXX>connection quality information</span>
-
+           attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onconnecting title=handler-PeerConnection-onconnecting>onconnecting</a>;
+           attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onopen title=handler-PeerConnection-onopen>onopen</a>;
+           attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onerror title=handler-PeerConnection-onerror>onerror</a>;
+           attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onclose title=handler-PeerConnection-onclose>onclose</a>;
            attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onmessage title=handler-PeerConnection-onmessage>onmessage</a>;
            attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onaddstream title=handler-PeerConnection-onaddstream>onaddstream</a>;
            attribute <a href=#function>Function</a> <a href=#handler-peerconnection-onremovestream title=handler-PeerConnection-onremovestream>onremovestream</a>;
@@ -71793,6 +71802,21 @@
    </dd>
 
 
+   <dt><var title="">connection</var> . <code title=dom-PeerConnection-readyState><a href=#dom-peerconnection-readystate>readyState</a></code></dt>
+   <dd>
+    <p>Returns the current readiness state for the connection,
+    represented by a number from the following list:</p>
+    <dl><dt> <code><a href=#peerconnection>PeerConnection</a></code> . <code title=dom-PeerConnection-NEW><a href=#dom-peerconnection-new>NEW</a></code> (0)</dt>
+     <dd>The object was just created, and no networking has yet occurred.</dd>
+     <dt> <code><a href=#peerconnection>PeerConnection</a></code> . <code title=dom-PeerConnection-NEGOTIATING><a href=#dom-peerconnection-negotiating>NEGOTIATING</a></code> (1)</dt>
+     <dd>The user agent is attempting to establish a connection.</dd>
+     <dt> <code><a href=#peerconnection>PeerConnection</a></code> . <code title=dom-PeerConnection-ACTIVE><a href=#dom-peerconnection-active>ACTIVE</a></code> (2)</dt>
+     <dd>The connection is as good as its going to get.</dd>
+     <dt> <code><a href=#peerconnection>PeerConnection</a></code> . <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3)</dt>
+     <dd>The connection is closed.</dd>
+    </dl></dd>
+
+
    <dt><var title="">connection</var> . <code title=dom-PeerConnection-signalingMessage><a href=#dom-peerconnection-signalingmessage>signalingMessage</a></code>(<var title="">message</var>)</dt>
 
    <dd>
@@ -71819,7 +71843,7 @@
     every message will be received.</p>
 
     <p>When a message sent in this manner from the other peer is
-    received, a <code title=event-PeerConnection-message>message</code>
+    received, a <code title=event-stream-message>message</code>
     event is dispatched at the <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
 
    </dd>
@@ -71832,7 +71856,7 @@
     peer.</p>
 
     <p>When the other peer starts sending a stream in this manner, an
-    <code title=event-PeerConnection-addstream>addstream</code>
+    <code title=event-stream-addstream>addstream</code>
     event is dispatched at the <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
 
    </dd>
@@ -71844,7 +71868,7 @@
     <p>Steps sending the given stream to the remote peer.</p>
 
     <p>When the other peer stops sending a stream in this manner, a
-    <code title=event-PeerConnection-removestream>removestream</code>
+    <code title=event-stream-removestream>removestream</code>
     event is dispatched at the <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
 
    </dd>
@@ -71866,7 +71890,7 @@
     <p>Returns a live array containing the streams that the user agent
     is currently receiving from the remote peer.</p>
 
-    <p>This array is updated when <code title=event-PeerConnection-addstream>addstream</code> and <code title=event-PeerConnection-removestream>removestream</code>
+    <p>This array is updated when <code title=event-stream-addstream>addstream</code> and <code title=event-stream-removestream>removestream</code>
     events are fired.</p>
 
    </dd>
@@ -71876,11 +71900,33 @@
   <p>A <code><a href=#peerconnection>PeerConnection</a></code> object has an associated
   <dfn id=peerconnection-signaling-callback><code>PeerConnection</code> signaling callback</dfn>, a
   <dfn id=peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</dfn>, a
-  <dfn id=peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media stream</dfn> and an
+  <dfn id=peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media stream</dfn>, a
+  <dfn id=peerconnection-readiness-state><code>PeerConnection</code> readiness state</dfn> and an
   <dfn id=ice-started-flag>ICE started flag</dfn>. These are initialized when the object
   is created.</p>
 
-  <p>When the <dfn id=dom-peerconnection title=dom-PeerConnection><code>PeerConnection()</code></dfn>
+  <p>The <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> can
+  have the following values:</p>
+
+  <dl><dt><dfn id=dom-peerconnection-new title=dom-PeerConnection-NEW><code>NEW</code></dfn> (numeric value 0)</dt>
+
+   <dd>The object was just created and its ICE Agent has not yet been started.</dd>
+
+   <dt><dfn id=dom-peerconnection-negotiating title=dom-PeerConnection-NEGOTIATING><code>NEGOTIATING</code></dfn> (numeric value 1)</dt>
+
+   <dd>The ICE Agent is actively preforming ICE processing.</dd>
+
+   <dt><dfn id=dom-peerconnection-active title=dom-PeerConnection-ACTIVE><code>ACTIVE</code></dfn> (numeric value 2)</dt>
+
+   <dd>The ICE Agent has concluded ICE processing and media is streaming.</dd>
+
+   <dt><dfn id=dom-peerconnection-closed title=dom-PeerConnection-CLOSED><code>CLOSED</code></dfn> (numeric value 3)</dt>
+
+   <dd>Either the <code title=dom-PeerConnection-close><a href=#dom-peerconnection-close>close()</a></code> method has been
+   invoked, or the other peer removed all the media streams, or the
+   other peer has apparently abruptly stopped sending any media.</dd>
+
+  </dl><p>When the <dfn id=dom-peerconnection title=dom-PeerConnection><code>PeerConnection()</code></dfn>
   constructor is invoked, the user agent must run the following steps.
   This algorithm has a <a href=#synchronous-section>synchronous section</a> (which is
   triggered as part of the <a href=#event-loop>event loop</a> algorithm). Steps
@@ -71982,6 +72028,9 @@
    <a href=#peerconnection-signaling-callback><code>PeerConnection</code> signaling callback</a> be
    <var title="">signalingCallback</var>.</li>
 
+   <li><p>Set <var title="">connection</var>'s
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> to <code title=dom-PeerConnection-NEW><a href=#dom-peerconnection-new>NEW</a></code> (0).</li>
+
    <li><p>Set <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
    flag</a> to false.</li>
 
@@ -72008,11 +72057,21 @@
    <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> and send the
    initial offer. The initial offer must include a media description
    for the <a href=#peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media
-   stream</a> and for all the streams in <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code>. <a href=#refsICE>[ICE]</a></li>
+   stream</a>, marked as "sendrecv", and for all the streams in
+   <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code>
+   (marked as "sendonly"). <a href=#refsICE>[ICE]</a> <a href=#refsSDPOFFERANSWER>[SDPOFFERANSWER]</a></li>
 
    <li><p>⌛ Let <var title="">connection</var>'s <a href=#ice-started-flag>ICE
    started flag</a> be true.</li>
 
+   <li><p>⌛ If <var title="">connection</var>'s
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is still
+   <code title=dom-PeerConnection-NEW><a href=#dom-peerconnection-new>NEW</a></code> (0), then
+   <a href=#queue-a-task>queue a task</a> that sets it to <code title=dom-PeerConnection-NEGOTIATING><a href=#dom-peerconnection-negotiating>NEGOTIATING</a></code> (1) and
+   then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a>
+   named <code title=event-stream-connecting>connecting</code> at the
+   <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
+
   </ol><p>When a <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> is
   required to send SDP offers or answers, the user agent must follow
   these steps:</p>
@@ -72029,7 +72088,12 @@
    <a href=#peerconnection-signaling-callback><code>PeerConnection</code> signaling callback</a> with
    <var title="">message</var> as its argument.</li>
 
-  </ol><p>All SDP media descriptions for streams represented by
+  </ol><p>All streams represented by <code><a href=#stream>Stream</a></code> objects must be
+  marked as "sendonly" by the peer that initially adds the stream to
+  the session. The <code><a href=#peerconnection>PeerConnection</a></code> API does not support
+  bidirectional ("sendrecv") audio or video media streams. <a href=#refsSDPOFFERANSWER>[SDPOFFERANSWER]</a></p>
+
+  <p>All SDP media descriptions for streams represented by
   <code><a href=#stream>Stream</a></code> objects must include a label attribute ("<code title="">a=label:</code>") whose value is the value of the
   <code><a href=#stream>Stream</a></code> object's <code title=dom-stream-label><a href=#dom-stream-label>label</a></code> attribute. <a href=#refsSDP>[SDP]</a> <a href=#refsSDPLABEL>[SDPLABEL]</a></p>
 
@@ -72086,6 +72150,14 @@
   <ol><li><p>Let <var title="">message</var> be the method's
    argument.</li>
 
+   <li><p>Let <var title="">connection</var> be the
+   <code><a href=#peerconnection>PeerConnection</a></code> object on which the method was
+   invoked.</li>
+
+   <li><p>If <var title="">connection</var>'s
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
    <li>
 
     <p>If the first four characters of <var title="">message</var> are
@@ -72103,35 +72175,85 @@
    <li><p>Let <var title="">sdp</var> be the string consisting of all
    but the first four characters of <var title="">message</var>.</li>
 
+   <li><p>If <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
+   flag</a> is true, then pass <var title="">sdp</var> to the
+   <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> as a subsequent
+   offer or answer, to be interpreted as appropriate given the current
+   state of the ICE Agent, and abort these steps. <a href=#refsICE>[ICE]</a></li>
+
    <li>
 
-    <p>If <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
-    flag</a> is still false, start the
+    <p>The <a href=#ice-started-flag>ICE started flag</a> is false. Start the
     <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> and pass it
     <var title="">sdp</var> as the initial offer from the other peer;
     the ICE Agent will then (asynchronously) construct the initial
-    answer and transmit it as described above. The initial answer must
-    include a media description for the
-    <a href=#peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media stream</a> and
-    for all the streams in <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code>. <a href=#refsICE>[ICE]</a></p>
+    answer and transmit it as described above.</p>
 
-    <p>If <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
-    flag</a> is true, then pass <var title="">sdp</var> to the
-    <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> as a subsequent
-    offer or answer, to be interpreted as appropriate given the
-    current state of the ICE Agent. <a href=#refsICE>[ICE]</a></p>
+    <p>If there is a <a href=#remotely-initiated-data-udp-media-stream>remotely-initiated data UDP media
+    stream</a> in the initial offer, and it has an encryption key
+    advertised in its media description that is 16 bytes long, then
+    that is the <a href=#peerconnection-data-udp-media-stream><code>PeerConnection</code> data UDP media
+    stream</a>.</p>
 
+    <p>After the initial answer has been sent, the ICE Agent must add
+    all the streams in <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code> to the
+    session, as described above. <a href=#refsICE>[ICE]</a></p>
+
    </li>
 
    <li><p>Let <var title="">connection</var>'s <a href=#ice-started-flag>ICE started
    flag</a> be true.</li>
 
-  </ol><p>When the <dfn id=dom-peerconnection-send title=dom-PeerConnection-send><code title="">send()</code></dfn> method is invoked, the
+   <li><p><a href=#queue-a-task>Queue a task</a> that sets <var title="">connection</var>'s <a href=#peerconnection-readiness-state><code>PeerConnection</code>
+   readiness state</a> to <code title=dom-PeerConnection-NEGOTIATING><a href=#dom-peerconnection-negotiating>NEGOTIATING</a></code> (1) and
+   then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a>
+   named <code title=event-stream-connecting>connecting</code> at the
+   <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
+
+  </ol><p>When a <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a>
+  completes ICE processing with any active media streams, the user
+  agent must <a href=#queue-a-task>queue a task</a> that sets the
+  <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> to <code title=dom-PeerConnection-ACTIVE><a href=#dom-peerconnection-active>ACTIVE</a></code> (2) and then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a> named <code title=event-stream-open>open</code> at the <code><a href=#peerconnection>PeerConnection</a></code>
+  object.</p>
+
+  <p>When a <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a>
+  completes ICE processing with no active media streams, the user
+  agent must <a href=#queue-a-task>queue a task</a> that sets the
+  <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> to <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3) and then, if the
+  <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> has ever
+  reached the <code title=dom-PeerConnection-ACTIVE><a href=#dom-peerconnection-active>ACTIVE</a></code>
+  (2) state, <a href=#fire-a-simple-event title="fire a simple event">fires a simple
+  event</a> named <code title=event-stream-close>close</code> at the
+  <code><a href=#peerconnection>PeerConnection</a></code> object, or otherwise <a href=#fire-a-simple-event title="fire a
+  simple event">fires a simple event</a> named <code title=event-stream-error>error</code> at the <code><a href=#peerconnection>PeerConnection</a></code>
+  object.</p>
+
+  <p>When a <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a>
+  restarts ICE processing for any reason (e.g. because a peer is
+  adding or removing a stream), the user agent must <a href=#queue-a-task>queue a
+  task</a> that sets the <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> to <code title=dom-PeerConnection-NEGOTIATING><a href=#dom-peerconnection-negotiating>NEGOTIATING</a></code> (1) and
+  then <a href=#fire-a-simple-event title="fire a simple event">fires a simple event</a>
+  named <code title=event-stream-connecting>connecting</code> at the
+  <code><a href=#peerconnection>PeerConnection</a></code> object.</p>
+                                   
+  <p>The <dfn id=dom-peerconnection-readystate title=dom-PeerConnection-readyState><code title="">readyState</code></dfn> attribute must return the numeric
+  value of the <code><a href=#peerconnection>PeerConnection</a></code> object's
+  <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a>.</p>
+
+  <p>When the <dfn id=dom-peerconnection-send title=dom-PeerConnection-send><code title="">send()</code></dfn> method is invoked, the
   user agent must run the following steps:</p>
 
   <ol><li><p>Let <var title="">message</var> be the method's first
    argument.</li>
 
+   <li><p>If the <code><a href=#peerconnection>PeerConnection</a></code> object's
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
    <li><p>Let <var title="">data</var> be <var title="">message</var>
    encoded as UTF-8. <a href=#refsRFC3629>[RFC3629]</a></li>
 
@@ -72156,6 +72278,10 @@
   <ol><li><p>Let <var title="">stream</var> be the method's
    argument.</li>
 
+   <li><p>If the <code><a href=#peerconnection>PeerConnection</a></code> object's
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
    <li><p>If <var title="">stream</var> is null, throw a
    <code>TypeError</code> exception and abort these steps.</li>
 
@@ -72180,6 +72306,10 @@
   <ol><li><p>Let <var title="">stream</var> be the method's
    argument.</li>
 
+   <li><p>If the <code><a href=#peerconnection>PeerConnection</a></code> object's
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
    <li><p>If <var title="">stream</var> is null, throw a
    <code>TypeError</code> exception and abort these steps.</li>
 
@@ -72203,7 +72333,31 @@
   attributes must return the read-only <code><a href=#stream>Stream</a></code> arrays that
   the attributes were respectively set to when the
   <code><a href=#peerconnection>PeerConnection</a></code>'s constructor ran.</p>
+  
+  <p>When the <dfn id=dom-peerconnection-close title=dom-PeerConnection-close><code title="">close()</code></dfn> method is invoked, the user agent must
+  run the following steps:</p>
 
+  <ol><li><p>If the <code><a href=#peerconnection>PeerConnection</a></code> object's
+   <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness state</a> is <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3), throw an
+   <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+
+   <li><p>Destroy the <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE
+   Agent</a>, abruptly ending any active ICE processing and any
+   active streaming, and releasing any relevant resources (e.g. TURN
+   permissions).</li>
+
+   <li><p>Set the object's <a href=#peerconnection-readiness-state><code>PeerConnection</code> readiness
+   state</a> to <code title=dom-PeerConnection-CLOSED><a href=#dom-peerconnection-closed>CLOSED</a></code> (3).</li>
+
+   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event>fire a simple
+   event</a> named <code title=event-stream-close>close</code> at the
+   <code><a href=#peerconnection>PeerConnection</a></code> object.</li>
+
+  </ol><p class=note>The <code title=dom-PeerConnection-localStreams><a href=#dom-peerconnection-localstreams>localStreams</a></code> and
+  <code title=dom-PeerConnection-remoteStreams><a href=#dom-peerconnection-remotestreams>remoteStreams</a></code>
+  objects remain in the state they were in when the object was
+  closed.</p>
+
   <hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their
   corresponding <a href=#event-handler-event-type title="event handler event type">event handler
   event types</a>) that must be supported, as IDL attributes, by
@@ -72211,7 +72365,11 @@
   interface:</p>
 
   <table><thead><tr><th><a href=#event-handlers title="event handlers">Event handler</a> <th><a href=#event-handler-event-type>Event handler event type</a>
-   <tbody><tr><td><dfn id=handler-peerconnection-onmessage title=handler-PeerConnection-onmessage><code>onmessage</code></dfn> <td> <code title=event-stream-message>message</code>
+   <tbody><tr><td><dfn id=handler-peerconnection-onconnecting title=handler-PeerConnection-onconnecting><code>onconnecting</code></dfn> <td> <code title=event-stream-connecting>connecting</code>
+    <tr><td><dfn id=handler-peerconnection-onopen title=handler-PeerConnection-onopen><code>onopen</code></dfn> <td> <code title=event-stream-open>open</code>
+    <tr><td><dfn id=handler-peerconnection-onerror title=handler-PeerConnection-onerror><code>onerror</code></dfn> <td> <code title=event-stream-error>error</code>
+    <tr><td><dfn id=handler-peerconnection-onclose title=handler-PeerConnection-onclose><code>onclose</code></dfn> <td> <code title=event-stream-close>close</code>
+    <tr><td><dfn id=handler-peerconnection-onmessage title=handler-PeerConnection-onmessage><code>onmessage</code></dfn> <td> <code title=event-stream-message>message</code>
     <tr><td><dfn id=handler-peerconnection-onaddstream title=handler-PeerConnection-onaddstream><code>onaddstream</code></dfn> <td> <code title=event-stream-addstream>addstream</code>
     <tr><td><dfn id=handler-peerconnection-onremovestream title=handler-PeerConnection-onremovestream><code>onremovestream</code></dfn> <td> <code title=event-stream-removestream>removestream</code>
   </table><hr><p>The <a href=#task-source>task source</a> for the <a href=#concept-task title=concept-task>tasks</a> listed in this section is the
@@ -72344,21 +72502,10 @@
    <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> has selected a
    destination for the <a href=#data-udp-media-stream>data UDP media stream</a>.</li>
 
-  </ol><p>A <dfn id=remote-data-udp-media-stream>remote data UDP media stream</dfn> is the first UDP media
-  stream whose sender is the remote peer, whose media is "<code title="">application</code>", whose transport protocol is "<code title="">udp</code>", whose media format description is
-  "<code><a href=#application/html-peer-conection-data>application/html-peer-conection-data</a></code>", whose label
-  attribute ("<code title="">a=label:</code>") has the value "<code title="">data</code>", and for which a
-  <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> has selected a
-  destination, if that media stream has an encryption key advertised
-  in its media description, and if that encryption key is 16 bytes
-  long. A <a href=#remote-data-udp-media-stream>remote data UDP media stream</a> is associated with
-  the <code><a href=#peerconnection>PeerConnection</a></code> object for which the
-  <a href=#peerconnection-ice-agent><code>PeerConnection</code> ICE Agent</a> in question is
-  operating.</p>
+  </ol><p>When a packet that is part of a <a href=#data-udp-media-stream>data UDP media
+  stream</a> is received, the user agent must run the following
+  steps:</p>
 
-  <p>When a packet from a <a href=#remote-data-udp-media-stream>remote data UDP media stream</a> is
-  received, the user agent must run the following steps:</p>
-
   <ol><li><p>Let <var title="">encrypted message</var> be the UDP
    packet's data.</li>
 
@@ -72366,8 +72513,8 @@
    bytes, then abort these steps.</li>
 
    <li><p>Let <var title="">ice-key</var> be the 16 bytes given as the
-   encryption key for the <a href=#remote-data-udp-media-stream>remote data UDP media stream</a> in
-   the media description for this media stream. <a href=#refsSDP>[SDP]</a></li>
+   encryption key for the <a href=#data-udp-media-stream>data UDP media stream</a> in the
+   media description for this media stream. <a href=#refsSDP>[SDP]</a></li>
 
    <li><p>Let <var title="">masked message with nonce</var> be the
    result of decrypting <var title="">message</var> using AES-128-CTR
@@ -72399,15 +72546,21 @@
    handling</a>.</li>
 
    <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
-   interface, with the name <code title=event-message><a href=#event-message>message</a></code>,
-   which does not bubble, is not cancelable, has no default action,
-   and has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute
-   whose value is <var title="">message</var>, and <a href=#queue-a-task>queue a
-   task</a> to dispatch the event at the
-   <code><a href=#peerconnection>PeerConnection</a></code> object that the <a href=#remote-data-udp-media-stream>remote data UDP
-   media stream</a> is associated with.</li>
+   interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
+   cancelable, has no default action, and has a <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute whose value is
+   <var title="">message</var>, and <a href=#queue-a-task>queue a task</a> to
+   dispatch the event at the <code><a href=#peerconnection>PeerConnection</a></code> object
+   responsible for this side of the <a href=#data-udp-media-stream>data UDP media
+   stream</a>.</li>
 
-  </ol><p>The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#networking-task-source>networking task
+  </ol><p>A <dfn id=remotely-initiated-data-udp-media-stream>remotely-initiated data UDP media stream</dfn> is the
+  first "sendrecv" media stream in the initial offer whose media is
+  "<code title="">application</code>", whose transport protocol is
+  "<code title="">udp</code>", whose media format description is
+  "<code><a href=#application/html-peer-conection-data>application/html-peer-conection-data</a></code>", and whose label
+  attribute ("<code title="">a=label:</code>") has the value "<code title="">data</code>".</p>
+
+  <p>The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#networking-task-source>networking task
   source</a>.</p>
 
 

Modified: source
===================================================================
--- source	2011-03-14 22:21:01 UTC (rev 5951)
+++ source	2011-03-16 05:54:48 UTC (rev 5952)
@@ -81805,7 +81805,11 @@
 interface <dfn>PeerConnection</dfn> {
   void <span title="dom-PeerConnection-signalingMessage">signalingMessage</span>(in DOMString message);
 
-  // <span class="XXX">readyState, etc</span>
+  const unsigned short <span title="dom-PeerConnection-NEW">NEW</span> = 0;
+  const unsigned short <span title="dom-PeerConnection-NEGOTIATING">NEGOTIATING</span> = 1;
+  const unsigned short <span title="dom-PeerConnection-ACTIVE">ACTIVE</span> = 2;
+  const unsigned short <span title="dom-PeerConnection-CLOSED">CLOSED</span> = 3;
+  readonly attribute unsigned short <span title="dom-PeerConnection-readyState">readyState</span>;
 
   void <span title="dom-PeerConnection-send">send</span>(in DOMString text);
   void <span title="dom-PeerConnection-addStream">addStream</span>(in <span>Stream</span> stream);
@@ -81813,8 +81817,13 @@
   readonly attribute <span>Stream</span>[] <span title="dom-PeerConnection-localStreams">localStreams</span>;
   readonly attribute <span>Stream</span>[] <span title="dom-PeerConnection-remoteStreams">remoteStreams</span>;
 
+  void <span title="dom-PeerConnection-close">close</span>();
+
   // <span class="XXX">connection quality information</span>
-
+           attribute <span>Function</span> <span title="handler-PeerConnection-onconnecting">onconnecting</span>;
+           attribute <span>Function</span> <span title="handler-PeerConnection-onopen">onopen</span>;
+           attribute <span>Function</span> <span title="handler-PeerConnection-onerror">onerror</span>;
+           attribute <span>Function</span> <span title="handler-PeerConnection-onclose">onclose</span>;
            attribute <span>Function</span> <span title="handler-PeerConnection-onmessage">onmessage</span>;
            attribute <span>Function</span> <span title="handler-PeerConnection-onaddstream">onaddstream</span>;
            attribute <span>Function</span> <span title="handler-PeerConnection-onremovestream">onremovestream</span>;
@@ -81895,6 +81904,23 @@
    </dd>
 
 
+   <dt><var title="">connection</var> . <code title="dom-PeerConnection-readyState">readyState</code></dt>
+   <dd>
+    <p>Returns the current readiness state for the connection,
+    represented by a number from the following list:</p>
+    <dl>
+     <dt> <code>PeerConnection</code> . <code title="dom-PeerConnection-NEW">NEW</code> (0)</dt>
+     <dd>The object was just created, and no networking has yet occurred.</dd>
+     <dt> <code>PeerConnection</code> . <code title="dom-PeerConnection-NEGOTIATING">NEGOTIATING</code> (1)</dt>
+     <dd>The user agent is attempting to establish a connection.</dd>
+     <dt> <code>PeerConnection</code> . <code title="dom-PeerConnection-ACTIVE">ACTIVE</code> (2)</dt>
+     <dd>The connection is as good as its going to get.</dd>
+     <dt> <code>PeerConnection</code> . <code title="dom-PeerConnection-CLOSED">CLOSED</code> (3)</dt>
+     <dd>The connection is closed.</dd>
+    </dl>
+   </dd>
+
+
    <dt><var title="">connection</var> . <code title="dom-PeerConnection-signalingMessage">signalingMessage</code>(<var title="">message</var>)</dt>
 
    <dd>
@@ -81922,7 +81948,7 @@
     every message will be received.</p>
 
     <p>When a message sent in this manner from the other peer is
-    received, a <code title="event-PeerConnection-message">message</code>
+    received, a <code title="event-stream-message">message</code>
     event is dispatched at the <code>PeerConnection</code> object.</p>
 
    </dd>
@@ -81935,7 +81961,7 @@
     peer.</p>
 
     <p>When the other peer starts sending a stream in this manner, an
-    <code title="event-PeerConnection-addstream">addstream</code>
+    <code title="event-stream-addstream">addstream</code>
     event is dispatched at the <code>PeerConnection</code> object.</p>
 
    </dd>
@@ -81948,7 +81974,7 @@
 
     <p>When the other peer stops sending a stream in this manner, a
     <code
-    title="event-PeerConnection-removestream">removestream</code>
+    title="event-stream-removestream">removestream</code>
     event is dispatched at the <code>PeerConnection</code> object.</p>
 
    </dd>
@@ -81972,8 +81998,8 @@
     is currently receiving from the remote peer.</p>
 
     <p>This array is updated when <code
-    title="event-PeerConnection-addstream">addstream</code> and <code
-    title="event-PeerConnection-removestream">removestream</code>
+    title="event-stream-addstream">addstream</code> and <code
+    title="event-stream-removestream">removestream</code>
     events are fired.</p>
 
    </dd>
@@ -81985,10 +82011,37 @@
   <p>A <code>PeerConnection</code> object has an associated
   <dfn><code>PeerConnection</code> signaling callback</dfn>, a
   <dfn><code>PeerConnection</code> ICE Agent</dfn>, a
-  <dfn><code>PeerConnection</code> data UDP media stream</dfn> and an
+  <dfn><code>PeerConnection</code> data UDP media stream</dfn>, a
+  <dfn><code>PeerConnection</code> readiness state</dfn> and an
   <dfn>ICE started flag</dfn>. These are initialized when the object
   is created.</p>
 
+  <p>The <span><code>PeerConnection</code> readiness state</span> can
+  have the following values:</p>
+
+  <dl>
+
+   <dt><dfn title="dom-PeerConnection-NEW"><code>NEW</code></dfn> (numeric value 0)</dt>
+
+   <dd>The object was just created and its ICE Agent has not yet been started.</dd>
+
+   <dt><dfn title="dom-PeerConnection-NEGOTIATING"><code>NEGOTIATING</code></dfn> (numeric value 1)</dt>
+
+   <dd>The ICE Agent is actively preforming ICE processing.</dd>
+
+   <dt><dfn title="dom-PeerConnection-ACTIVE"><code>ACTIVE</code></dfn> (numeric value 2)</dt>
+
+   <dd>The ICE Agent has concluded ICE processing and media is streaming.</dd>
+
+   <dt><dfn title="dom-PeerConnection-CLOSED"><code>CLOSED</code></dfn> (numeric value 3)</dt>
+
+   <dd>Either the <code
+   title="dom-PeerConnection-close">close()</code> method has been
+   invoked, or the other peer removed all the media streams, or the
+   other peer has apparently abruptly stopped sending any media.</dd>
+
+  </dl>
+
   <p>When the <dfn
   title="dom-PeerConnection"><code>PeerConnection()</code></dfn>
   constructor is invoked, the user agent must run the following steps.
@@ -82109,6 +82162,10 @@
    <span><code>PeerConnection</code> signaling callback</span> be
    <var title="">signalingCallback</var>.</p></li>
 
+   <li><p>Set <var title="">connection</var>'s
+   <span><code>PeerConnection</code> readiness state</span> to <code
+   title="dom-PeerConnection-NEW">NEW</code> (0).</p></li>
+
    <li><p>Set <var title="">connection</var>'s <span>ICE started
    flag</span> to false.</p></li>
 
@@ -82139,13 +82196,23 @@
    <span><code>PeerConnection</code> ICE Agent</span> and send the
    initial offer. The initial offer must include a media description
    for the <span><code>PeerConnection</code> data UDP media
-   stream</span> and for all the streams in <code
-   title="dom-PeerConnection-localStreams">localStreams</code>. <a
-   href="#refsICE">[ICE]</a></p></li>
+   stream</span>, marked as "sendrecv", and for all the streams in
+   <code title="dom-PeerConnection-localStreams">localStreams</code>
+   (marked as "sendonly"). <a href="#refsICE">[ICE]</a> <a
+   href="#refsSDPOFFERANSWER">[SDPOFFERANSWER]</a></p></li>
 
    <li><p>&#x231B; Let <var title="">connection</var>'s <span>ICE
    started flag</span> be true.</p></li>
 
+   <li><p>&#x231B; If <var title="">connection</var>'s
+   <span><code>PeerConnection</code> readiness state</span> is still
+   <code title="dom-PeerConnection-NEW">NEW</code> (0), then
+   <span>queue a task</span> that sets it to <code
+   title="dom-PeerConnection-NEGOTIATING">NEGOTIATING</code> (1) and
+   then <span title="fire a simple event">fires a simple event</span>
+   named <code title="event-stream-connecting">connecting</code> at the
+   <code>PeerConnection</code> object.</p>
+
   </ol>
 
   <p>When a <span><code>PeerConnection</code> ICE Agent</span> is
@@ -82168,6 +82235,12 @@
 
   </ol>
 
+  <p>All streams represented by <code>Stream</code> objects must be
+  marked as "sendonly" by the peer that initially adds the stream to
+  the session. The <code>PeerConnection</code> API does not support
+  bidirectional ("sendrecv") audio or video media streams. <a
+  href="#refsSDPOFFERANSWER">[SDPOFFERANSWER]</a></p>
+
   <p>All SDP media descriptions for streams represented by
   <code>Stream</code> objects must include a label attribute ("<code
   title="">a=label:</code>") whose value is the value of the
@@ -82249,6 +82322,15 @@
    <li><p>Let <var title="">message</var> be the method's
    argument.</p></li>
 
+   <li><p>Let <var title="">connection</var> be the
+   <code>PeerConnection</code> object on which the method was
+   invoked.</p></li>
+
+   <li><p>If <var title="">connection</var>'s
+   <span><code>PeerConnection</code> readiness state</span> is <code
+   title="dom-PeerConnection-CLOSED">CLOSED</code> (3), throw an
+   <code>INVALID_STATE_ERR</code> exception.</p></li>
+
    <li>
 
     <p>If the first four characters of <var title="">message</var> are
@@ -82267,33 +82349,88 @@
    but the first four characters of <var
    title="">message</var>.</p></li>
 
+   <li><p>If <var title="">connection</var>'s <span>ICE started
+   flag</span> is true, then pass <var title="">sdp</var> to the
+   <span><code>PeerConnection</code> ICE Agent</span> as a subsequent
+   offer or answer, to be interpreted as appropriate given the current
+   state of the ICE Agent, and abort these steps. <a
+   href="#refsICE">[ICE]</a></p></li>
+
    <li>
 
-    <p>If <var title="">connection</var>'s <span>ICE started
-    flag</span> is still false, start the
+    <p>The <span>ICE started flag</span> is false. Start the
     <span><code>PeerConnection</code> ICE Agent</span> and pass it
     <var title="">sdp</var> as the initial offer from the other peer;
     the ICE Agent will then (asynchronously) construct the initial
-    answer and transmit it as described above. The initial answer must
-    include a media description for the
-    <span><code>PeerConnection</code> data UDP media stream</span> and
-    for all the streams in <code
-    title="dom-PeerConnection-localStreams">localStreams</code>. <a
-    href="#refsICE">[ICE]</a></p>
+    answer and transmit it as described above.</p>
 
-    <p>If <var title="">connection</var>'s <span>ICE started
-    flag</span> is true, then pass <var title="">sdp</var> to the
-    <span><code>PeerConnection</code> ICE Agent</span> as a subsequent
-    offer or answer, to be interpreted as appropriate given the
-    current state of the ICE Agent. <a href="#refsICE">[ICE]</a></p>
+    <p>If there is a <span>remotely-initiated data UDP media
+    stream</span> in the initial offer, and it has an encryption key
+    advertised in its media description that is 16 bytes long, then
+    that is the <span><code>PeerConnection</code> data UDP media
+    stream</span>.</p>
 
+    <p>After the initial answer has been sent, the ICE Agent must add
+    all the streams in <code
+    title="dom-PeerConnection-localStreams">localStreams</code> to the
+    session, as described above. <a href="#refsICE">[ICE]</a></p>
+
    </li>
 
    <li><p>Let <var title="">connection</var>'s <span>ICE started
    flag</span> be true.</p></li>
 
+   <li><p><span>Queue a task</span> that sets <var
+   title="">connection</var>'s <span><code>PeerConnection</code>
+   readiness state</span> to <code
+   title="dom-PeerConnection-NEGOTIATING">NEGOTIATING</code> (1) and
+   then <span title="fire a simple event">fires a simple event</span>
+   named <code title="event-stream-connecting">connecting</code> at the
+   <code>PeerConnection</code> object.</p>
+
   </ol>
 
+  <p>When a <span><code>PeerConnection</code> ICE Agent</span>
+  completes ICE processing with any active media streams, the user
+  agent must <span>queue a task</span> that sets the
+  <code>PeerConnection</code> object's
+  <span><code>PeerConnection</code> readiness state</span> to <code
+  title="dom-PeerConnection-ACTIVE">ACTIVE</code> (2) and then <span
+  title="fire a simple event">fires a simple event</span> named <code
+  title="event-stream-open">open</code> at the <code>PeerConnection</code>
+  object.</p>
+
+  <p>When a <span><code>PeerConnection</code> ICE Agent</span>
+  completes ICE processing with no active media streams, the user
+  agent must <span>queue a task</span> that sets the
+  <code>PeerConnection</code> object's
+  <span><code>PeerConnection</code> readiness state</span> to <code
+  title="dom-PeerConnection-CLOSED">CLOSED</code> (3) and then, if the
+  <code>PeerConnection</code> object's
+  <span><code>PeerConnection</code> readiness state</span> has ever
+  reached the <code title="dom-PeerConnection-ACTIVE">ACTIVE</code>
+  (2) state, <span title="fire a simple event">fires a simple
+  event</span> named <code title="event-stream-close">close</code> at the
+  <code>PeerConnection</code> object, or otherwise <span title="fire a
+  simple event">fires a simple event</span> named <code
+  title="event-stream-error">error</code> at the <code>PeerConnection</code>
+  object.</p>
+
+  <p>When a <span><code>PeerConnection</code> ICE Agent</span>
+  restarts ICE processing for any reason (e.g. because a peer is
+  adding or removing a stream), the user agent must <span>queue a
+  task</span> that sets the <code>PeerConnection</code> object's
+  <span><code>PeerConnection</code> readiness state</span> to <code
+  title="dom-PeerConnection-NEGOTIATING">NEGOTIATING</code> (1) and
+  then <span title="fire a simple event">fires a simple event</span>
+  named <code title="event-stream-connecting">connecting</code> at the
+  <code>PeerConnection</code> object.</p>
+                                   
+  <p>The <dfn title="dom-PeerConnection-readyState"><code
+  title="">readyState</code></dfn> attribute must return the numeric
+  value of the <code>PeerConnection</code> object's
+  <span><code>PeerConnection</code> readiness state</span>.</p>
+
   <p>When the <dfn title="dom-PeerConnection-send"><code
   title="">send()</code></dfn> method is invoked, the
   user agent must run the following steps:</p>
@@ -82303,6 +82440,11 @@
    <li><p>Let <var title="">message</var> be the method's first
    argument.</p></li>
 
+   <li><p>If the <code>PeerConnection</code> object's
+   <span><code>PeerConnection</code> readiness state</span> is <code
+   title="dom-PeerConnection-CLOSED">CLOSED</code> (3), throw an
+   <code>INVALID_STATE_ERR</code> exception.</p></li>
+
    <li><p>Let <var title="">data</var> be <var title="">message</var>
    encoded as UTF-8. <a href="#refsRFC3629">[RFC3629]</a></p></li>
 
@@ -82332,6 +82474,11 @@
    <li><p>Let <var title="">stream</var> be the method's
    argument.</p></li>
 
+   <li><p>If the <code>PeerConnection</code> object's
+   <span><code>PeerConnection</code> readiness state</span> is <code
+   title="dom-PeerConnection-CLOSED">CLOSED</code> (3), throw an
+   <code>INVALID_STATE_ERR</code> exception.</p></li>
+
    <li><p>If <var title="">stream</var> is null, throw a
    <code>TypeError</code> exception and abort these steps.</p></li>
 
@@ -82364,6 +82511,11 @@
    <li><p>Let <var title="">stream</var> be the method's
    argument.</p></li>
 
+   <li><p>If the <code>PeerConnection</code> object's
+   <span><code>PeerConnection</code> readiness state</span> is <code
+   title="dom-PeerConnection-CLOSED">CLOSED</code> (3), throw an
+   <code>INVALID_STATE_ERR</code> exception.</p></li>
+
    <li><p>If <var title="">stream</var> is null, throw a
    <code>TypeError</code> exception and abort these steps.</p></li>
 
@@ -82394,7 +82546,39 @@
   attributes must return the read-only <code>Stream</code> arrays that
   the attributes were respectively set to when the
   <code>PeerConnection</code>'s constructor ran.</p>
+  
+  <p>When the <dfn title="dom-PeerConnection-close"><code
+  title="">close()</code></dfn> method is invoked, the user agent must
+  run the following steps:</p>
 
+  <ol>
+
+   <li><p>If the <code>PeerConnection</code> object's
+   <span><code>PeerConnection</code> readiness state</span> is <code
+   title="dom-PeerConnection-CLOSED">CLOSED</code> (3), throw an
+   <code>INVALID_STATE_ERR</code> exception.</p></li>
+
+   <li><p>Destroy the <span><code>PeerConnection</code> ICE
+   Agent</span>, abruptly ending any active ICE processing and any
+   active streaming, and releasing any relevant resources (e.g. TURN
+   permissions).</p></li>
+
+   <li><p>Set the object's <span><code>PeerConnection</code> readiness
+   state</span> to <code
+   title="dom-PeerConnection-CLOSED">CLOSED</code> (3).</p></li>
+
+   <li><p><span>Queue a task</span> to <span>fire a simple
+   event</span> named <code title="event-stream-close">close</code> at the
+   <code>PeerConnection</code> object.</p></li>
+
+  </ol>
+
+  <p class="note">The <code
+  title="dom-PeerConnection-localStreams">localStreams</code> and
+  <code title="dom-PeerConnection-remoteStreams">remoteStreams</code>
+  objects remain in the state they were in when the object was
+  closed.</p>
+
   <hr>
 
   <p>The following are the <span>event handlers</span> (and their
@@ -82407,6 +82591,10 @@
    <thead>
     <tr><th><span title="event handlers">Event handler</span> <th><span>Event handler event type</span>
    <tbody>
+    <tr><td><dfn title="handler-PeerConnection-onconnecting"><code>onconnecting</code></dfn> <td> <code title="event-stream-connecting">connecting</code>
+    <tr><td><dfn title="handler-PeerConnection-onopen"><code>onopen</code></dfn> <td> <code title="event-stream-open">open</code>
+    <tr><td><dfn title="handler-PeerConnection-onerror"><code>onerror</code></dfn> <td> <code title="event-stream-error">error</code>
+    <tr><td><dfn title="handler-PeerConnection-onclose"><code>onclose</code></dfn> <td> <code title="event-stream-close">close</code>
     <tr><td><dfn title="handler-PeerConnection-onmessage"><code>onmessage</code></dfn> <td> <code title="event-stream-message">message</code>
     <tr><td><dfn title="handler-PeerConnection-onaddstream"><code>onaddstream</code></dfn> <td> <code title="event-stream-addstream">addstream</code>
     <tr><td><dfn title="handler-PeerConnection-onremovestream"><code>onremovestream</code></dfn> <td> <code title="event-stream-removestream">removestream</code>
@@ -82557,24 +82745,10 @@
 
   </ol>
 
-  <p>A <dfn>remote data UDP media stream</dfn> is the first UDP media
-  stream whose sender is the remote peer, whose media is "<code
-  title="">application</code>", whose transport protocol is "<code
-  title="">udp</code>", whose media format description is
-  "<code>application/html-peer-conection-data</code>", whose label
-  attribute ("<code title="">a=label:</code>") has the value "<code
-  title="">data</code>", and for which a
-  <span><code>PeerConnection</code> ICE Agent</span> has selected a
-  destination, if that media stream has an encryption key advertised
-  in its media description, and if that encryption key is 16 bytes
-  long. A <span>remote data UDP media stream</span> is associated with
-  the <code>PeerConnection</code> object for which the
-  <span><code>PeerConnection</code> ICE Agent</span> in question is
-  operating.</p>
+  <p>When a packet that is part of a <span>data UDP media
+  stream</span> is received, the user agent must run the following
+  steps:</p>
 
-  <p>When a packet from a <span>remote data UDP media stream</span> is
-  received, the user agent must run the following steps:</p>
-
   <ol>
 
    <li><p>Let <var title="">encrypted message</var> be the UDP
@@ -82584,8 +82758,8 @@
    bytes, then abort these steps.</p></li>
 
    <li><p>Let <var title="">ice-key</var> be the 16 bytes given as the
-   encryption key for the <span>remote data UDP media stream</span> in
-   the media description for this media stream. <a
+   encryption key for the <span>data UDP media stream</span> in the
+   media description for this media stream. <a
    href="#refsSDP">[SDP]</a></p></li>
 
    <li><p>Let <var title="">masked message with nonce</var> be the
@@ -82622,16 +82796,25 @@
    handling</span>.</p></li>
 
    <li><p>Create an event that uses the <code>MessageEvent</code>
-   interface, with the name <code title="event-message">message</code>,
-   which does not bubble, is not cancelable, has no default action,
-   and has a <code title="dom-MessageEvent-data">data</code> attribute
-   whose value is <var title="">message</var>, and <span>queue a
-   task</span> to dispatch the event at the
-   <code>PeerConnection</code> object that the <span>remote data UDP
-   media stream</span> is associated with.</p></li>
+   interface, with the name <code
+   title="event-message">message</code>, which does not bubble, is not
+   cancelable, has no default action, and has a <code
+   title="dom-MessageEvent-data">data</code> attribute whose value is
+   <var title="">message</var>, and <span>queue a task</span> to
+   dispatch the event at the <code>PeerConnection</code> object
+   responsible for this side of the <span>data UDP media
+   stream</span>.</p></li>
 
   </ol>
 
+  <p>A <dfn>remotely-initiated data UDP media stream</dfn> is the
+  first "sendrecv" media stream in the initial offer whose media is
+  "<code title="">application</code>", whose transport protocol is
+  "<code title="">udp</code>", whose media format description is
+  "<code>application/html-peer-conection-data</code>", and whose label
+  attribute ("<code title="">a=label:</code>") has the value "<code
+  title="">data</code>".</p>
+
   <p>The <span>task source</span> for this <span
   title="concept-task">task</span> is the <span>networking task
   source</span>.</p>




More information about the Commit-Watchers mailing list