The method provides a remote candidate to the ICE Agent. In addition to being added to the remote description, connectivity checks will be sent to the new candidates as long as the ICE Transports setting is not set to none . This call will result in a change to the connection state of the ICE Agent, and may result in a change to media state if it results in different connectivity being established. Let p be a new promise. If this RTCPeerConnection object's signaling state is closed , the user agent MUST reject p with InvalidStateError , and jump to the step labeled Return. If the candidate parameter is malformed, reject p with SyntaxError and jump to the step labeled Return. If the candidate could not be successfully applied, reject p with a DOMError object whose name attribute has the value TBD (TODO InvalidCandidate and InvalidMidIndex) and jump to the step labeled Return. If the candidate is successfully applied, resolve p with undefined . Return: Return p . Note What errors do we need here? Should we reuse the *SessionDescriptionError names or invent new ones for candidates? Should this method be queued? Parameter Type Nullable Optional Description candidate RTCIceCandidate ✘ ✘ Return type: Promise<void>

addStream

Adds a new stream to the RTCPeerConnection. When the addStream() method is invoked, the user agent MUST run the following steps: Let connection be the RTCPeerConnection object on which the MediaStream , stream , is to be added. If connection 's RTCPeerConnection signalingState is closed , throw an InvalidStateError exception and abort these steps. If stream is already in connection 's local streams set, then abort these steps. Add stream to connection 's local streams set. A stream could have contents that are inaccessible to the application. This can be due to being marked with a peerIdentity option or anything that would make a stream CORS cross-origin. These streams can be added to the local streams set but content MUST NOT be transmitted, though streams marked with peerIdentity can be transmitted if they meet the requirements for sending (see Isolated Streams). All other streams that are not accessible to the application MUST NOT be sent to the peer, with silence (audio), black frames (video) or equivalently absent content being sent in place of stream content. Note that this property can change over time. If connection 's RTCPeerConnection signalingState is stable , then fire a negotiationneeded event at connection . Parameter Type Nullable Optional Description stream MediaStream ✘ ✘ Return type: void

close

When the RTCPeerConnection close() method is invoked, the user agent MUST run the following steps: If the RTCPeerConnection object's RTCPeerConnection signalingState is closed , abort these steps. Destroy the RTCPeerConnection ICE Agent, abruptly ending any active ICE processing and any active streaming, and releasing any relevant resources (e.g. TURN permissions). Set the object's RTCPeerConnection signalingState to closed . No parameters. Return type: void

createAnswer

The createAnswer method generates an [ SDP ] answer with the supported configuration for the session that is compatible with the parameters in the remote configuration. Like createOffer, the returned blob contains descriptions of the local MediaStreams attached to this RTCPeerConnection, the codec/RTP/RTCP options negotiated for this session, and any candidates that have been gathered by the ICE Agent. The options parameter may be supplied to provide additional control over the generated answer. As an answer, the generated SDP will contain a specific configuration that, along with the corresponding offer, specifies how the media plane should be established. The generation of the SDP must follow the appropriate process for generating an answer. Session descriptions generated by createAnswer must be immediately usable by setLocalDescription without causing an error as long as setLocalDescription is called reasonably soon. Like createOffer, the returned description should reflect the current state of the system. The session descriptions MUST remain usable by setLocalDescription without causing an error until at least the end of the fulfillment callback of the returned promise. Calling this method is needed to get the ICE user name fragment and password. An answer can be marked as provisional, as described in [ RTCWEB-JSEP ], by setting the type to "pranswer" . If the RTCPeerConnection is configured to generate Identity assertions, then the session description SHALL contain an appropriate assertion. If this RTCPeerConnection object is closed before the SDP generation process completes, the USER agent MUST suppress the result and not resolve or reject the returned promise. If the SDP generation process completed successfully, the user agent MUST resolve the returned promise with a newly created RTCSessionDescription object, representing the generated answer. If the SDP generation process failed for any reason, the user agent MUST reject the returned promise with a DOMError object of type TBD. No parameters. Promise< RTCSessionDescription > Return type:

createOffer

The createOffer method generates a blob of SDP that contains an RFC 3264 offer with the supported configurations for the session, including descriptions of the local MediaStream s attached to this RTCPeerConnection , the codec/RTP/RTCP options supported by this implementation, and any candidates that have been gathered by the ICE Agent. The options parameter may be supplied to provide additional control over the offer generated. As an offer, the generated SDP will contain the full set of capabilities supported by the session (as opposed to an answer, which will include only a specific negotiated subset to use); for each SDP line, the generation of the SDP must follow the appropriate process for generating an offer. In the event createOffer is called after the session is established, createOffer will generate an offer that is compatible with the current session, incorporating any changes that have been made to the session since the last complete offer-answer exchange, such as addition or removal of streams. If no changes have been made, the offer will include the capabilities of the current local description as well as any additional capabilities that could be negotiated in an updated offer. Session descriptions generated by createOffer MUST be immediately usable by setLocalDescription without causing an error as long as setLocalDescription is called reasonably soon. If a system has limited resources (e.g. a finite number of decoders), createOffer needs to return an offer that reflects the current state of the system, so that setLocalDescription will succeed when it attempts to acquire those resources. The session descriptions MUST remain usable by setLocalDescription without causing an error until at least the end of the fulfillment callback of the returned promise. Calling this method is needed to get the ICE user name fragment and password. If the RTCPeerConnection is configured to generate Identity assertions, then the session description SHALL contain an appropriate assertion. If this RTCPeerConnection object is closed before the SDP generation process completes, the USER agent MUST suppress the result and not resolve or reject the returned promise. If the SDP generation process completed successfully, the user agent MUST resolve the returned promise with a newly created RTCSessionDescription object, representing the generated offer. If the SDP generation process failed for any reason, the user agent MUST reject the returned promise with an DOMError object of type TBD as its argument. To Do: Discuss privacy aspects of this from a fingerprinting point of view - it's probably around as bad as access to a canvas :-) Parameter Type Nullable Optional Description options RTCOfferOptions ✘ ✔ Promise< RTCSessionDescription > Return type:

getConfiguration

Returns a RTCConfiguration object representing the current configuration of this RTCPeerConnection object. When this method is call, the user agent MUST construct new RTCConfiguration object to be returned, and initialize it using the ICE Agent's ICE transports setting and ICE servers list. No parameters. RTCConfiguration Return type:

getLocalStreams

Returns a sequence of MediaStream objects representing the streams that are currently sent with this RTCPeerConnection object. The getLocalStreams() method MUST return a new sequence that represents a snapshot of all the MediaStream objects in this RTCPeerConnection object's local streams set. The conversion from the streams set to the sequence, to be returned, is user agent defined and the order does not have to stable between calls. No parameters. sequence<MediaStream> Return type:

getRemoteStreams

Returns a sequence of MediaStream objects representing the streams that are currently received with this RTCPeerConnection object. The getRemoteStreams() method MUST return a new sequence that represents a snapshot of all the MediaStream objects in this RTCPeerConnection object's remote streams set. The conversion from the streams set to the sequence, to be returned, is user agent defined and the order does not have to stable between calls. No parameters. sequence<MediaStream> Return type:

getStreamById

If a MediaStream object, with an id equal to streamId , exists in this RTCPeerConnection object's stream sets (local streams set or remote streams set), then the getStreamById() method MUST return that MediaStream object. The method MUST return null if no stream matches the streamId argument. Note For this method to make sense, we need to make sure that ids are unique within the two stream sets of a RTCPeerConnection. This is not the case today when a peer re-adds a stream that is received. Two different stream instances will now have the same id at both peers; one in the remote stream set and one in the local stream set. One way to resolve this is to not allow re-adding a stream instance that is received (guard on id). If an application really needs this functionality it's really easy to make a clone of the stream, which will give it a new id, and send the clone. Parameter Type Nullable Optional Description streamId DOMString ✘ ✘ MediaStream , nullable Return type:, nullable

removeStream

Removes the given stream from the RTCPeerConnection . When the other peer stops sending a stream in this manner, a removestream event is fired at the RTCPeerConnection object. When the removeStream() method is invoked, the user agent MUST run the following steps: Let connection be the RTCPeerConnection object on which the MediaStream , stream , is to be removed. If connection 's RTCPeerConnection signalingState is closed , throw an InvalidStateError exception. If stream is not in connection 's local streams set, then abort these steps. Remove stream from connection 's local streams set. If connection 's RTCPeerConnection signalingState is stable , then fire a negotiationneeded event at connection . Parameter Type Nullable Optional Description stream MediaStream ✘ ✘ Return type: void

setLocalDescription

The setLocalDescription() method instructs the RTCPeerConnection to apply the supplied RTCSessionDescription as the local description. This API changes the local media state. In order to successfully handle scenarios where the application wants to offer to change from one media format to a different, incompatible format, the RTCPeerConnection must be able to simultaneously support use of both the old and new local descriptions (e.g. support codecs that exist in both descriptions) until a final answer is received, at which point the RTCPeerConnection can fully adopt the new local description, or rollback to the old description if the remote side denied the change. Issue 1 ISSUE: how to indicate to rollback? To Do: specify what parts of the SDP can be changed between the createOffer and setLocalDescription The following list describes the processing model for setting a new RTCSessionDescription . When the method is invoked, the user agent MUST run the following steps: Let p be a new promise. If this RTCPeerConnection object's signaling state is closed , the user agent MUST reject p with InvalidStateError , and jump to the step labeled Return. If a local description contains a different set of ICE credentials, then the ICE Agent MUST trigger an ICE restart. When ICE restarts, the gathering state will be changed back to "gathering", if it was not already gathering. If the RTCPeerConnection ice connection state was "completed", it will be changed back to "connected". The user agent must start the process to apply the RTCSessionDescription argument. Return: Return p .

If the process to apply the RTCSessionDescription argument fails for any reason, then user agent must queue a task runs the following steps: Let connection be the RTCPeerConnection object on with this method was invoked. If connection 's signaling state is closed , then abort these steps. If the reason for the failure is: The content of the RTCSessionDescription argument is invalid or the type is wrong for the current signaling state of connection . Let reason be InvalidSessionDescriptionError . The RTCSessionDescription is a valid description but cannot be applied at the media layer. TODO ISSUE - next few points are probably wrong. Make sure to check this in setRemote too. This can happen, e.g., if there are insufficient resources to apply the SDP. The user agent MUST then rollback as necessary if the new description was partially applied when the failure occurred. If rollback was not necessary or was completed successfully, let reason be IncompatibleSessionDescriptionError . If rollback was not possible, let reason be InternalError and set connection 's signaling state to closed . Reject p with reason .

If the RTCSessionDescription argument is applied successfully, then user agent must queue a task runs the following steps: Let connection be the RTCPeerConnection object on with this method was invoked. If connection 's signaling state is closed , then abort these steps. Set connection 's description attribute ( localDescription or remoteDescription depending on the setting operation) to the RTCSessionDescription argument. If the local description was set, connection 's ice gathering state is new , and the local description contains media, then set connection 's ice gathering state to gathering . If the local description was set with content that caused an ICE restart, then set connection 's ice gathering state to gathering . Set connection 's signalingState accordingly. If connection 's signalingState changed, fire a simple event named signalingstatechange at connection . Resolve p with undefined .

Parameter Type Nullable Optional Description description RTCSessionDescription ✘ ✘ Return type: Promise<void>

setRemoteDescription