Initial Author of this Specification was Ian Hickson, Google Inc., with the following copyright statement:
 © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA. You are granted a license to use, reproduce and create derivative works of this document.
All subsequent changes since 26 July 2011 done by the W3C WebRTC Working Group are under the following Copyright:
© 2011-2016 W3C® (MIT, ERCIM, Keio, Beihang). Document use rules apply.
For the entire publication on the W3C site the liability and trademark rules apply.
This document defines a set of ECMAScript APIs in WebIDL to allow media to be sent to and received from another browser or device implementing the appropriate set of real-time protocols. This specification is being developed in conjunction with a protocol specification developed by the IETF RTCWEB group and an API specification to get access to local media devices developed by the Media Capture Task Force.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.
The Editors and active contributors of WebRTC 1.0 intend to publish a Candidate Recommendation soon. Consequently, this is a Request for Comments by the WebRTC Working Group to seek wide review of this document.
The API is based on preliminary work done in the WHATWG.
This document was published by the Web Real-Time Communications Working Group as a Working Draft. This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to public-webrtc@w3.org (subscribe, archives). All comments are welcome.
Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 1 March 2017 W3C Process Document.
This section is non-normative.
There are a number of facets to video-conferencing in HTML covered by this specification:
This document defines the APIs used for these features. This specification is being developed in conjunction with a protocol specification developed by the IETF RTCWEB group and an API specification to get access to local media devices [GETUSERMEDIA] developed by the Media Capture Task Force. An overview of the system can be found in [ RTCWEB-OVERVIEW] and [RTCWEB-SECURITY].
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, MUST NOT, SHALL, and SHOULD are to be interpreted as described in [RFC2119].
This specification defines conformance criteria that apply to a single product: the user agent that implements the interfaces that it contains.
Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be easy to follow, and not intended to be performant.)
Implementations that use ECMAScript to implement the APIs defined in this specification MUST implement them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification [WEBIDL-1], as this specification uses that specification and terminology.
The EventHandler interface, representing a callback used for event handlers, and the
      
    ErrorEvent interface are defined in [HTML5].
The concepts queue a task, fire a simple event and networking task source are defined in [HTML5].
The terms event, event handlers and event handler event types are defined in [HTML5].
The terms MediaStream, MediaStreamTrack, and
      MediaStreamConstraints are defined in [GETUSERMEDIA].
The term Blob is defined in [FILEAPI].
The term media description is defined in [RFC4566].
The term generation is defined in [TRICKLE-ICE] Section 2.
When referring to exceptions, the terms throw and create are defined in [WEBIDL-1].
An RTCPeerConnection
        RTCPeerConnection
        XMLHttpRequest [XMLHttpRequest] or Web Sockets [
        WEBSOCKETS-API].
The RTCConfiguration defines a set of parameters to configure how the peer-to-peer communication established via
          RTCPeerConnection
          
dictionary RTCConfiguration {
    sequence<RTCIceServer>   iceServers;
    RTCIceTransportPolicy    iceTransportPolicy = "all";
    RTCBundlePolicy          bundlePolicy = "balanced";
    RTCRtcpMuxPolicy         rtcpMuxPolicy = "require";
    DOMString                peerIdentity;
    sequence<RTCCertificate> certificates;
    [EnforceRange]
    octet                    iceCandidatePoolSize = 0;
};
          RTCConfiguration MembersiceServers of type sequence<RTCIceServer>An array of objects describing servers available to be used by ICE, such as STUN and TURN servers.
iceTransportPolicy of type
              RTCIceTransportPolicy,
              defaulting to "all"Indicates which candidates the ICE Agent is allowed to use.
bundlePolicy of type RTCBundlePolicy, defaulting to
              "balanced"Indicates which media-bundling policy to use when gathering ICE candidates.
rtcpMuxPolicy of type RTCRtcpMuxPolicy, defaulting to
              "require"Indicates which rtcp-mux policy to use when gathering ICE candidates.
peerIdentity of type DOMStringSets the target peer identity for the
                  RTCPeerConnection. The RTCPeerConnection will not establish a connection to a remote peer unless it can be successfully authenticated with the provided name.
certificates of type sequence<RTCCertificate>A set of certificates that the
                  RTCPeerConnection
Valid values for this parameter are created through calls to the generateCertificate
Although any given DTLS connection will use only one certificate, this attribute allows the caller to provide multiple certificates that support different algorithms. The final certificate will be selected based on the DTLS handshake, which establishes which certificates are allowed. The
                  RTCPeerConnection implementation selects which of the certificates is used for a given connection; how certificates are selected is outside the scope of this specification.
                
If this value is absent, then a default set of certificates is generated for each RTCPeerConnection
This option allows applications to establish key continuity. An RTCCertificate can be persisted in [
                  INDEXEDDB] and reused. Persistence and reuse also avoids the cost of key generation.
The value for this configuration option cannot change after its value is initially selected.
iceCandidatePoolSize of type
              octet, defaulting to
              0Size of the prefetched ICE pool as defined in [JSEP] (section 3.5.4. and section 4.1.1.).
RTCIceCredentialType Enum
        enum RTCIceCredentialType {
    "password",
    "oauth"
};
          | Enumeration description | |
|---|---|
| password | The credential is a long-term authentication username and password, as described in [RFC5389], Section 10.2. | 
| oauth | An OAuth 2.0 based authentication method, as described in [ RFC7635]. It uses the OAuth 2.0 Implicit Grant type, with PoP (Proof-of-Possession) Token type, as described in [ RFC6749] and [OAUTH-POP-KEY-DISTRIBUTION]. The OAuth Client and the Auhorization Server roles are defined in [RFC6749] Section 1.1. 
                    If [RFC7635] is used in the WebRTC context then the OAuth
                Client is responsible for refreshing the credential information, and updating the ICE Agent with fresh new credentials before the  For OAuth Authentication, the ICE Agent requires three pieces of credential information. The credential is composed of a  The [OAUTH-POP-KEY-DISTRIBUTION] defines alg parameter in Section 4.1 and 6. and describes that if the Authorization Server doesn't have prior knowledge of the capabilities of the client, then the OAuth Client needs to provide information about the ICE Agent HMAC alg capabilities. This information helps the Authorization Server to generate the approriate HMAC key. The HMAC alg defines the input key length, and HMAC algorithm Familly (e.g. SHA), and HMAC algorithm type (e.g. symmetric/asymmetric). The OAuth Client sends an  However, this specification uses a simplified alg approach. The length of the HMAC key ( Note [RFC7635] doesn't explicitly define how keys are shortened; there is only a brief reference to this in Appendix B. This needs to be adressed in the IETF TRAM working group.
                     Note According to [RFC7635] Section 4.1, the HMAC key MUST be a symmetric key.
                     Currently the STUN/TURN protocols use only SHA-1 and SHA-2 family hash algorithms for Message Integrity Protection, as defined in [RFC5389] Section 15.4, and [STUN-BIS] Section 14.6. When [RFC7635] is used in WebRTC context, this specification adds the following additional consideration to it. The OAuth Client SHOULD obtain the mac_key by requesting an alg value of  
 
 More details about OAuth PoP Client can be found in [ OAUTH-POP-KEY-DISTRIBUTION] Section 4. 
                    More details about  | 
RTCOAuthCredential Dictionary
        The RTCOAuthCredential dictionary is used to describe the OAuth auth credential information which is used by the STUN/TURN client (inside the ICE Agent) to authenticate against a STUN/TURN server, as described in [RFC7635]. Note that the kid parameter is not located in this dictionary, but in
          RTCIceServer's username member.
        
dictionary RTCOAuthCredential {
    required DOMString macKey;
    required DOMString accessToken;
};
          RTCOAuthCredential Members
            macKey of type DOMString, requiredThe "mac_key", as described in [RFC7635], Section 6.2, in a base64-url encoded format. It is used in STUN message integrity hash calculation (as the password is used in password based authentication). Note that the OAuth response "key" parameter is a JSON Web Key (JWK) or a JWK encrypted with a JWE format. Also note that this is the only OAuth parameter whose value is not used directly, but must be extracted from the "k" parameter value from the JWK, which contains the needed base64-encoded "mac_key".
accessToken of type DOMString, requiredThe "access_token", as described in [RFC7635], Section 6.2, in a base64-encoded format. This is an encrypted self-contained token that is opaque to the application. Authenticated encryption is used for message encryption and integrity protection. The access token contains a non-encrypted nonce value, which is used by the Authorization Server for unique mac_key generation. The second part of the token is protected by Authenticated Encryption. It contains the mac_key, a timestamp and a lifetime. The timestamp combined with lifetime provides expiry information; this information describes the time window during which the token credential is valid and accepted by the TURN server.
An example of an RTCOAuthCredential dictionary is:
{
    "macKey": "WmtzanB3ZW9peFhtdm42NzUzNG0=",
    "accessToken": "AAwg3kPHWPfvk9bDFL936wYvkoctMADzQ5VhNDgeMR3+ZlZ35byg972fW8QjpEl7bx91YLBPFsIhsxloWcXPhA=="
}
        RTCIceServer Dictionary
        The RTCIceServer dictionary is used to describe the STUN and TURN servers that can be used by the ICE Agent to establish a connection with a peer.
dictionary RTCIceServer {
    required (DOMString or sequence<DOMString>) urls;
             DOMString                          username;
             (DOMString or RTCOAuthCredential)  credential;
             RTCIceCredentialType               credentialType = "password";
};
          RTCIceServer Membersurls of type (DOMString or
              sequence<DOMString>), requiredSTUN or TURN URI(s) as defined in [RFC7064] and [ RFC7065] or other URI types.
username of type DOMStringIf this RTCIceServer
                  credentialType is
                  "password", then this attribute specifies the username to use with that TURN server.
If this RTCIceServer
                  credentialType is
                  "oauth", then this attribute specifies the Key ID (kid) of the shared symmetric key, which is shared between the TURN server and the Authorization Server, as described in [!RFC7635]]. It is an ephemeral and unique key identifier. The kid allows the TURN server to select the appropriate keying material for decryption of the Access-Token, so the key identified by this kid is used in the Authenticated Encryption of the "access_token". The
                  kid value is equal with the OAuth response "kid" parameter, as defined in [RFC7515] Section 4.1.4.
                
credential of type (DOMString or RTCOAuthCredential)
              If this RTCIceServer
                  
If credentialType is "password",
                  credential is a DOMString, and represents a long-term authentication password, as described in [
                  RFC5389], Section 10.2.
If credentialType is "oauth",
                  credential is a RTCOAuthCredential, which contains the OAuth access token and MAC key.
credentialType of type RTCIceCredentialType, defaulting to
              "password"If this RTCIceServer
                  
An example array of RTCIceServer objects is:
[
     { "urls": "stun:stun1.example.net" },
     { "urls": ["turns:turn.example.org", "turn:turn.example.net"],
       "username": "user",
       "credential": "myPassword",
       "credentialType": "password" },
     { "urls": "turns:turn2.example.net",
       "username": "22BIjxU93h/IgwEb",
       "credential": {
                       "macKey": "WmtzanB3ZW9peFhtdm42NzUzNG0=",
                       "accessToken": "AAwg3kPHWPfvk9bDFL936wYvkoctMADzQ5VhNDgeMR3+ZlZ35byg972fW8QjpEl7bx91YLBPFsIhsxloWcXPhA=="
                     },
       "credentialType": "oauth" },
     }
]
        RTCIceTransportPolicy Enum
        As noted in [JSEP] (section 4.1.1.), if the
          iceTransportPolicy member of the RTCConfiguration is specified, it defines the
          ICE candidate policy
        [JSEP] (section 3.5.3.) the browser uses to surface the permitted candidates to the application; only these candidates will be used for connectivity checks.
        
enum RTCIceTransportPolicy {
    "relay",
    "all"
};
          | Enumeration description | |
|---|---|
| relay | The ICE Agent MUST only use media relay candidates such as candidates passing through a TURN server. Note 
                      This can be used to prevent the remote endpoint from learning the user's IP addresses, which may be desired in certain use cases. For example, in a "call"-based application, the application may want to prevent an unknown caller from learning the callee's IP addresses until the callee has consented in some way.
                     | 
| all | The ICE Agent MAY use any type of candidate when this value is specified. Note 
                      The implementation may still use its own candidate filtering policy in order to limit the IP addresses exposed to the application, as noted in the description of
                       RTCIceCandidate.. | 
RTCBundlePolicy Enum
        As described in [JSEP] (section 4.1.1.), bundle policy affects which media tracks are negotiated if the remote endpoint is not bundle-aware, and what ICE candidates are gathered. If the remote endpoint is bundle-aware, all media tracks and data channels are bundled onto the same transport.
enum RTCBundlePolicy {
    "balanced",
    "max-compat",
    "max-bundle"
};
          | Enumeration description (non-normative) | |
|---|---|
| balanced | Gather ICE candidates for each media type in use (audio, video, and data). If the remote endpoint is not bundle-aware, negotiate only one audio and video track on separate transports. | 
| max-compat | Gather ICE candidates for each track. If the remote endpoint is not bundle-aware, negotiate all media tracks on separate transports. | 
| max-bundle | Gather ICE candidates for only one track. If the remote endpoint is not bundle-aware, negotiate only one media track. | 
RTCRtcpMuxPolicy Enum
        As described in [JSEP] (section 4.1.1.), the RtcpMuxPolicy affects what ICE candidates are gathered to support non-multiplexed RTCP.
enum RTCRtcpMuxPolicy {
    // At risk due to lack of implementers' interest.
    "negotiate",
    "require"
};
          | Enumeration description (non-normative) | |
|---|---|
| negotiate | Gather ICE candidates for both RTP and RTCP candidates. If the remote-endpoint is capable of multiplexing RTCP, multiplex RTCP on the RTP candidates. If it is not, use both the RTP and RTCP candidates separately. Note that, as stated in [JSEP] (section 4.1.1.), the user agent
                  MAY not implement non-multiplexed RTCP, in which case it will reject attempts to construct an RTCPeerConnectionwith thenegotiatepolicy. | 
| require | Gather ICE candidates only for RTP and multiplex RTCP on the RTP candidates. If the remote endpoint is not capable of rtcp-mux, session negotiation will fail. | 
Aspects of this specification supporting non-multiplexed RTP/RTCP are marked as features at risk, since there is no clear commitment from implementers. This includes:
negotiate, since there is no clear commitment from implementers for the behavior associated with this.rtcpTransport attribute within the
                  RTCRtpSender
                  RTCRtpReceiver
                  These dictionaries describe the options that can be used to control the offer/answer creation process.
dictionary RTCOfferAnswerOptions {
    boolean voiceActivityDetection = true;
};
          RTCOfferAnswerOptions
            MembersvoiceActivityDetection of type
              boolean, defaulting to
              trueMany codecs and systems are capable of detecting "silence" and changing their behavior in this case by doing things such as not transmitting any media. In many cases, such as when dealing with emergency calling or sounds other than spoken voice, it is desirable to be able to turn off this behavior. This option allows the application to provide information about whether it wishes this type of processing enabled or disabled.
dictionary RTCOfferOptions : RTCOfferAnswerOptions {
    boolean iceRestart = false;
};
          RTCOfferOptions MembersiceRestart of type boolean, defaulting to
              falseWhen the value of this dictionary member is true, the generated description will have ICE credentials that are different from the current credentials (as visible in the
                  localDescription
                  
When the value of this dictionary member is false, and the
                  localDescription
                  localDescription
                  
The RTCAnswerOptions dictionary describe options specific to session description of type answer (none in this version of the specification).
dictionary RTCAnswerOptions : RTCOfferAnswerOptions {
};
        The [JSEP] specification, as a whole, describes the details of how the RTCPeerConnection
        
Calling new  creates an RTCPeerConnection(configuration)
          RTCPeerConnection
          
configuration.servers contains information used to find and access the servers used by ICE. The application can supply multiple servers of each type, and any TURN server MAY also be used as a STUN server for the purposes of gathering server reflexive candidates.
        
An RTCPeerConnection
          
The ICE protocol implementation of an RTCPeerConnection
          RTCPeerConnection
          addIceCandidate
          setConfiguration
          setLocalDescription
          setRemoteDescription
          close
          RTCIceTransport
          
When the RTCPeerConnection() constructor is invoked, the user agent MUST run the following steps:
Let connection be a newly created
              RTCPeerConnection
              
If the certificates value in
              configuration is non-empty, check that the expires on each value is in the future. If a certificate has expired, throw an
              InvalidAccessError; otherwise, store the certificates. If no certificates value was specified, one or more new RTCCertificate instances are generated for use with this RTCPeerConnection instance. This MAY happen asynchronously and the value of certificates remains undefined for the subsequent steps.
If configuration. is
              rtcpMuxPolicy
              negotiate, and the user agent does not implement non-muxed RTCP, throw a NotSupportedError.
Initialize connection's ICE Agent.
Set the configuration specified by configuration.
Let connection have an [[isClosed]] internal slot, initialized to false.
Let connection have a [[needNegotiation]] internal slot, initialized to false.
Let connection have an [[sctpTransport]] internal slot, initialized to null.
Let connection have an [[operations]] internal slot, representing an operations queue, initialized to an empty list.
Set connection's signaling state to
              stable.
Set connection's ICE connection state to
              new.
Set connection's ICE gathering state to
              new.
Set connection's connection state to
              new.
Set connection's pendingLocalDescription
              currentLocalDescription
              pendingRemoteDescription
              currentRemoteDescription
              
Return connection.
An RTCPeerConnection
          
To enqueue an operation, run the following steps:
Let connection be the current
              RTCPeerConnection
              
If connection's [[isClosed]] slot is
              true, return a promise rejected with a newly
              created
              InvalidStateError.
Let operation be the operation to be enqueued.
Let p be a new promise.
Append operation to [[operations]].
If the length of [[operations]] is exactly 1, execute operation.
Upon fulfillment or rejection of the promise returned by the operation, run the following steps:
If connection's [[isClosed]] slot is
                  true, abort these steps.
If the promise returned by operation was fulfilled with a value, fulfill p with that value.
If the promise returned by operation was rejected with a value, reject p with that value.
Upon fulfillment or rejection of p, execute the following steps:
If connection's [[isClosed]] slot is
                      true, abort these steps.
Remove the first element of [[operations]].
If [[operations]] is non-empty, execute the operation represented by the first element of [[ operations]].
Return p.
An RTCPeerConnection
          RTCDtlsTransport
          RTCIceTransport
          true, the user agent MUST
          update the connection state by queueing a task that runs the following steps:
Let connection be this
              RTCPeerConnection
              
Let newState be the value of deriving a new state value as described by the
              RTCPeerConnectionState
If connection's connection state is equal to newState, abort these steps.
Let connection's connection state be newState.
Fire a simple event named
              connectionstatechange
              
To update the ICE gathering
        state of an RTCPeerConnection
          
If connection's [[isClosed]] slot is
              true, abort these steps.
Let newState be the value of deriving a new state value as described by the RTCIceGatheringState
If connection's ICE gathering state is equal to newState, abort these steps.
Set connection's ice gathering state to newState.
Fire a simple event named
              icegatheringstatechange
              
If newState is completed, fire an event named icecandidate
              null at
              connection.
To update the ICE
        connection state of an RTCPeerConnection
          
If connection's [[isClosed]] slot is
              true, abort these steps.
Let newState be the value of deriving a new state value as described by the RTCIceConnectionState
If connection's ICE connection state is equal to newState, abort these steps.
Set connection's ice connection state to newState.
Fire a simple event named
              iceconnectionstatechange
              
To set an RTCSessionDescription
          description on an RTCPeerConnection
          
Let p be a new promise.
In parallel, start the process to apply description as described in [JSEP] (section 5.5. and section 5.6.).
If the process to apply description fails for any reason, then user agent MUST queue a task runs the following steps:
If connection's [[isClosed]] slot is
                      true, then abort these steps.
If elements of the SDP were modified, then reject
                      p with a newly
                      created
                      InvalidModificationError and abort these steps.
If the description's type
                      InvalidStateError and abort these steps.
If the content of description is not valid SDP syntax, then reject p with an
                      RTCError (with errorDetail set to "sdp-syntax-error" and the sdpLineNumber attribute set to the line number in the SDP where the syntax error was detected) and abort these steps.
If the content of description is invalid, then reject p with a newly
                      created
                      InvalidAccessError and abort these steps.
For all other errors, for example if
                      description cannot be applied at the media layer, reject p with a newly
                      created
                      OperationError.
If description is applied successfully, the user agent MUST queue a task that runs the following steps:
If connection's [[isClosed]] slot is
                      true, then abort these steps.
If description is set as a local description, then run one of the following steps:
If description is of type "offer", set
                          connection.
                          to description and signaling state to
                          pendingLocalDescription
                          have-local-offer.
If description is of type "answer", then this completes an offer answer negotiation. Set
                          connection's currentLocalDescription
                          currentRemoteDescription
                          pendingRemoteDescription
                          pendingRemoteDescription
                          pendingLocalDescription
                          stable
If description is of type "rollback", then this is a rollback. Set
                          connection.
                          to null and signaling state to
                          pendingLocalDescription
                          stable.
If description is of type "pranswer", then set connection.
                          to description and signaling state to
                          pendingLocalDescription
                          have-local-pranswer.
Otherwise, if description is set as a remote description, then run one of the following steps:
If description is of type "offer", set
                          connection.
                          attribute to description and signaling
                        state to pendingRemoteDescription
                          have-remote-offer.
If description is of type "answer", then this completes an offer answer negotiation. Set
                          connection's currentRemoteDescription
                          currentLocalDescription
                          pendingLocalDescription
                          pendingRemoteDescription
                          pendingLocalDescription
                          stable
If description is of type "rollback", then this is a rollback. Set
                          connection.
                          to null and signaling state to
                          pendingRemoteDescription
                          stable.
If description is of type "pranswer", then set connection.
                          to description and signaling state to
                          pendingRemoteDescription
                          have-remote-pranswer.
If connection's signaling state changed above, fire a simple event named
                      signalingstatechange
                      
If description is of type "answer", and it initiates the closure of an existing SCTP association, as defined in [SCTP-SDP], Sections 10.3 and 10.4, set the value of connection's [[
                      sctpTransport]] internal slot to
                      null.
If description is of type "answer" or "pranswer", then run the following steps:
If description initiates the establishment of a new SCTP association, as defined in [
                          SCTP-SDP], Sections 10.3 and 10.4, set the value of
                          connection's [[
                          sctpTransport]] internal slot to a newly created
                          RTCSctpTransport
                          
If description negotiates the DTLS role of the SCTP transport, and there is an
                          RTCDataChannel
                          null
                          id
                          
Let channel be the
                              RTCDataChannel
                              
Set channel's readyState
                              closed.
Fire an event named error
                              ResourceInUse exception at
                              channel.
Fire a simple event named close
                              
If description is set as a local description, then run the following steps for each media description in description that is not yet associated with an RTCRtpTransceiver
                      
Let transceiver be the 
                         used to create the media description.RTCRtpTransceiver
                          
Set transceiver's mid
                          
If description is set as a remote description, then run the following steps for each media description in description:
As described by [JSEP] (section 5.9.), attempt to find an existing RTCRtpTransceiver
                          
If no suitable transceiver is found (transceiver is unset), run the following steps:
Create an RTCRtpSender, sender, from the media description.
Create an RTCRtpReceiver, receiver, from the media description.
Create an RTCRtpTransceiver with sender and receiver, and let transceiver be the result.
Set transceiver's mid
                          
If the direction of the media description is
                          sendrecv or sendonly, and
                          transceiver.receiver.track has not yet been fired in a track
                        
                          
If the media description is rejected, and transceiver is not already stopped, stop the RTCRtpTransceiver transceiver.
If description is of type "rollback", then run the following steps:
If the mid
                          RTCRtpTransceiver
                          RTCSessionDescription
                          mid
                          
If an RTCRtpTransceiver
                          RTCSessionDescription
                          addTrack, remove that transceiver from connection's set of transceivers, as described by [JSEP] (section 4.1.8.2.).
Restore the value of connection's [[
                          sctpTransport]] internal slot to its value at the last stable
                          signaling state.
If connection's signaling state is now
                      stable, update the negotiation-needed
                    flag. If connection's [[
                      needNegotiation]] slot was true both before and after this update, queue a task that runs the following steps:
If connection's [[isClosed]] slot is true, abort these steps.
If connection's [[needNegotiation]] slot is false, abort these steps.
Fire a simple event named negotiationneeded at connection.
Resolve p with undefined.
Return p.
The task source for the tasks listed in this section is the networking task source.
The RTCPeerConnection
          MediaStreamTrack
          
[Constructor(optional RTCConfiguration configuration)]
interface RTCPeerConnection : EventTarget {
    Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options);
    Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options);
    Promise<void>                      setLocalDescription(RTCSessionDescriptionInit description);
    readonly attribute RTCSessionDescription? localDescription;
    readonly attribute RTCSessionDescription? currentLocalDescription;
    readonly attribute RTCSessionDescription? pendingLocalDescription;
    Promise<void>                      setRemoteDescription(RTCSessionDescriptionInit description);
    readonly attribute RTCSessionDescription? remoteDescription;
    readonly attribute RTCSessionDescription? currentRemoteDescription;
    readonly attribute RTCSessionDescription? pendingRemoteDescription;
    Promise<void>                      addIceCandidate((RTCIceCandidateInit or RTCIceCandidate) candidate);
    readonly attribute RTCSignalingState      signalingState;
    readonly attribute RTCIceGatheringState   iceGatheringState;
    readonly attribute RTCIceConnectionState  iceConnectionState;
    readonly attribute RTCPeerConnectionState connectionState;
    readonly attribute boolean?               canTrickleIceCandidates;
    static sequence<RTCIceServer>      getDefaultIceServers();
    RTCConfiguration                   getConfiguration();
    void                               setConfiguration(RTCConfiguration configuration);
    void                               close();
             attribute EventHandler           onnegotiationneeded;
             attribute EventHandler           onicecandidate;
             attribute EventHandler           onicecandidateerror;
             attribute EventHandler           onsignalingstatechange;
             attribute EventHandler           oniceconnectionstatechange;
             attribute EventHandler           onicegatheringstatechange;
             attribute EventHandler           onconnectionstatechange;
             attribute EventHandler           onfingerprintfailure;
};
          RTCPeerConnectionRTCPeerConnection
                constructor algorithm.
                | Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| configuration | RTCConfiguration | ✘ | ✔ | 
localDescription of type RTCSessionDescription, readonly,
              nullableThe localDescription attribute MUST return pendingLocalDescription
                  currentLocalDescription
                  
currentLocalDescription of type RTCSessionDescription, readonly,
              nullableThe currentLocalDescription
                  RTCSessionDescription
                  RTCPeerConnection transitioned into the stable state plus any local candidates that have been generated by the ICE Agent since the offer or answer was created.
The currentLocalDescription attribute MUST return the last value that algorithms in this specification set it to, complete with any local candidates that have been generated by the ICE Agent since the offer or answer was created. Prior to being set, it returns null. Note that the value of
                  currentLocalDescription.sdp need not match the value of localDescription.sdp.
pendingLocalDescription of type RTCSessionDescription, readonly,
              nullableThe pendingLocalDescription
                  RTCSessionDescription
                  RTCPeerConnection is in the stable state, the value is null. This attribute is updated by setLocalDescription
                  
The pendingLocalDescription attribute MUST return the last value that algorithms in this specification set it to, complete with any local candidates that have been generated by the ICE Agent since the offer or answer was created. Prior to being set, it returns null.
                
remoteDescription of type RTCSessionDescription, readonly,
              nullableThe remoteDescription attribute MUST return pendingRemoteDescription
                  currentRemoteDescription
                  
currentRemoteDescription of type RTCSessionDescription, readonly,
              nullableThe currentRemoteDescription
                  RTCSessionDescription
                  RTCPeerConnection transitioned into the stable state plus any remote candidates that have been supplied via addIceCandidate() since the offer or answer was created.
The currentRemoteDescription attribute MUST return the value that algorithms in this specification set it to, complete with any remote candidates that have been supplied via addIceCandidate() since the offer or answer was created. Prior to being set, it returns null. Note that the value of currentRemoteDescription.sdp need not match the value of
                  remoteDescription.sdp.
pendingRemoteDescription of type RTCSessionDescription, readonly,
              nullableThe pendingRemoteDescription
                  RTCSessionDescription
                  addIceCandidate() since the offer or answer was created. If the
                  RTCPeerConnection is in the stable state, the value is null. This attribute is updated by setLocalDescription
                  
The pendingRemoteDescription attribute MUST return the value that algorithms in this specification set it to, completed with any remote candidates that have been supplied via addIceCandidate() since the offer or answer was created. Prior to being set, it returns null.
                
signalingState of type RTCSignalingState, readonlyThe signalingState attribute MUST return the RTCPeerConnection
                  
iceGatheringState of type RTCIceGatheringState, readonlyThe iceGatheringState attribute MUST return the ICE gathering state of the
                  RTCPeerConnection instance.
iceConnectionState of type RTCIceConnectionState, readonlyThe iceConnectionState attribute MUST return the ICE connection state of the
                  RTCPeerConnection instance.
connectionState of type RTCPeerConnectionState, readonlyThe connectionState attribute MUST return the connection state of the
                  RTCPeerConnection
                  
canTrickleIceCandidates of type boolean, readonly, nullableThe canTrickleIceCandidates attribute indicates whether the remote peer is able to accept trickled ICE candidates [TRICKLE-ICE]. The value is determined based on whether a remote description indicates support for trickle ICE, as defined in [JSEP] (section 4.1.15.). Prior to the completion of
                  setRemoteDescriptionnull.
onnegotiationneeded of type
              EventHandlernegotiationneeded
                onicecandidate of type EventHandlericecandidate
                onicecandidateerror of type
              EventHandlericecandidateerror
                onsignalingstatechange of type
              EventHandlersignalingstatechange
                oniceconnectionstatechange of type
              EventHandlericeconnectionstatechange
                onicegatheringstatechange of type
              EventHandlericegatheringstatechange
                onconnectionstatechange of type
              EventHandlerconnectionstatechange
                onfingerprintfailure of type
              EventHandlerfingerprintfailure
                createOfferThe 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
                  MediaStreamTracks 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 tracks. 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 generate the ICE username fragment and password.
The value for certificates in the
                  RTCConfiguration
                  RTCPeerConnection is used to produce a set of certificate fingerprints. These certificate fingerprints are used in the construction of SDP and as input to requests for identity assertions.
If the RTCPeerConnection is configured to generate Identity assertions by calling
                  setIdentityProvider
                  
The SDP generation process exposes a subset of the media capabilities of the underlying system, which provides generally persistent cross-origin information on the device. It thus increases the fingerprinting surface of the application. In privacy-sensitive contexts, browsers can consider mitigations such as generating SDP matching only a common subset of the capabilities.
When the method is called, the user agent MUST run the following steps:
Let connection be the
                      RTCPeerConnection
                      
If connection's [[isClosed]] slot is
                      true, return a promise rejected with a newly
                      created
                      InvalidStateError.
If connection is configured with an identity provider, and an identity assertion has not yet been generated using said identity provider, then begin the identity assertion request process if it has not already begun.
Return the result of enqueuing the following steps:
Let p be a new promise.
In parallel, begin the steps to create an offer, given p.
Return p.
The steps to create an offer given a promise p are as follows:
If the need for an identity assertion was identified when createOffer was invoked, wait for
                      the
                    identity assertion request process to complete.
If the identity provider was unable to produce an identity assertion, reject p with a newly
                      created
                      NotReadableError and abort these steps.
If connection was not constructed with a set of certificates, and one has not yet been generated, wait for it to be generated.
Inspect the system state to determine the currently available resources as necessary for generating the offer, as described in [JSEP] (section 4.1.6.).
If this inspection failed for any reason, reject
                      p with a newly
                      created
                      OperationError and abort these steps.
Queue a task that runs the final steps to create an offer, given p.
The final steps to create an offer given a promise p are as follows:
If connection's [[isClosed]] slot is
                      true, then abort these steps.
If connection was modified in such a way that additional inspection of the system state is necessary, then in parallel begin the steps to create an offer again, given p, and abort these steps.
createOffer was called when only an audio
                        RTCRtpTransceiver
                        RTCRtpTransceiver
                        Given the information that was obtained from previous inspection and the current state of connection and its RTCRtpTransceiver
                      
Let offer be a newly created
                      RTCSessionDescriptionInit
                      type member initialized to the string
                      "offer" and its sdp member initialized to sdpString.
Resolve p with offer.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| options | RTCOfferOptions | ✘ | ✔ | 
Promise<RTCSessionDescriptionInit>
                createAnswerThe 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 of SDP contains descriptions of the local MediaStreamTracks 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 generate the ICE username fragment and password.
An answer can be marked as provisional, as described in
                  [JSEP] (section 4.1.8.1.), by setting the type
                  pranswer.
If the RTCPeerConnection is configured to generate Identity assertions by calling
                  setIdentityProvider
                  
When the method is called, the user agent MUST run the following steps:
Let connection be the
                      RTCPeerConnection
                      
If connection's [[isClosed]] slot is
                      true, return a promise rejected with a newly
                      created
                      InvalidStateError.
If connection is configured with an identity provider, and an identity assertion has not yet been generated using said identity provider, then begin the identity assertion request process if it has not already begun.
Return the result of enqueuing the following steps:
If connection's remoteDescription
                          null return a promise rejected with a newly
                          created
                         InvalidStateError.
Let p be a new promise.
In parallel, begin the steps to create an answer, given p.
Return p.
The steps to create an answer given a promise p are as follows:
If the need for an identity assertion was identified when createAnswer was invoked, wait for
                      the
                    identity assertion request process to complete.
If the identity provider was unable to produce an identity assertion, reject p with a newly
                      created
                      NotReadableError and abort these steps.
If connection was not constructed with a set of certificates, and one has not yet been generated, wait for it to be generated.
Inspect the system state to determine the currently available resources as necessary for generating the answer, as described in [JSEP] (section 4.1.7.).
If this inspection failed for any reason, reject
                      p with a newly
                      created
                      OperationError and abort these steps.
Queue a task that runs the final steps to create an answer, given p.
The final steps to create an answer given a promise p are as follows:
If connection's [[isClosed]] slot is
                      true, then abort these steps.
If connection was modified in such a way that additional inspection of the system state is necessary, then in parallel begin the steps to create an answer again, given p, and abort these steps.
createAnswer was called when an
                        RTCRtpTransceiver
                        Given the information that was obtained from previous inspection and the current state of connection and its RTCRtpTransceiver
                      
Let answer be a newly created
                      RTCSessionDescriptionInit
                      type member initialized to the string
                      "answer" and its sdp member initialized to sdpString.
Resolve p with answer.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| options | RTCAnswerOptions | ✘ | ✔ | 
Promise<RTCSessionDescriptionInit>
                setLocalDescriptionThe setLocalDescription method instructs the RTCPeerConnection
                  RTCSessionDescriptionInit
                  
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
                  RTCPeerConnection
                  
As noted in [JSEP] (section 5.4.) the SDP returned from createOffer or
                  createAnswer MUST NOT be changed before passing it to setLocalDescription. As a result, when the method is invoked, the user agent MUST run the following steps:
                
setLocalDescription.createOffer.createAnswer.description.sdp is
                    null and description.type is answer or pranswer, set description.sdp to
                    lastAnswer.description.sdp is
                    null and description.type is offer, set description.sdp to lastOffer.description.type is
                    offer and description.sdp does not match lastOffer, reject the promise with a newly
                    created
                    InvalidModificationError and abort these steps.
                  description.type is
                    answer or pranswer and
                    description.sdp does not match lastAnswer, reject the promise with a newly
                    created
                    InvalidModificationError and abort these steps.| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| description | RTCSessionDescriptionInit | ✘ | ✘ | 
Promise<void>
                setRemoteDescriptionThe setRemoteDescription method instructs the RTCPeerConnection
                  RTCSessionDescriptionInit
                  
When the method is invoked, the user agent MUST return the result of setting the RTCSessionDescription indicated by the method's first argument.
In addition, a remote description is processed to determine and verify the identity of the peer.
If an a=identity attribute is present in the session description, the browser validates the identity
                assertion..
If the "peerIdentity" configuration is applied to the
                  RTCPeerConnection
                  RTCPeerConnection
                  peerIdentity
                  
The target peer identity cannot be changed once set. Once set, if a different value is provided, the user agent MUST reject the returned promise with a newly
                  created
                  InvalidModificationError and abort this operation. The RTCPeerConnection
                  
If there is no target peer identity, then
                  setRemoteDescription does not await the completion of identity validation.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| description | RTCSessionDescriptionInit | ✘ | ✘ | 
Promise<void>
                addIceCandidateThe addIceCandidate method provides a remote candidate to the ICE Agent. This method can also be used to indicate the end of remote candidates when called with an empty string for the candidate
                  candidate
                  sdpMid
                  sdpMLineIndex
                  ufrag
                  
Let candidate be the method's argument.
Let connection be the
                      RTCPeerConnection
                      
If both sdpMid and sdpMLineIndex are
                      null, return a promise rejected with a newly
                      created
                      TypeError.
Return the result of enqueuing the following steps:
If remoteDescription
                          null return a promise rejected with a newly
                          created
                         InvalidStateError.
Let p be a new promise.
If candidate.sdpMid is not null, run the following steps:
If candidate.sdpMid is not equal to the mid of any media description in
                              remoteDescription
                              OperationError and abort these steps.
Else, if candidate.sdpMLineIndex is not null, run the following steps:
If candidate.sdpMLineIndex is equal to or larger than the number of media descriptions in remoteDescription
                              OperationError and abort these steps.
If candidate.ufrag is neither
                          undefined nor null, and is not equal to any ufrag present in the corresponding
                          media description of an applied remote description, reject p with a newly
                          created
                         OperationError and abort these steps.
                        
In parallel, add the ICE candidate
                          candidate as described in [JSEP] (section 4.1.17.). Use
                          candidate.ufrag to identify the ICE generation; if the ufrag is null, process the
                          candidate for the most recent ICE
                          generation. If
                          candidate.candidate is an empty string, process candidate as an end-of-candidates indication for the corresponding
                          media description and ICE candidate
                          generation.
If candidate could not be successfully added the user agent MUST queue a task that runs the following steps:
If connection's [[
                                  isClosed]] slot is true, then abort these steps.
Reject p with a
                                  DOMException object whose
                                  name attribute has the value
                                  OperationError and abort these steps.
                                
If candidate is applied successfully, the user agent MUST queue a task that runs the following steps:
If connection's [[
                                  isClosed]] slot is true, then abort these steps.
Let remoteDescription be
                                  connection's pendingRemoteDescription
                                  currentRemoteDescription
                                  
Add candidate to remoteDescription.
Resolve p with
                                  undefined.
Return p.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| candidate | (RTCIceCandidateInit or
                      RTCIceCandidate) | ✘ | ✘ | 
Promise<void>
                getDefaultIceServersReturns a list of ICE servers that are configured into the browser. A browser might be configured to use local or private STUN or TURN servers. This method allows an application to learn about these servers and optionally use them.
This list is likely to be persistent and is the same across origins. It thus increases the fingerprinting surface of the browser. In privacy-sensitive contexts, browsers can consider mitigations such as only providing this data to "trusted" origins (or not providing it at all.)
sequence<RTCIceServer>
                getConfigurationReturns a RTCConfiguration
                  RTCPeerConnection
                  
When this method is called, the user agent MUST return the
                  RTCConfiguration
                  configuration]] internal slot.
RTCConfiguration
                setConfigurationThe setConfiguration method updates the configuration of this RTCPeerConnection
                  
When the setConfiguration method is invoked, the user agent MUST run the following steps:
Let connection be the
                      RTCPeerConnection
                      
If connection's [[isClosed]] slot is
                      true, throw an
                      InvalidStateError.
To set a configuration, run the following steps:
RTCConfiguration
                    RTCPeerConnection
                    configuration.peerIdentity is set and its value differs from the target peer
                  identity, throw an InvalidModificationError.
                  configuration.certificates is set and the set of certificates differs from the ones used when connection was constructed, throw an
                    InvalidModificationError.configuration.bundlePolicy
                     is set and its value differs from the connection's bundle policy,
                    throw an InvalidModificationError.configuration.rtcpMuxPolicy
                     is set and its value differs from the connection's rtcpMux policy, throw an InvalidModificationError.configuration.iceCandidatePoolSize
                     is set and its value differs from the connection's previously set iceCandidatePoolSize, and setLocalDescription
                    InvalidModificationError.Set the ICE Agent's ICE transports setting to the value of configuration.. As defined in [JSEP] (section 4.1.16.), if the new ICE transports setting changes the existing setting, no action will be taken until the next gathering phase. If a script wants this to happen immediately, it should do an ICE restart.iceTransportPolicy
                      
Set the ICE Agent's prefetched ICE candidate
                    pool size as defined in [JSEP] (section 3.5.4. and section 4.1.1.) to the value of configuration.. If the new ICE candidate pool size changes the existing setting, this may result in immediate gathering of new pooled candidates, or discarding of existing pooled candidates, as defined in [JSEP] (section 4.1.16.).iceCandidatePoolSize
                      
Let validatedServers be an empty list.
If configuration. is defined, then run the following steps for each element:iceServers
                      
Let server be the current list element.
If server.urls is a string, let server.urls be a list consisting of just that string.
For each url in
                          server.urls parse
                          url and obtain scheme name. If the scheme name is not implemented by the browser, or if parsing based on the syntax defined in [
                          RFC7064] and [RFC7065] fails, throw a
                          SyntaxError.
If scheme name is turn or
                          turns, and either of
                          server.username or
                          server.credential are omitted, then throw an InvalidAccessError.
If scheme name is turn or
                          turns, and
                          server.credentialType is
                          "password", and
                          server.credential is not a DOMString, then throw an
                          InvalidAccessError and abort these steps.
                        
If scheme name is turn or
                          turns, and
                          server.credentialType is
                          "oauth", and
                          server.credential is not an
                          RTCOAuthCredential, then throw an
                          InvalidAccessError and abort these steps.
                        
Append server to validatedServers.
Let validatedServers be the ICE Agent's ICE servers list.
As defined in [JSEP] (section 4.1.16.), if a new list of servers replaces the ICE Agent's existing ICE servers list, no action will be taken until the next gathering phase. If a script wants this to happen immediately, it should do an ICE restart. However, if the ICE candidate pool has a nonzero size, any existing pooled candidates will be discarded, and new candidates will be gathered from the new servers.
Store the configuration in the [[
                      configuration]] internal slot.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| configuration | RTCConfiguration | ✘ | ✘ | 
void
                closeWhen the close method is invoked, the user agent MUST run the following steps:
Let connection be the
                      RTCPeerConnection
                      
If connection's [[isClosed]] slot is
                      true, abort these steps.
Destroy connection's ICE Agent, abruptly ending any active ICE processing and any active streaming, and releasing any relevant resources (e.g. TURN permissions).
Set the state
                      RTCIceTransport
                      closed
                      
Let senders be the result of executing the
                      CollectSenders algorithm. For every
                      RTCRtpSender
                      sender.transport.state and
                      sender.transport.transport.state to "closed". If sender.rtcpTransport is set, set
                      sender.rtcpTransport.state and
                      sender.rtcpTransport.transport.state to "closed".
Let receivers be the result of executing the
                      CollectReceivers algorithm. For every
                      RTCRtpReceiver
                      receiver.transport.state and
                      receiver.transport.transport.state to "closed". If
                      receiver.rtcpTransport is set, set
                      receiver.rtcpTransport.state and
                      receiver.rtcpTransport.transport.state to "closed".
Let transceivers be the result of executing the
                      CollectTransceivers algorithm. For every
                      RTCRtpTransceiver
                      
If transceiver.stopped is
                          true, abort these steps.
Let sender be transceiver.sender.
Let receiver be transceiver.receiver.
Stop sending media with sender.
Send an RTCP BYE for each SSRC in
                          sender.getParameters().encodings[i].ssrc,
                          sender.getParameters().encodings[i].fec.ssrc and
                          sender.getParameters().encodings[i].rtx.ssrc where i goes from 0 to
                          sender.getParameters().encodings.length-1.
Stop receiving media with receiver.
Set receiver.track.readyState to ended.
Set transceiver.stopped to true.
Set connection's [[isClosed]] slot to
                      true.
void
                Supporting the methods in this section is optional. However, if these methods are supported it is mandatory to implement according to what is specified here.
RTCPeerConnection
            partial interface RTCPeerConnection {
    Promise<void> createOffer(RTCSessionDescriptionCallback successCallback,
                              RTCPeerConnectionErrorCallback failureCallback,
                              optional RTCOfferOptions options);
    Promise<void> setLocalDescription(RTCSessionDescriptionInit description,
                                      VoidFunction successCallback,
                                      RTCPeerConnectionErrorCallback failureCallback);
    Promise<void> createAnswer(RTCSessionDescriptionCallback successCallback,
                               RTCPeerConnectionErrorCallback failureCallback);
    Promise<void> setRemoteDescription(RTCSessionDescriptionInit description,
                                       VoidFunction successCallback,
                                       RTCPeerConnectionErrorCallback failureCallback);
    Promise<void> addIceCandidate((RTCIceCandidateInit or RTCIceCandidate) candidate,
                                  VoidFunction successCallback,
                                  RTCPeerConnectionErrorCallback failureCallback);
};
            createOfferWhen the createOffer method is called, the user agent MUST run the following steps:
Let successCallback be the method's first argument.
Let failureCallback be the callback indicated by the method's second argument.
Let options be the callback indicated by the method's third argument.
Run the steps specified by
                        RTCPeerConnection
                        
Upon fulfillment of p with value offer, invoke successCallback with offer as the argument.
Upon rejection of p with reason r, invoke failureCallback with r as the argument.
Return a promise resolved with
                        undefined.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| successCallback | RTCSessionDescriptionCallback | ✘ | ✘ | |
| failureCallback | RTCPeerConnectionErrorCallback | ✘ | ✘ | |
| options | RTCOfferOptions | ✘ | ✔ | 
Promise<void>
                  setLocalDescriptionWhen the setLocalDescription method is called, the user agent MUST run the following steps:
Let description be the method's first argument.
Let successCallback be the callback indicated by the method's second argument.
Let failureCallback be the callback indicated by the method's third argument.
Run the steps specified by
                        RTCPeerConnection
                        setLocalDescription method with
                        description as the sole argument, and let
                        p be the resulting promise.
Upon fulfillment of p, invoke
                        successCallback with undefined as the argument.
Upon rejection of p with reason r, invoke failureCallback with r as the argument.
Return a promise resolved with
                        undefined.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| description | RTCSessionDescriptionInit | ✘ | ✘ | |
| successCallback | VoidFunction | ✘ | ✘ | |
| failureCallback | RTCPeerConnectionErrorCallback | ✘ | ✘ | 
Promise<void>
                  createAnswercreateAnswer method does not take an RTCAnswerOptions
                      createAnswer implementation ever supported it.When the createAnswer method is called, the user agent MUST run the following steps:
Let successCallback be the method's first argument.
Let failureCallback be the callback indicated by the method's second argument.
Run the steps specified by
                        RTCPeerConnection
                        
Upon fulfillment of p with value answer, invoke successCallback with answer as the argument.
Upon rejection of p with reason r, invoke failureCallback with r as the argument.
Return a promise resolved with
                        undefined.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| successCallback | RTCSessionDescriptionCallback | ✘ | ✘ | |
| failureCallback | RTCPeerConnectionErrorCallback | ✘ | ✘ | 
Promise<void>
                  setRemoteDescriptionWhen the setRemoteDescription method is called, the user agent MUST run the following steps:
Let description be the method's first argument.
Let successCallback be the callback indicated by the method's second argument.
Let failureCallback be the callback indicated by the method's third argument.
Run the steps specified by
                        RTCPeerConnection
                        setRemoteDescription method with
                        description as the sole argument, and let
                        p be the resulting promise.
Upon fulfillment of p, invoke
                        successCallback with undefined as the argument.
Upon rejection of p with reason r, invoke failureCallback with r as the argument.
Return a promise resolved with
                        undefined.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| description | RTCSessionDescriptionInit | ✘ | ✘ | |
| successCallback | VoidFunction | ✘ | ✘ | |
| failureCallback | RTCPeerConnectionErrorCallback | ✘ | ✘ | 
Promise<void>
                  addIceCandidateWhen the addIceCandidate method is called, the user agent MUST run the following steps:
Let candidate be the method's first argument.
Let successCallback be the callback indicated by the method's second argument.
Let failureCallback be the callback indicated by the method's third argument.
Run the steps specified by
                        RTCPeerConnection
                        
Upon fulfillment of p, invoke
                        successCallback with undefined as the argument.
Upon rejection of p with reason r, invoke failureCallback with r as the argument.
Return a promise resolved with
                        undefined.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| candidate | (RTCIceCandidateInit or
                      RTCIceCandidate) | ✘ | ✘ | |
| successCallback | VoidFunction | ✘ | ✘ | |
| failureCallback | RTCPeerConnectionErrorCallback | ✘ | ✘ | 
Promise<void>
                  These callbacks are only used on the legacy APIs.
RTCPeerConnectionErrorCallbackcallback RTCPeerConnectionErrorCallback = void (DOMException error);
                  RTCPeerConnectionErrorCallback
                  Parameterserror of type DOMExceptionRTCSessionDescriptionCallbackcallback RTCSessionDescriptionCallback = void (RTCSessionDescriptionInit description);
                  RTCSessionDescriptionCallback
                  Parametersdescription of type RTCSessionDescriptionInitpartial dictionary RTCOfferOptions {
    boolean offerToReceiveAudio;
    boolean offerToReceiveVideo;
};
            offerToReceiveAudio of type booleanWhen this is given a non-false value, no outgoing track of type "audio" is attached to the PeerConnection, and the existing localDescription (if any) doesn't contain any sendrecv or recv audio media sections, createOffer() will behave as if addTransceiver("audio") had been called once prior to the createOffer() call.
In all other situations, it will be disregarded.
offerToReceiveVideo of type booleanWhen this is given a non-false value, and no outgoing track of type "video" is attached to the PeerConnection, and the existing localDescription (if any) doesn't contain any sendecv or recv video media sections, createOffer() will behave as if addTransceiver("video") had been called prior to the createOffer() call.
In all other situations, it will be disregarded.
An RTCPeerConnection
          true, no such event handler can be triggered and it is therefore safe to garbage collect the object.
All RTCDataChannel
          MediaStreamTrack
          RTCPeerConnection
          RTCPeerConnection
          
RTCSignalingState Enum
        enum RTCSignalingState {
    "stable",
    "have-local-offer",
    "have-remote-offer",
    "have-local-pranswer",
    "have-remote-pranswer",
    "closed"
};
          | Enumeration description | |
|---|---|
| stable | There is no offeranswer exchange in progress. This is also the initial state in which case the local and remote descriptions are empty. | 
| have-local-offer | A local description, of type "offer", has been successfully applied. | 
| have-remote-offer | A remote description, of type "offer", has been successfully applied. | 
| have-local-pranswer | A remote description of type "offer" has been successfully applied and a local description of type "pranswer" has been successfully applied. | 
| have-remote-pranswer | A local description of type "offer" has been successfully applied and a remote description of type "pranswer" has been successfully applied. | 
| closed | The has been closed; its [[isClosed]] slot istrue. | 
An example set of transitions might be:
stablehave-local-offerhave-remote-pranswerstablestablehave-remote-offerhave-local-pranswerstableRTCIceGatheringState Enum
        enum RTCIceGatheringState {
    "new",
    "gathering",
    "complete"
};
          | Enumeration description | |
|---|---|
| new | Any of the s are in thenewgathering state and none of the transports are in thegatheringstate, or there are no transports. | 
| gathering | Any of the s are in thegatheringstate. | 
| complete | At least one exists, and alls are in thecompletedgathering state. | 
RTCPeerConnectionState Enum
        enum RTCPeerConnectionState {
    "new",
    "connecting",
    "connected",
    "disconnected",
    "failed",
    "closed"
};
          | Enumeration description | |
|---|---|
| new | Any of the s ors are in thenewstate and none of the transports are in theconnecting,checking,failedordisconnectedstate, or all transports are in theclosedstate. | 
| connecting | Any of the s ors are in theconnectingorcheckingstate and none of them is in thefailedstate. | 
| connected | All s ands are in theconnected,completedorclosedstate and at least of them is in theconnectedorcompletedstate. | 
| disconnected | Any of the s ors are in thedisconnectedstate and none of them are in thefailedorconnectingorcheckingstate. | 
| failed | Any of the s ors are in afailedstate. | 
| closed | The object's [[
                  isClosed]] slot istrue. | 
RTCIceConnectionState Enum
        enum RTCIceConnectionState {
    "new",
    "checking",
    "connected",
    "completed",
    "failed",
    "disconnected",
    "closed"
};
          | Enumeration description | |
|---|---|
| new | Any of the s are in thenewstate and none of them are in thechecking,failedordisconnectedstate, or alls are in theclosedstate. | 
| checking | Any of the s are in thecheckingstate and none of them are in thefailedordisconnectedstate. | 
| connected | All s are in theconnected,completedorclosedstate and at least one of them is in theconnectedstate. | 
| completed | All s are in thecompletedorclosedstate and at least one of them is in thecompletedstate. | 
| failed | Any of the s are in thefailedstate. | 
| disconnected | Any of the s are in thedisconnectedstate and none of them are in thefailedstate. | 
| closed | The object's [[
                  isClosed]] slot istrue. | 
Note that if an RTCIceTransport
          
All methods that return promises are governed by the standard error handling rules of promises. Methods that do not return promises may throw exceptions to indicate errors.
Legacy-methods may only throw exceptions to indicate invalid state and other programming errors. For example, when a legacy-method is called when the RTCPeerConnection
          
RTCSdpType
        The RTCSdpType enum describes the type of an
          RTCSessionDescriptionInit
          RTCSessionDescription
          
enum RTCSdpType {
    "offer",
    "pranswer",
    "answer",
    "rollback"
};
          | Enumeration description | |
|---|---|
| offer | An  | 
| pranswer | An  | 
| answer | An  | 
| rollback | An  | 
RTCSessionDescription Class
        The RTCSessionDescription class is used by
          RTCPeerConnection
          
[Constructor(RTCSessionDescriptionInit descriptionInitDict)]
interface RTCSessionDescription {
    readonly attribute RTCSdpType type;
    readonly attribute DOMString  sdp;
    serializer = {attribute};
};
          RTCSessionDescriptionRTCSessionDescription() constructor takes a dictionary argument,
                descriptionInitDict, whose content is used to initialize the new RTCSessionDescription
                | Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| descriptionInitDict | RTCSessionDescriptionInit | ✘ | ✘ | 
type of type RTCSdpType, readonlysdp of type DOMString, readonlySerializerInstances of this interface are serialized as a map with entries for each of the serializable attributes.
dictionary RTCSessionDescriptionInit {
    required RTCSdpType type;
             DOMString  sdp = "";
};
          RTCSessionDescriptionInit
            Memberstype of type RTCSdpType, requiredsdp of type DOMStringtype is rollback, this member is unused.
              Many changes to state of an RTCPeerConnection
        negotiationneeded event. This event is fired according to the state of the connection's negotiation-needed flag, represented by a [[needNegotiation]] internal slot.
This section is non-normative.
If an operation is performed on an
          RTCPeerConnection
          RTCRtpTransceiver
          
        RTCDataChannel
          
Internal changes within the implementation can also result in the connection being marked as needing negotiation.
Note that the exact procedures for updating the negotiation-needed flag are specified below.
This section is non-normative.
The negotiation-needed flag is cleared when an
          RTCSessionDescription
          RTCRtpTransceiver
          RTCDataChannel
          RTCPeerConnection
          stopped transceivers have an associated section in the local description with matching properties, and, if any data channels have been created, a data section exists in the local description.
Note that the exact procedures for updating the negotiation-needed flag are specified below.
The process below occurs where referenced elsewhere in this document. It also may occur as a result of internal changes within the implementation that affect negotiation. If such changes occur, the user agent MUST queue a task to update the negotiation-needed flag.
To update the negotiation-needed flag for connection, run the following steps:
If connection's [[isClosed]] slot is
              true, abort these steps.
If connection's signaling state is not "stable", abort these steps.
The negotiation-needed flag will be updated once the state transitions to "stable", as part of the steps for setting an RTCSessionDescription.
If the result of 
            checking if negotiation is needed is "false", clear the
            negotiation-needed flag by setting connection's [[
              needNegotiation]] slot to false, and abort these steps.
If connection's [[needNegotiation]] slot is already true, abort these steps.
Set connection's [[needNegotiation]] slot to
              true.
Queue a task that runs the following steps:
If connection's [[isClosed]] slot is true, abort these steps.
If connection's [[needNegotiation]] slot is false, abort these steps.
Fire a simple event named negotiationneeded at connection.
This queueing prevents negotiationneeded from firing prematurely, in the common situation where multiple modifications to connection are being made at once.
To check if negotiation is needed for connection, perform the following checks:
If any implementation-specific negotiation is required, as described at the start of this section, return "true".
If connection has created any
              RTCDataChannel
              
For each transceiver t in connection's set of transceivers, perform the following checks:
If t isn't 
                stopped and isn't yet associated with an m= section according to [JSEP] (section 3.4.1.), return "true".
If t isn't 
                stopped and is associated with an m= section according to [JSEP] (section 3.4.1.), then perform the following checks:
If t's direction is "sendrecv" or "sendonly", and the associated m= section in
                      connection's currentLocalDescription
                      
If connection's currentLocalDescription
                      direction, return "true".
If connection's currentLocalDescription
                      direction intersected with the offered direction (as described in [JSEP] (section 5.3.1.)), return "true".
If t is 
                stopped and is associated with an m= section according to
                  [JSEP] (section 3.4.1.), but the associated m= section is not yet rejected in
                  connection's currentLocalDescription
                  currentRemoteDescription
                  
If all the preceding checks were performed and "true" was not returned, nothing remains to be negotiated; return "false".
RTCIceCandidate Interface
        This interface describes an ICE candidate.
[Constructor(RTCIceCandidateInit candidateInitDict)]
interface RTCIceCandidate {
    readonly attribute DOMString               candidate;
    readonly attribute DOMString?              sdpMid;
    readonly attribute unsigned short?         sdpMLineIndex;
    readonly attribute DOMString?              foundation;
    readonly attribute unsigned long?          priority;
    readonly attribute DOMString?              ip;
    readonly attribute RTCIceProtocol?         protocol;
    readonly attribute unsigned short?         port;
    readonly attribute RTCIceCandidateType?    type;
    readonly attribute RTCIceTcpCandidateType? tcpType;
    readonly attribute DOMString?              ufrag;
    serializer = {candidate, sdpMid, sdpMLineIndex, ufrag};
};
          RTCIceCandidateRTCIceCandidate() constructor takes a dictionary argument, candidateInitDict, whose content is used to initialize the new RTCIceCandidatesdpMid
                sdpMLineIndex
                null, throw a TypeError.
                | Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| candidateInitDict | RTCIceCandidateInit | ✘ | ✘ | 
candidate of type DOMString, readonlycandidate-attribute as defined in section 15.1 of [ICE]. If this RTCIceCandidate represents an end-of-candidates indication,
                candidate is an empty string.sdpMid of type DOMString, readonly, nullablenull, this contains the identifier of the "media stream identification" as defined in [RFC5888] for the media component this candidate is associated with.sdpMLineIndex of type unsigned short, readonly,
              nullablenull, this indicates the index (starting at zero) of the media description in the SDP this candidate is associated with.
              foundation of type DOMString, readonly, nullableRTCIceTransport
                priority of type unsigned long, readonly, nullableip of type DOMString, readonly, nullableThe IP address of the candidate.
The IP addresses exposed in candidates gathered via ICE and made visibile to the application in
                      RTCIceCandidate instances can reveal more information about the device and the user (e.g. location, local network topology) than the user might have expected in a non-WebRTC enabled browser.
These IP addresses are always exposed to the application, and potentially exposed to the communicating party, and can be exposed without any specific user consent (e.g. for peer connections used with data channels, or to receive media only).
These IP addresses can also be used as temporary or persistent cross-origin states, and thus contribute to the fingerprinting surface of the device.
Applications can avoid exposing IP addresses to the communicating party, either temporarily or permanently, by forcing the ICE Agent to report only relay candidates via the iceTransportPolicy member of
                      RTCConfiguration
                      
To limit the IP addresses exposed to the application itself, browsers can offer their users different policies regarding sharing local IP addresses, as defined in [ RTCWEB-IP-HANDLING].
protocol of type RTCIceProtocol, readonly, nullableudp/tcp).port of type unsigned short, readonly, nullabletype of type RTCIceCandidateType, readonly, nullabletcpType of type RTCIceTcpCandidateType, readonly,
              nullableprotocol is tcp,
                tcpType represents the type of TCP candidate. Otherwise, tcpType is null.relatedAddress of type DOMString, readonly, nullablerelatedAddress is the IP address of the candidate that it is derived from. For host candidates, the relatedAddress is
                null.relatedPort of type unsigned short, readonly,
              nullablerelatedPort is the port of the candidate that it is derived from. For host candidates, the
                relatedPort is null.ufrag of type DOMString, readonly, nullableufrag as defined in section 15.4 of [ICE].SerializerInstances of this interface are serialized as a map with entries for the following attributes: candidate, sdpMid, sdpMLineIndex, ufrag.
dictionary RTCIceCandidateInit {
    DOMString       candidate = "";
    DOMString?      sdpMid = null;
    unsigned short? sdpMLineIndex = null;
    DOMString       ufrag;
};
          RTCIceCandidateInit
            Memberscandidate of type DOMString, defaulting to
              ""sdpMid of type DOMString, nullable, defaulting to
              nullsdpMLineIndex of type unsigned short, nullable,
              defaulting to nullufrag of type DOMStringThe RTCIceProtocol represents the protocol of the ICE candidate.
          
enum RTCIceProtocol {
    "udp",
    "tcp"
};
            | Enumeration description | |
|---|---|
| udp | A UDP candidate, as described in [ICE]. | 
| tcp | A TCP candidate, as described in [RFC6544]. | 
The RTCIceTcpCandidateType represents the type of the ICE TCP candidate, as defined in [RFC6544].
enum RTCIceTcpCandidateType {
    "active",
    "passive",
    "so"
};
            | Enumeration description | |
|---|---|
| active | An activeTCP candidate is one for which the transport will attempt to open an outbound connection but will not receive incoming connection requests. | 
| passive | A passiveTCP candidate is one for which the transport will receive incoming connection attempts but not attempt a connection. | 
| so | An socandidate is one for which the transport will attempt to open a connection simultaneously with its peer. | 
The RTCIceCandidateType represents the type of the ICE candidate, as defined in [ICE] section 15.1.
enum RTCIceCandidateType {
    "host",
    "srflx",
    "prflx",
    "relay"
};
            | Enumeration description | |
|---|---|
| host | A host candidate, as defined in Section 4.1.1.1 of [ ICE]. | 
| srflx | A server reflexive candidate, as defined in Section 4.1.1.2 of [ICE]. | 
| prflx | A peer reflexive candidate, as defined in Section 4.1.1.2 of [ICE]. | 
| relay | A relay candidate, as defined in Section 7.1.3.2.1 of [ ICE]. | 
The icecandidate event of the RTCPeerConnection uses the RTCPeerConnectionIceEvent
          
Firing an
        RTCPeerConnectionIceEventRTCIceCandidate
          RTCPeerConnectionIceEvent interface with the
          candidate attribute set to the new ICE candidate, MUST be created and dispatched at the given target.
When firing an RTCPeerConnectionIceEvent
          RTCIceCandidate
          sdpMidsdpMLineIndexRTCIceCandidate
          srflx or type relay, the url property of the event
          MUST be set to the URL of the ICE server from which the candidate was obtained.
        
[Constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict)]
interface RTCPeerConnectionIceEvent : Event {
    readonly attribute RTCIceCandidate? candidate;
    readonly attribute DOMString?       url;
};
          RTCPeerConnectionIceEvent| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| type | DOMString | ✘ | ✘ | |
| eventInitDict | RTCPeerConnectionIceEventInit | ✘ | ✘ | 
candidate of type RTCIceCandidate, readonly,
              nullableThe candidate attribute is the
                  RTCIceCandidate
                  
This attribute is set to null when an event is generated to indicate the end of candidate gathering.
Even where there are multiple media components, only one event containing a null candidate is fired.
                  
url of type DOMString, readonly, nullableThe url attribute is the STUN or TURN URL that identifies the STUN or TURN server used to gather this candidate. If the candidate was not gathered from a STUN or TURN server, this parameter will be set to
                  null.
dictionary RTCPeerConnectionIceEventInit : EventInit {
    RTCIceCandidate? candidate;
    DOMString?       url;
};
          RTCPeerConnectionIceEventInit
            Memberscandidate of type RTCIceCandidate, nullableSee the
                  candidate attribute of the
                  RTCPeerConnectionIceEvent interface.
url of type DOMStringThe icecandidateerror event of the RTCPeerConnection uses the RTCPeerConnectionIceErrorEvent
          
[Constructor(DOMString type, RTCPeerConnectionIceErrorEventInit eventInitDict)]
interface RTCPeerConnectionIceErrorEvent : Event {
    readonly attribute DOMString      hostCandidate;
    readonly attribute DOMString      url;
    readonly attribute unsigned short errorCode;
    readonly attribute USVString      errorText;
};
          RTCPeerConnectionIceErrorEvent| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| type | DOMString | ✘ | ✘ | |
| eventInitDict | RTCPeerConnectionIceErrorEventInit | ✘ | ✘ | 
hostCandidate of type DOMString, readonlyThe hostCandidate attribute is the local IP address and port used to communicate with the STUN or TURN server.
                
On a multihomed system, multiple interfaces may be used to contact the server, and this attribute allows the application to figure out on which one the failure occurred.
If use of multiple interfaces has been prohibited for privacy reasons, this attribute will be set to 0.0.0.0:0 or [::]:0, as appropriate.
url of type DOMString, readonlyThe url attribute is the STUN or TURN URL that identifies the STUN or TURN server for which the failure occurred.
                
errorCode of type unsigned short, readonlyThe errorCode attribute is the numeric STUN error code returned by the STUN or TURN server [
                  STUN-PARAMETERS].
If no host candidate can reach the server,
                  errorCode will be set to the value 701 which is outside the STUN error code range. This error is only fired once per server URL while in the
                  RTCIceGatheringState of "gathering".
errorText of type USVString, readonlyThe errorText attribute is the STUN reason text returned by the STUN or TURN server [STUN-PARAMETERS].
If the server could not be reached, errorText will be set to an implementation-specific value providing details about the error.
dictionary RTCPeerConnectionIceErrorEventInit : EventInit {
             DOMString      hostCandidate;
             DOMString      url;
    required unsigned short errorCode;
             USVString      statusText;
};
          RTCPeerConnectionIceErrorEventInit
              MembershostCandidate of type DOMStringurl of type DOMStringerrorCode of type unsigned short, requiredstatusText of type USVStringMany applications have multiple media flows of the same data type and often some of the flows are more important than others. WebRTC uses the priority and Quality of Service (QoS) framework described in [
        RTCWEB-TRANSPORT] and [TSVWG-RTCWEB-QOS] to provide priority and DSCP marking for packets that will help provide QoS in some networking environments. The priority setting can be used to indicate the relative priority of various flows. The priority API allows the JavaScript applications to tell the browser whether a particular media flow is high, medium, low or of very low importance to the application by setting the
        priority property of
        RTCRtpEncodingParameters
        
RTCPriorityType Enum
        enum RTCPriorityType {
    "very-low",
    "low",
    "medium",
    "high"
};
          | Enumeration description | |
|---|---|
| very-low | See [RTCWEB-TRANSPORT], Section 4. | 
| low | See [RTCWEB-TRANSPORT], Section 4. | 
| medium | See [RTCWEB-TRANSPORT], Section 4. | 
| high | See [RTCWEB-TRANSPORT], Section 4. | 
Applications that use this API should be aware that often better overall user experience is obtained by lowering the priority of things that are not as important rather than raising the priority of the things that are.
The certificates that RTCPeerConnection instances use to authenticate with peers use the RTCCertificategenerateCertificateRTCConfigurationRTCPeerConnection instance.
The explicit certificate management functions provided here are optional. If an application does not provide the
        certificates configuration option when constructing an
        RTCPeerConnection a new set of certificates MUST be generated by the user agent. That set MUST include an ECDSA certificate with a private key on the P-256 curve and a signature with a SHA-256 hash.
partial interface RTCPeerConnection {
    static Promise<RTCCertificate> generateCertificate(AlgorithmIdentifier keygenAlgorithm);
};
        generateCertificate, staticThe generateCertificate function causes the
                user agent to create and store an X.509 certificate [
                X509V3] and corresponding private key. A handle to information is provided in the form of the
                RTCCertificate interface. The returned
                RTCCertificate can be used to control the certificate that is offered in the DTLS sessions established by
                RTCPeerConnection.
The keygenAlgorithm argument is used to control how the private key associated with the certificate is generated. The
                keygenAlgorithm argument uses the WebCrypto [
                WebCryptoAPI]
                
                  AlgorithmIdentifier type. The
                keygenAlgorithm value MUST be a valid argument to
                
                  window.crypto.subtle.generateKey; that is, the value MUST produce a non-error result when normalized according to the WebCrypto 
              algorithm normalization process [WebCryptoAPI] with an operation name of generateKey and a [[supportedAlgorithms]] value specific to production of certificates for
                RTCPeerConnection. If the algorithm normalization process produces an error, the call to
                generateCertificate MUST be rejected with that error.
              
Signatures produced by the generated key are used to authenticate the DTLS connection. The identified algorithm (as identified by the name of the normalized
                AlgorithmIdentifier) MUST be an asymmetric algorithm that can be used to produce a signature.
The certificate produced by this process also contains a signature. The validity of this signature is only relevant for compatibility reasons. Only the public key and the resulting certificate fingerprint are used by
                RTCPeerConnection, but it is more likely that a certificate will be accepted if the certificate is well formed. The browser selects the algorithm used to sign the certificate; a browser SHOULD select SHA-256 [FIPS-180-4] if a hash algorithm is needed.
The resulting certificate MUST NOT include information that can be linked to a user or user agent. Randomized values for distinguished name and serial number SHOULD be used.
A user agent MUST reject a call to
                generateCertificate() with a
                DOMException of type NotSupportedError if the keygenAlgorithm parameter identifies an algorithm that the user agent cannot or will not use to generate a certificate for RTCPeerConnection.
The following values MUST be supported by a user agent:
                { name: "RSASSA-PKCS1-v1_5",
              modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]),
              hash: "SHA-256" }, and { name: "ECDSA",
              namedCurve: "P-256"
              }.
It is expected that a user agent will have a small or even fixed set of values that it will accept.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| keygenAlgorithm | AlgorithmIdentifier | ✘ | ✘ | 
Promise<RTCCertificate>
              RTCCertificateExpiration
        RTCCertificateExpiration
          generateCertificate
dictionary RTCCertificateExpiration {
    [EnforceRange]
    DOMTimeStamp expires;
};
        expiresAn optional expires attribute MAY be added to the definition of the algorithm that is passed to generateCertificateRTCCertificate
              
When generateCertificateobject argument, the user agent attempts to convert the object into a
              RTCCertificateExpiration
              TypeError and abort processing.
A user agent generates a certificate that has an expiration date set to the current time plus the value of the
              expires attribute. The expiresRTCCertificateexpires
The RTCCertificate interface represents a certificate used to authenticate WebRTC communications. In addition to the visible properties, internal slots contain a handle to the generated private keying materal ([[handle]]) and a certificate ([[certificate]]) that
          RTCPeerConnection uses to authenticate with a peer.
interface RTCCertificate {
    readonly attribute DOMTimeStamp expires;
    sequence<RTCDtlsFingerprint> getFingerprints();
    // At risk due to lack of implementers' interest.
    AlgorithmIdentifier          getAlgorithm();
};
          expires of type DOMTimeStamp, readonlyThe expires attribute indicates the date and time in milliseconds relative to 1970-01-01T00:00:00Z after which the certificate will be considered invalid by the browser. After this time, attempts to construct an
                  RTCPeerConnection using this certificate fail.
Note that this value might not be reflected in a
                  notAfter parameter in the certificate itself.
getFingerprintsReturns the list of certificate fingerprints, one of which is computed with the digest algorithm used in the certificate signature.
sequence<RTCDtlsFingerprint>
                getAlgorithmReturns the result of the WebCrypto  algorithm
                normalization process [WebCryptoAPI] that occurred when this certificate was generated with generateCertificate().
The getAlgorithm method is marked as a feature at risk, since there is no clear commitment from implementers.
AlgorithmIdentifier
                For the purposes of this API, the [[certificate]] slot contains unstructured binary data.
Note that a RTCCertificate might not directly hold private keying material, this might be stored in a secure module.
The RTCCertificate object can be stored and retrieved from persistent storage by an application. When a user agent is required to obtain a structured clone [HTML5] of a
          RTCCertificate object, it performs the following steps:
        
RTCCertificate object to be cloned.RTCCertificate object.expires attribute from
            input to output.The RTP media API lets a web application send and receive
      MediaStreamTracks over a peer-to-peer connection. Tracks, when added to a RTCPeerConnection, result in signaling; when this signaling is forwarded to a remote peer, it causes corresponding tracks to be created on the remote side.
The actual encoding and transmission of MediaStreamTracks is managed through objects called RTCRtpSender
      MediaStreamTracks is managed through objects called RTCRtpReceiver
      RTCRtpSender
      RTCRtpReceiver
      
The encoding and transmission of each MediaStreamTrack
      SHOULD be made such that its characteristics (width, height and frameRate for video tracks; volume, sampleSize, sampleRate and channelCount for audio tracks) are to a reasonable degree retained by the track created on the remote side. There are situations when this does not apply, there may for example be resource constraints at either endpoint or in the network or there may be RTCRtpSender
      
RTCRtpSender
      MediaStreamTrack to a
      RTCPeerConnection
      addTrack method. RTCRtpReceiver
      MediaStreamTrack and its associated
      RTCRtpReceiver
      ontrack event. Both RTCRtpSender
      RTCRtpReceiver
      addTransceiver method.
A RTCPeerConnection
      RTCRtpTransceiverRTCPeerConnection
      
There are several ways to initiate the sending of a
          MediaStreamTrack over a peer-to-peer connection. One way is to use the addTrack method on the
          RTCPeerConnection
          replaceTrack method on an existing
          RTCRtpSender
          RTCRtpSender
          addTransceiver method (with or without a
          MediaStreamTrack argument). While
          addTrack checks if the MediaStreamTrack given as an argument is already being sent to avoid sending the same MediaStreamTrack twice, the other ways do not, allowing the same MediaStreamTrack (possibly using different RTCRtpParameters
          RTCRtpSender
          MediaStreamTracks with an identical
          id.
The RTP media API extends the RTCPeerConnection
        
partial interface RTCPeerConnection {
    sequence<RTCRtpSender>      getSenders();
    sequence<RTCRtpReceiver>    getReceivers();
    sequence<RTCRtpTransceiver> getTransceivers();
    RTCRtpSender                addTrack(MediaStreamTrack track,
                                         MediaStream... streams);
    void                        removeTrack(RTCRtpSender sender);
    RTCRtpTransceiver           addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
                                               optional RTCRtpTransceiverInit init);
    attribute EventHandler ontrack;
};
        ontrack of type EventHandlerThe event type of this event handler is
                track
                
getSendersReturns a sequence of RTCRtpSender
                RTCPeerConnection
                
The getSenders method MUST return the result of executing the
                CollectSenders algorithm.
We define the CollectSenders algorithm as follows:
CollectTransceivers algorithm.RTCRtpSender
                  sequence<RTCRtpSender>
              getReceiversReturns a sequence of RTCRtpReceiver
                RTCPeerConnection
                
The getReceivers method MUST return the result of executing the
                CollectReceivers algorithm.
We define the CollectReceivers algorithm as follows:
CollectTransceivers algorithm.RTCRtpReceiver
                  sequence<RTCRtpReceiver>
              getTransceiversReturns a sequence of RTCRtpTransceiver
                RTCPeerConnection
                
The getTransceivers method MUST return the result of executing the
                CollectTransceivers algorithm.
We define the CollectTransceivers algorithm as follows:
RTCRtpTransceiver
                  
                  RTCPeerConnection
                  sequence<RTCRtpTransceiver>
              addTrackAdds a new track to the RTCPeerConnection
                MediaStreams.
When the addTrack method is invoked, the user agent MUST run the following steps:
Let connection be the
                    RTCPeerConnection
                    
Let track be the
                    MediaStreamTrack
                    
Let streams be a list of
                    MediaStream objects constructed from the method's remaining arguments, or an empty list if the method was called with a single argument.
If connection's [[isClosed]] slot is
                    true, throw an
                    InvalidStateError.
Let senders be the result of executing the
                    CollectSenders algorithm. If an
                    RTCRtpSender
                    InvalidAccessError.
The steps below describe how to determine if an existing sender can be reused. Doing so will cause future calls to
                    createOffer and createAnswer to mark the corresponding media description as
                    sendrecv or sendonly and add the MSID of the track added, as defined in [JSEP] (section 5.2.2. and section 5.3.2.).
If any RTCRtpSender
                    null otherwise:
                  
The sender's track is null.
The transceiver kind of the
                        RTCRtpTransceiver
                        
The sender has never been used to send. More precisely, the RTCRtpTransceiver
                        currentDirection
                        sendrecv or sendonly.
If sender is not null, run the following steps to use that sender:
Set sender.track to track.
Set sender's [[associated MediaStreams]] to streams.
Enable sending direction on the
                        RTCRtpTransceiver
                        
If sender is null, run the following steps:
Create an RTCRtpSender with track and streams and let sender be the result.
Create an RTCRtpReceiver with track.kind as kind and let receiver be the result.
Create an RTCRtpTransceiver with sender and receiver and let transceiver be the result.
Add transceiver to connection's set of transceivers
A track 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 track 
                  CORS cross-origin. These tracks can be supplied to the
                    addTrack method, and have an
                    RTCRtpSender
                    peerIdentity and they meet the requirements for sending (see isolated streams and
                  RTCPeerConnection).
All other tracks 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 track content.
Note that this property can change over time.
Update the negotiation-needed flag for connection.
Return sender.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| track | MediaStreamTrack | ✘ | ✘ | |
| streams | MediaStream | ✘ | ✘ | 
RTCRtpSender
              removeTrackStops sending media from sender. The
                RTCRtpSender
                getSenders. Doing so will cause future calls to createOffer to mark the
                media description for the corresponding transceiver as recvonly or inactive, as defined in 
              [JSEP] (section 5.2.2.).
                
              
When the other peer stops sending a track in this manner, an
                ended event is fired at the MediaStreamTrack
                
When the removeTrack method is invoked, the user agent MUST run the following steps:
Let sender be the argument to
                    removeTrack.
Let connection be the
                    RTCPeerConnection
                    
If connection's [[isClosed]] slot is
                    true, throw an
                    InvalidStateError.
If sender was not created by
                    connection, throw an
                    InvalidAccessError.
Let senders be the result of executing the
                    CollectSenders algorithm.
If sender is not in senders (which indicates that it was removed due to setting an RTCSessionDescription of type "rollback"), then abort these steps.
Set sender.track to null.
                  
Let transceiver be the
                    RTCRtpTransceiver
                    
If transceiver.currentDirection is recvonly or inactive, then abort these steps.
If transceiver.currentDirection is sendrecv set
                    transceiver.direction to
                    recvonly.
If transceiver.currentDirection is sendonly set
                    transceiver.direction to
                    inactive.
Update the negotiation-needed flag for connection.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| sender | RTCRtpSender | ✘ | ✘ | 
void
              addTransceiverCreate a new RTCRtpTransceiver
                
Adding a transceiver will cause future calls to
                createOffer to add a media description for the corresponding transceiver, as defined in [JSEP] (section 5.2.2.).
The initial value of mid
                RTCSessionDescription
                
When this method is invoked, the user agent MUST run the following steps:
If the dictionary argument is present, and it has a
                    streams member, let streams be that list of MediaStream objects, or an empty list otherwise.
If the dictionary argument is present, and it has a
                    sendEncodings member, let
                    sendEncodings be that list of
                    RTCRtpEncodingParameters
                    
If the first argument is a string, let it be kind and run the following steps:
If kind is not a legal
                        MediaStreamTrack
                        kind,
                        throw a TypeError.
Let track be null.
If the first argument is a
                    MediaStreamTrack
                    
Create an RTCRtpSender with track, streams and sendEncodings and let sender be the result.
If sendEncodings is set, then subsequent calls to createOffer will be configured to send multiple RTP encodings as defined in [JSEP] (section 5.2.2. and section 5.2.1.). When
                    setRemoteDescription is called with a corresponding remote description that is able to receive multiple RTP encodings as defined in [JSEP] (section 3.7.), the
                    RTCRtpSender
                    sender.getParameters() will reflect the encodings negotiated.
RID values passed into init.sendEncodings must be composed only of case-sensitive alphanumeric characters (a-z, A-Z, 0-9) up to a maximum of 16 characters.
                  
Create an RTCRtpReceiver with kind and let receiver be the result. This specification does not define how to configure createOffer to receive multiple RTP encodings. However when
                    setRemoteDescription is called with a corresponding remote description that is able to send multiple RTP encodings as defined in [JSEP], the
                    RTCRtpReceiver
                    receiver.getParameters() will reflect the encodings negotiated.
Create an RTCRtpTransceiver with sender and receiver and let transceiver be the result.
Add transceiver to connection's set of transceivers
Update the negotiation-needed flag for connection.
Return transceiver.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| trackOrKind | (MediaStreamTrack or
                    DOMString) | ✘ | ✘ | |
| init | RTCRtpTransceiverInit | ✘ | ✔ | 
RTCRtpTransceiver
              dictionary RTCRtpTransceiverInit {
    RTCRtpTransceiverDirection         direction = "sendrecv";
    sequence<MediaStream>              streams;
    sequence<RTCRtpEncodingParameters> sendEncodings;
};
        RTCRtpTransceiverInit
          Membersdirection of type RTCRtpTransceiverDirection,
            defaulting to "sendrecv"RTCRtpTransceiver.streams of type sequence<MediaStream>When the remote PeerConnection's ontrack event fires corresponding to the RTCRtpReceiver
                
sendEncodings of type sequence<RTCRtpEncodingParameters>A sequence containing parameters for sending RTP encodings of media.
enum RTCRtpTransceiverDirection {
    "sendrecv",
    "sendonly",
    "recvonly",
    "inactive"
};
        | RTCRtpTransceiverDirectionEnumeration description | |
|---|---|
| sendrecv | The 'ssender will offer to send RTP, and will send RTP if the remote peer accepts andsender.getParameters().encodings[i].activeis "true" for any value of i. The'swill offer to receive RTP, and will receive RTP if the remote peer accepts. | 
| sendonly | The 'ssender will offer to send RTP, and will send RTP if the remote peer accepts andsender.getParameters().encodings[i].activeis "true" for any value of i. The'swill not offer to receive RTP, and will not receive RTP. | 
| recvonly | The 'swill not offer to send RTP, and will not send RTP. The'swill offer to receive RTP, and will receive RTP if the remote peer accepts. | 
| inactive | The 'swill not offer to send RTP, and will not send RTP. The'swill not offer to receive RTP, and will not receive RTP. | 
An application can reject incoming MediaStreamTrack
          RTCRtpTransceiver.stop()
To process the remote track for an incoming media description [JSEP] (section 5.9.) given
          RTCRtpTransceiver transceiver, the user agent
          MUST run the following steps:
Let connection be the
              RTCPeerConnection
              
Let streams be a list of
              MediaStream objects that the media description indicates the MediaStreamTrack
              
Add track to all MediaStream objects in streams.
This will result in an addtrack event being fired at each MediaStream as described in [GETUSERMEDIA].
Queue a task to fire an event named track
              
The RTCRtpSender interface allows an application to control how a given MediaStreamTrack is encoded and transmitted to a remote peer. When setParameters is called on an RTCRtpSender
        
When sending media, the sender may need to rescale or resample the media to meet various requirements including the envelope negotiated by SDP. When resizing video, the source video is first centered relative to the desired video then scaled down the minimum amount such that the video fully covers the desired size, then finally cropped to the destination size. The video remains centered while scaling and cropping. For example, if the source video was 1280 by 720, and the max size that could be sent was 640 by 480, the video would be scaled down by 1.5 and 160 columns of pixels on both the right and left sides of the source video would be cropped off. This algorithm is designed to minimize occurrence of images with with letter box or or pillow boxing. The media MUST NOT be upscaled to create fake data that did not occur in the input source.
To create an RTCRtpSender with a
        MediaStreamTrack
        MediaStream objects, streams, and optionally a list of RTCRtpEncodingParameters
        
Let sender be a new RTCRtpSender
            
Set sender.track to track.
Let sender have an [[associated
          MediaStreams]] internal slot, representing a list of
            MediaStream objects that the
            MediaStreamTrack
            
Set sender's [[associated MediaStreams]] slot to streams.
Let sender have a [[send encodings]] internal slot, representing a list of
            RTCRtpEncodingParameters
            
If sendEncodings is given as input to this algorithm, set the [[send encodings]] slot to sendEncodings.
Return sender.
interface RTCRtpSender {
    readonly attribute MediaStreamTrack? track;
    readonly attribute RTCDtlsTransport? transport;
    readonly attribute RTCDtlsTransport? rtcpTransport;
    // Feature at risk
    static RTCRtpCapabilities getCapabilities(DOMString kind);
    Promise<void>           setParameters(optional RTCRtpParameters parameters);
    RTCRtpParameters        getParameters();
    Promise<void>           replaceTrack(MediaStreamTrack withTrack);
    Promise<RTCStatsReport> getStats();
};
        track of type MediaStreamTrack, readonly,
            nullableThe track attribute is the track that is associated with this RTCRtpSender
                track is ended, or if
                track.muted is set to true, the RTCRtpSender sends silence (audio) or a black frame (video). If track is set to null then the RTCRtpSender does not send.
transport of type RTCDtlsTransport, readonly,
            nullableThe transport attribute is the transport over which media from track is sent in the form of RTP packets. Prior to construction of the
                RTCDtlsTransport
                transport attribute will be null. When bundling is used, multiple RTCRtpSender
                transport and will all send RTP and RTCP over the same transport.
rtcpTransport of type RTCDtlsTransport, readonly,
            nullableThe rtcpTransport attribute is the transport over which RTCP is sent and received. Prior to construction of the
                RTCDtlsTransport
                rtcpTransport attribute will be null. When RTCP mux is used (or bundling, which mandates RTCP mux),
                rtcpTransport will be null, and both RTP and RTCP traffic will flow over the transport described by
                transport.
getCapabilities, staticThe getCapabilities() method returns the most optimist view on the capabilities of the system for sending media of the given kind. It does not reserve any resources, ports, or other state but is meant to provide a way to discover the types of capabilities of the browser including which codecs may be supported.
These capabilities provide generally persistent cross-origin information on the device and thus increases the fingerprinting surface of the application. In privacy-sensitive contexts, browsers can consider mitigations such as reporting only a common subset of the capabilities.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| kind | DOMString | ✘ | ✘ | 
RTCRtpCapabilities
              setParametersThe setParameters method updates how
                track is encoded and transmitted to a remote peer.
              
When the setParameters method is called, the user agent MUST run the following steps:
RTCRtpSender
                  setParameters is invoked.RTCRtpTransceiver
                  sender.getParameters().encodings.length.transceiver.stopped is
                  true, abort these steps and return a promise rejected with a newly
                  created
                  InvalidStateError.parameters.encodings.length is different from N, or if any parameter in the parameters argument, marked as a Read-only parameter, has a value that is different from the corresponding parameter value returned from
                  sender.getParameters(), abort these steps and return a promise rejected with a newly
                  created
                  InvalidModificationError. Note that this also applies to transactionId.scaleResolutionDownBy parameter in the
                  parameters argument has a value less than 1.0, abort these steps and return a promise rejected with a newly
                  created
                  RangeError.RTCRtpSender
                  undefined.If codecs are reordered, the new order indicates the preference for sending, with the first codec being the codec with highest preference. If a codec is removed, that codec will not be used to send. The effect of reordering or removing codecs lasts until the codecs are renegotiated. After the codecs are renegotiated, they are set to the value negotiated, and
                setParameters needs to be called again to re-apply codec preferences.
setParameters does not cause SDP renegotiation and can only be used to change what the media stack is sending or receiving within the envelope negotiated by Offer/Answer. The attributes in the RTCRtpParameters
                ssrc that cannot be changed are read only. Other things, like bitrate, are controlled using limits such as
                maxBitrate, where the user agent needs to ensure it does not exceed the maximum bitrate specified by
                maxBitrate, while at the same time making sure it satisfies constraints on bitrate specified in other places such as the SDP.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| parameters | RTCRtpParameters | ✘ | ✔ | 
Promise<void>
              getParametersThe getParameters() method returns the RTCRtpSender
                track is encoded and transmitted to a remote RTCRtpReceiver
                setParameters to change the parameters in the following way:
var params = sender.getParameters();
// ... make changes to RTCRtpParameters
params.encodings[0].active = false;
sender.setParameters(params)
              RTCRtpParameters
              replaceTrackAttempts to replace the track being sent with another track provided (or with a null track), without renegotiation.
To avoid track identifiers changing on the remote receiving end when a track is replaced, the sender MUST retain the original track identifier and stream associations and use these in subsequent negotiations.
When the replaceTrack method is invoked, the user agent MUST run the following steps:
RTCRtpSender
                  replaceTrack is invoked.Let transceiver be the
                    RTCRtpTransceiver
                    
Let connection be the
                    RTCPeerConnection
                    
If connection's [[isClosed]] slot is
                    true, return a promise rejected with a newly
                    created
                    InvalidStateError and abort these steps.
If transceiver.stopped is
                    true, return a promise rejected with a newly 
                  created InvalidStateError.
Let withTrack be the argument to this method.
If withTrack is non-null and
                    withTrack.kind differs from the
                    transceiver kind of transceiver, return a promise rejected with a newly
                    created
                    TypeError.
If transceiver is not yet associated with a
                    media description [JSEP] (section 3.4.1.), then set
                    sender's track
                    undefined.
Let p be a new promise.
Run the following steps in parallel:
Determine if negotiation is needed to transmit
                        withTrack in place of the sender's existing track. Negotiation is not needed if withTrack is null or if the sender's existing track is ended (which appears as though the track was muted). Ignore which MediaStream the track resides in and the id attribute of the track in this determination. If negotiation is needed, then reject p with a newly
                        created
                        InvalidModificationError and abort these steps.
                      
If withTrack is null, have the sender stop sending, without negotiating. Otherwise, have the sender switch seamlessly to transmitting withTrack instead of the sender's existing track, without negotiating.
Queue a task that runs the following steps:
Return p.
Changing dimensions and/or frame rates might not require negotiation. Cases that may require negotiation include:
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| withTrack | MediaStreamTrack | ✔ | ✘ | 
Promise<void>
              getStatsGathers stats for this sender only and reports the result asynchronously.
When the 
              getStats() method is invoked, the user agent MUST run the following steps:
Let selector be the
                    RTCRtpSender
                    
Let p be a new promise, and run the following steps in parallel:
Gather the stats indicated by selector according to the stats selection algorithm.
Resolve p with the resulting
                        RTCStatsReport
                        
Return p.
Promise<RTCStatsReport>
              dictionary RTCRtpParameters {
    DOMString                                 transactionId;
    sequence<RTCRtpEncodingParameters>        encodings;
    sequence<RTCRtpHeaderExtensionParameters> headerExtensions;
    RTCRtcpParameters                         rtcp;
    sequence<RTCRtpCodecParameters>           codecs;
    RTCDegradationPreference                  degradationPreference = "balanced";
};
        RTCRtpParameters MemberstransactionId of type DOMStringAn unique identifier for the last set of parameters applied. Ensures that setParameters can only be called based on a previous getParameters, and that there are no intervening changes.
encodings of type sequence<RTCRtpEncodingParameters>A sequence containing parameters for RTP encodings of media.
headerExtensions of type sequence<RTCRtpHeaderExtensionParameters>A sequence containing parameters for RTP header extensions.
rtcp of type RTCRtcpParametersParameters used for RTCP.
codecs of type sequence<RTCRtpCodecParameters>A sequence containing the media codecs that an
                RTCRtpSender
                codecs[] with a mimeType attribute indicating retransmission via "audio/rtx" or "video/rtx", and an sdpFmtpLine attribute (providing the "apt" and "rtx-time" parameters). When using the
                setParameters method, the codecs sequence from the corresponding call to
                getParameters can be reordered and entries can be removed, but entries cannot be added, and the
                RTCRtpCodecParameters dictionary members cannot be modified.
              
degradationPreference of type
            RTCDegradationPreference,
            defaulting to "balanced"When bandwidth is constrained and the
                RtpSender needs to choose between degrading resolution or degrading framerate,
                degradationPreference indicates which is preferred.
              
dictionary RTCRtpEncodingParameters {
    unsigned long       ssrc;
    RTCRtpRtxParameters rtx;
    RTCRtpFecParameters fec;
    RTCDtxStatus        dtx;
    boolean             active;
    RTCPriorityType     priority;
    unsigned long       ptime;
    unsigned long       maxBitrate;
    double              maxFramerate;
    DOMString           rid;
    double              scaleResolutionDownBy = 1;
};
        RTCRtpEncodingParameters
          Membersssrc of type unsigned longThe SSRC of the RTP source stream of this encoding (non-RTX, non-FEC RTP stream). Read-only parameter.
rtx of type RTCRtpRtxParametersThe parameters used for RTX, or unset if RTX is not being used.
fec of type RTCRtpFecParametersThe parameters used for FEC, or unset if FEC is not being used.
dtx of type RTCDtxStatusFor an RTCRtpSender
                disabled causes discontinuous transmission to be turned off. Setting it to enabled causes discontinuous transmission to be turned on if it was negotiated (either via a codec-specific parameter or via negotiation of the CN codec). This attribute is ignored by a video sender.
active of type booleanFor an RTCRtpSender
                false causes this encoding to no longer be sent. Setting it to true causes this encoding to be sent. For an RTCRtpReceiver
                true indicates that this encoding is being decoded. A value of false indicates this encoding is no longer being decoded.
              
priority of type RTCPriorityTypeIndicates the priority of this encoding. It is specified in [ RTCWEB-TRANSPORT], Section 4.
ptime of type unsigned longFor an RTCRtpSender
                
maxBitrate of type unsigned longIndicates the maximum bitrate that can be used to send this encoding. The encoding may also be further constrained by other limits (such as maxFramerate or per-transport or per-session bandwidth limits) below the maximum specified here. maxBitrate is the Transport Independent Application Specific Maximum (TIAS) bandwidth defined in [RFC3890] Section 6.2.2, which is the maximum bandwidth needed without counting IP or other transport layers like TCP or UDP.
maxFramerate of type doubleIndicates the maximum framerate that can be used to send this encoding.
rid of type DOMStringIf set, this RTP encoding will be sent with the RID header extension as defined by [JSEP] (section 5.2.1.). The RID is not modifiable via
                setParameters. It can only be set or modified in
                addTransceiver.
scaleResolutionDownBy of type
            double, defaulting to
            1.0If the sender's kind is "video", the video's resolution will be scaled down in each dimension by the given value before sending. For example, if the value is 2.0, the video will be scaled down by a factor of 2 in each dimension, resulting in sending a video of one quarter the size. If the value is 1.0, the video will not be affected. The value must be greater than or equal to 1.0.
Usage of the attributes is defined in the table below:
| Attribute | Type | Receiver/Sender | Read/Write | 
|---|---|---|---|
| ssrc | unsigned long | Receiver/Sender | Read-only | 
| fec |  | Receiver/Sender | Read-only | 
| dtx |  | Sender | Read/Write | 
| rtx |  | Receiver/Sender | Read-only | 
| active | boolean | Sender | Read/Write | 
| priority |  | Sender | Read/Write | 
| ptime | unsigned long | Sender | Read/Write | 
| maxBitrate | unsigned long | Sender | Read/Write | 
| maxFramerate | double | Sender | Read/Write | 
| scaleResolutionDownBy | double | Sender | Read/Write | 
| rid | DOMString | Receiver/Sender | Read-only | 
enum RTCDtxStatus {
    "disabled",
    "enabled"
};
        | RTCDtxStatusEnumeration description | |
|---|---|
| disabled | Discontinuous transmission is disabled. | 
| enabled | Discontinuous transmission is enabled if negotiated. | 
enum RTCDegradationPreference {
    "maintain-framerate",
    "maintain-resolution",
    "balanced"
};
        | RTCDegradationPreferenceEnumeration description | |
|---|---|
| maintain-framerate | Degrade resolution in order to maintain framerate. | 
| maintain-resolution | Degrade framerate in order to maintain resolution. | 
| balanced | Degrade a balance of framerate and resolution. | 
dictionary RTCRtpRtxParameters {
    unsigned long ssrc;
};
        RTCRtpRtxParameters
          Membersssrc of type unsigned longThe SSRC of the RTP stream for RTX. Read-only parameter.
dictionary RTCRtpFecParameters {
    unsigned long ssrc;
};
        RTCRtpFecParameters
          Membersssrc of type unsigned longThe SSRC of the RTP stream for FEC. Read-only parameter.
dictionary RTCRtcpParameters {
    DOMString cname;
    boolean   reducedSize;
};
        RTCRtcpParameters Memberscname of type DOMStringThe Canonical Name (CNAME) used by RTCP (e.g. in SDES messages). Read-only parameter.
reducedSize of type booleanWhether reduced size RTCP [RFC5506] is configured (if true) or compound RTCP as specified in [RFC3550] (if false). Read-only parameter.
dictionary RTCRtpHeaderExtensionParameters {
    DOMString      uri;
    unsigned short id;
    boolean        encrypted;
};
        RTCRtpHeaderExtensionParameters
          Membersuri of type DOMStringThe URI of the RTP header extension, as defined in [ RFC5285]. Read-only parameter.
id of type unsigned shortThe value put in the RTP packet to identify the header extension. Read-only parameter.
encrypted of type booleanWhether the header extension is encryted or not. Read-only parameter.
dictionary RTCRtpCodecParameters {
    unsigned short payloadType;
    DOMString      mimeType;
    unsigned long  clockRate;
    unsigned short channels = 1;
    DOMString      sdpFmtpLine;
};
        RTCRtpCodecParameters
          MemberspayloadType of type unsigned shortThe RTP payload type. This value can be set to control which codec should be used to send a given encoding.
mimeType of type DOMStringThe codec MIME media type/subtype. Valid media types and subtypes are listed in [IANA-RTP-2].
clockRate of type unsigned longThe codec clock rate expressed in Hertz.
channels of type unsigned short, defaulting to
            1The number of channels (mono=1, stereo=2).
sdpFmtpLine of type DOMStringThe "format specific parameters" field from the "a=fmtp" line in the SDP corresponding to the codec, if one exists, as defined by [JSEP] (section 5.7.). For an
                RTCRtpSenderRTCRtpReceiver
dictionary RTCRtpCapabilities {
    sequence<RTCRtpCodecCapability>           codecs;
    sequence<RTCRtpHeaderExtensionCapability> headerExtensions;
};
        RTCRtpCapabilities Memberscodecs of type sequence<RTCRtpCodecCapability>Supported media codecs as well as entries for RTX, RED and FEC mechanisms. There will only be a single entry in
                codecs[] for retransmission via RTX, with
                sdpFmtpLine not present.
headerExtensions of type sequence<RTCRtpHeaderExtensionCapability>Supported RTP header extensions.
dictionary RTCRtpCodecCapability {
    DOMString      mimeType;
    unsigned long  clockRate;
    unsigned short channels = 1;
    DOMString      sdpFmtpLine;
};
        RTCRtpCodecCapability
          MembersThe RTCRtpCodecCapability dictionary provides information about codec capabilities. Only capability combinations that would utilize distinct payload types in a generated SDP offer are provided. For example:
mimeType of type DOMStringThe codec MIME media type/subtype. Valid media types and subtypes are listed in [IANA-RTP-2].
clockRate of type unsigned longThe codec clock rate expressed in Hertz.
channels of type unsigned short, defaulting to
            1The maximum number of channels (mono=1, stereo=2).
sdpFmtpLine of type DOMStringThe "format specific parameters" field from the "a=fmtp" line in the SDP corresponding to the codec, if one exists.
dictionary RTCRtpHeaderExtensionCapability {
    DOMString uri;
};
        RTCRtpHeaderExtensionCapability
          Membersuri of type DOMStringThe URI of the RTP header extension, as defined in [ RFC5285].
RTCRtpReceiver Interface
      The RTCRtpReceiver interface allows an application to inspect the receipt of a MediaStreamTrack.
To create an RTCRtpReceiver with kind, kind, and optionally an id string, id, run the following steps:
Let receiver be a new RTCRtpReceiver
            
Let track be a new MediaStreamTrack
            
Initialize track.kind to kind.
If an id string, id, was given as input to this algorithm, initialize track.id to id. (Otherwise the value generated when track was created will be used.)
Initialize track.label to the result of concatenating the string "remote " with kind.
Initialize track.readyState to live.
Initialize track.muted to true. See the
            MediaStreamTrackmuted attribute reflects if a
            MediaStreamTrack
            
Set receiver.track to track.
Return receiver.
interface RTCRtpReceiver {
    readonly attribute MediaStreamTrack  track;
    readonly attribute RTCDtlsTransport? transport;
    readonly attribute RTCDtlsTransport? rtcpTransport;
    // Feature at risk
    static RTCRtpCapabilities             getCapabilities(DOMString kind);
    RTCRtpParameters                      getParameters();
    sequence<RTCRtpContributingSource>    getContributingSources();
    sequence<RTCRtpSynchronizationSource> getSynchronizationSources();
    Promise<RTCStatsReport>               getStats();
};
        track of type MediaStreamTrack, readonlyThe track attribute is the track that is associated with this
                RTCRtpReceiver
                mute event is fired at
                track. If and when packets are received again, the unmute event is fired at track.
Note that track.stop() is final, although clones are not affected. Since
                receiver.track.stop() does not implicitly stop receiver, Receiver Reports continue to be sent.
transport of type RTCDtlsTransport, readonly,
            nullableThe transport attribute is the transport over which media for the receiver's track is received in the form of RTP packets. Prior to construction of the RTCDtlsTransport
                transport attribute will be null. When bundling is used, multiple RTCRtpReceiver
                transport and will all receive RTP and RTCP over the same transport.
rtcpTransport of type RTCDtlsTransport, readonly,
            nullableThe rtcpTransport attribute is the transport over which RTCP is sent and received. Prior to construction of the RTCDtlsTransport
                rtcpTransport attribute will be null. When RTCP mux is used (or bundling, which mandates RTCP mux),
                rtcpTransport will be null, and both RTP and RTCP traffic will flow over transport.
getCapabilities, staticThe getCapabilities() method returns the most optimistic view of the capabilities of the system for receiving media of the given kind. It does not reserve any resources, ports, or other state but is meant to provide a way to discover the types of capabilities of the browser including which codecs may be supported.
These capabilities provide generally persistent cross-origin information on the device and thus increases the fingerprinting surface of the application. In privacy-sensitive contexts, browsers can consider mitigations such as reporting only a common subset of the capabilities.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| kind | DOMString | ✘ | ✘ | 
RTCRtpCapabilities
              getParametersThe getParameters() method returns the RTCRtpReceiver object's current parameters for how track is decoded.
RTCRtpParameters
              getContributingSourcesReturns an RTCRtpContributingSource
                
sequence<RTCRtpContributingSource>
              getSynchronizationSourcesReturns an RTCRtpSynchronizationSource
                
sequence<RTCRtpSynchronizationSource>
              getStatsGathers stats for this receiver only and reports the result asynchronously.
When the 
              getStats() method is invoked, the user agent MUST run the following steps:
Let selector be the
                    RTCRtpReceiver
                    
Let p be a new promise, and run the following steps in parallel:
Gather the stats indicated by selector according to the stats selection algorithm.
Resolve p with the resulting
                        RTCStatsReport
                        
Return p.
Promise<RTCStatsReport>
              The RTCRtpContributingSource and
        RTCRtpSynchronizationSource objects contain information about a given contributing source (CSRC) or synchronization source (SSRC), including the most recent time a packet that the source contributed to was played out. The browser MUST keep information from RTP packets received in the previous 10 seconds. When the first audio frame contained in an RTP packet is delivered to the
        RTCRtpReceiver
        MediaStreamTrack
        RTCRtpContributingSource
        RTCRtpSynchronizationSource
        RTCRtpSynchronizationSource
        RTCRtpContributingSource
        
RTCRtpSynchronizationSource
          RTCRtpContributingSource
          RTCRtpReceiver
          interface RTCRtpContributingSource {
    readonly attribute DOMHighResTimeStamp timestamp;
    readonly attribute unsigned long       source;
    readonly attribute byte?               audioLevel;
};
        timestamp of type DOMHighResTimeStamp, readonlyThe timestamp of type DOMHighResTimeStamp [HIGHRES-TIME], indicating the most recent time of playout of an RTP packet containing the source. The timestamp is defined in [ HIGHRES-TIME] and corresponds to a local clock.
source of type unsigned long, readonlyThe CSRC identifier of the contributing source.
audioLevel of type byte, readonly , nullableThe audio level contained in the last RTP packet played from this source. audioLevel will be the level value defined in [RFC6465] if the RFC 6465 header extension is present, and otherwise null. RFC 6465 defines the level as a integral value from 0 to 127 representing the audio level in negative decibels relative to the loudest signal that the system could possibly encode. Thus, 0 represents the loudest signal the system could possibly encode, and 127 represents silence.
              
interface RTCRtpSynchronizationSource {
    readonly attribute DOMHighResTimeStamp timestamp;
    readonly attribute unsigned long       source;
    readonly attribute byte                audioLevel;
    readonly attribute boolean?            voiceActivityFlag;
};
        timestamp of type DOMHighResTimeStamp, readonlyThe timestamp of type DOMHighResTimeStamp [HIGHRES-TIME], indicating the most recent time of playout of an RTP packet from the source. The timestamp is defined in [ HIGHRES-TIME] and corresponds to a local clock.
source of type unsigned long, readonlyThe SSRC identifier of the synchronization source.
audioLevel of type byte, readonly, nullableThe audio level contained in the last RTP packet played from this source. audioLevel will be the level value defined in [RFC6464], if the RFC 6464 header extension is present. If the RFC 6464 extension header is not present, the browser will compute a value for audioLevel as if it had come from RFC 6464.
              
voiceActivityFlag of type boolean, readonly, nullableWhether the last RTP packet played from this source contains voice activity (true) or not (false). If the RFC 6464 extension header was not present, or if the peer has signaled that it is not using the V bit by setting the "vad" extension attribute to "off", as described in [RFC6464], Section 4,
                voiceActivityFlag will be null.
RTCRtpTransceiver Interface
      The RTCRtpTransceiverRTCRtpSenderRTCRtpReceivermid.
The transceiver kind of an
        RTCRtpTransceiver
        RTCRtpReceiver
        MediaStreamTrack
        
To create an RTCRtpTransceiver with an
        RTCRtpReceiver
        RTCRtpSender
        
Let transceiver be a new
            RTCRtpTransceiver
            
Set transceiver.sender to sender.
Set transceiver.receiver to receiver.
Set transceiver.stopped to false.
Return transceiver.
interface RTCRtpTransceiver {
    readonly attribute DOMString?                  mid;
    [SameObject]
    readonly attribute RTCRtpSender                sender;
    [SameObject]
    readonly attribute RTCRtpReceiver              receiver;
    readonly attribute boolean                     stopped;
    readonly attribute RTCRtpTransceiverDirection  direction;
    readonly attribute RTCRtpTransceiverDirection? currentDirection;
    void setDirection(RTCRtpTransceiverDirection direction);
    void stop();
    void setCodecPreferences(sequence<RTCRtpCodecCapability> codecs);
};
        mid of type DOMString, readonly, nullableThe mid attribute is the mid negotatiated and present in the local and remote descriptions as defined in [JSEP] (section 5.2.1. and section 5.3.1.). Before negotiation is complete, the mid value may be null. After rollbacks, the value may change from a non-null value to null.
sender of type RTCRtpSender, readonlyThe sender attribute is the
                RTCRtpSendermid
receiver of type RTCRtpReceiver, readonlyThe receiver attribute is the
                RTCRtpReceivermid
stopped of type boolean, readonlyThe stopped attribute indicates that the sender of this transceiver will no longer send, and that the receiver will no longer receive. It is true if either stop has been called or if setting the local or remote description has caused the RTCTransceiver to be stopped.
direction of type RTCRtpTransceiverDirection,
            readonlyAs defined in [JSEP] (section 4.2.4.), the
                direction attribute indicates the preferred direction of this transceiver, which will be used in calls to createOffer
                createAnswer
                setDirection
                
currentDirection of type RTCRtpTransceiverDirection,
            readonly, nullableAs defined in [JSEP] (section 4.2.5.), the
                currentDirection attribute indicates the current direction negotiated for this transceiver. The value of
                currentDirection is independent of the value of
                RTCRtpEncodingParameters. since one cannot be deduced from the other. If this transceiver has never been represented in an offer/answer exchange, or if the transceiver is
                active
                stopped
                
setDirectionThe setDirection method sets the direction of the RTCRtpTransceiver. Calls to setDirection() do not take effect immediately. Instead, future calls to createOffer and createAnswer mark the corresponding media description as sendrecv, sendonly,
                recvonly or inactive as defined in
                [JSEP] (section 5.2.2. and section 5.3.2.). Calling
                setDirection() updates the
              negotiation-needed flag for the
                RTCRtpTransceiver's associated
                RTCPeerConnection
                
When this method is invoked, the user agent MUST run the following steps:
Let transceiver be the
                    RTCRtpTransceiver
                    
Let newDirection be the argument to setDirection.
If newDirection is equal to
                    transceiver.direction, abort these steps.
If newDirection has a value other than sendrecv, sendonly,
                    recvonly or inactive,
                    throw an InvalidModificationError.
Set transceiver.direction to newDirection.
Let connection be the
                    RTCPeerConnection
                    
Update the negotiation-needed flag for connection.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| direction | RTCRtpTransceiverDirection | ✘ | ✘ | 
void
              stopThe stop method irreversibly stops the RTCRtpTransceiverstop() updates the
              negotiation-needed flag for the
                RTCRtpTransceiver's associated
                RTCPeerConnection
                
Stopping a transceiver will cause future calls to createOffer to generate a zero port in the media description for the corresponding transceiver, as defined in 
              [JSEP] (section 4.2.1).
When this method is invoked, to stop the RTCRtpTransceiver transceiver, the user agent MUST run the following steps:
If transceiver.stopped is
                    true, abort these steps.
Let connection be the
                    RTCPeerConnection
                    
If connection's [[isClosed]] slot is
                    true, throw an
                    InvalidStateError.
Let sender be transceiver.sender.
Let receiver be transceiver.receiver.
Stop sending media with sender.
Send an RTCP BYE for each SSRC in
                    transceiver.sender.getParameters().encodings[i].ssrc,
                    transceiver.sender.getParameters().encodings[i].fec.ssrc and
                    transceiver.sender.getParameters().encodings[i].rtx.ssrc where i goes from 0 to
                    transceiver.sender.getParameters().encodings.length-1.
Stop receiving media with receiver.
receiver.track is now said to be
                    
                  ended.
Set transceiver.stopped to true.
Update the negotiation-needed flag for connection.
When a remote description is applied with a zero port in the media description for the corresponding transceiver, as defined in 
              [JSEP] (section 4.2.2), the user agent MUST run the above steps as if stop had been called. In addition, since
                transceiver.receiver.track has ended, the steps described in track ended
                MUST be followed.
void
              setCodecPreferencesThe setCodecPreferences method overrides the default codec preferences used by the user agent. When generating a session description using either
                createOffer or createAnswer, the
                user agent MUST use the indicated codecs, in the order specified in the codecs argument, for the media section corresponding to this RTCRtpTransceiver. Note that calls to createAnswer will use only the common subset of these codecs and the codecs that appear in the offer.
              
This method allows applications to disable the negotiation of specific codecs. It also allows an application to cause a remote peer to prefer the codec that appears first in the list for sending.
Codec preferences remain in effect for all calls to
                createOffer and createAnswer that include this RTCRtpTransceiver until this method is called again. Setting codecs to an empty sequence resets codec preferences to any default value.
The codecs sequence passed into
                setCodecPreferences can only contain codecs that are returned by RTCRtpSender.getCapabilities(kind) or
                RTCRtpReceiver.getCapabilities(kind), where
                kind is the kind of the
                RTCRtpTransceiver on which the method is called. Additionally, the RTCRtpCodecParameters dictionary members cannot be modified. If codecs does not fulfill these requirements, the user agent MUST throw an InvalidAccessError.
              
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| codecs | sequence<RTCRtpCodecCapability> | ✘ | ✘ | 
void
              Together, the setDirection and
          replaceTrack methods enable developers to implement "hold" scenarios.
To send music to a peer and cease rendering received audio (music-on-hold):
// Assume we have an audio transceiver and a music track named musicTrack
audio.sender.replaceTrack(musicTrack);
// Mute received audio
audio.receiver.track.enabled = "false";
// Set the direction to send-only (requires negotiation)
audio.setDirection("sendonly");
        To respond to a remote peer's "sendonly" offer:
// Stop sending audio
audio.sender.replaceTrack(null);
// Set the direction recvonly (requires negotiation)
audio.setDirection("recvonly");
// Apply the sendonly offer, and then call createAnswer
// and send a recvonly answer
pc.setRemoteDescription(sendonlyOffer).then(doAnswer).catch(onSignalingError);
        To stop sending music and send audio captured from a microphone, as well to render received audio:
//assume we have an audio transceiver and a microphone track named micTrack
audio.sender.replaceTrack(micTrack);
// Unmute received audio
audio.receiver.track.enabled = "true";
// // Set the direction to sendrecv (requires negotiation)
audio.setDirection("sendrecv");
        To respond to being taken off hold by a remote peer:
// Start sending audio
audio.sender.replaceTrack(micTrack);
// Set the direction sendrecv (requires negotiation)
audio.setDirection("sendrecv");
// Apply the sendrecv offer, and then call createAnswer
// and send a sendrecv answer
pc.setRemoteDescription(sendrecvOffer).then(doAnswer).catch(onSignalingError);
        RTCDtlsTransport Interface
      The RTCDtlsTransport
        RTCRtpSender
        RTCRtpReceiver
        RTCDtlsTransport interface allows access to information about the underlying transport and the security added.
        RTCDtlsTransport
        setLocalDescription() and
        setRemoteDescription().
interface RTCDtlsTransport {
    readonly attribute RTCIceTransport       transport;
    readonly attribute RTCDtlsTransportState state;
    sequence<ArrayBuffer> getRemoteCertificates();
             attribute EventHandler          onstatechange;
};
        transport of type RTCIceTransport, readonlyThe transport attribute is the underlying transport that is used to send and receive packets. The underlying transport may not be shared between multiple active
                RTCDtlsTransport
                
state of type RTCDtlsTransportState, readonlyThe state attribute MUST return the state of the transport.
              
onstatechange of type EventHandlerstatechange
              RTCDtlsTransport state changes.
            getRemoteCertificatesReturns the certificate chain in use by the remote side, with each certificate encoded in binary Distinguished Encoding Rules (DER) [X690]. getRemoteCertificates() will return an empty list prior to selection of the remote certificate, which will be completed by the time
                RTCDtlsTransportState
                
sequence<ArrayBuffer>
              RTCDtlsTransportState Enumenum RTCDtlsTransportState {
    "new",
    "connecting",
    "connected",
    "closed",
    "failed"
};
        | Enumeration description | |
|---|---|
| new | DTLS has not started negotiating yet. | 
| connecting | DTLS is in the process of negotiating a secure connection. | 
| connected | DTLS has completed negotiation of a secure connection. | 
| closed | The transport has been closed. | 
| failed | The transport has failed as the result of an error (such as a failure to validate the remote fingerprint). | 
The RTCDtlsFingerprint dictionary includes the hash function algorithm and certificate fingerprint as described in [
          RFC4572].
dictionary RTCDtlsFingerprint {
    DOMString algorithm;
    DOMString value;
};
          algorithm of type DOMStringOne of the the hash function algorithms defined in the 'Hash function Textual Names' registry, initially specified in [ RFC4572] Section 8. As noted in [JSEP] Section 5.2.1, the digest algorithm used for the fingerprint matches that used in the certificate signature.
value of type DOMStringThe value of the certificate fingerprint in lowercase hex string as expressed utilizing the syntax of 'fingerprint' in [ RFC4572] Section 5.
RTCIceTransport Interface
      The RTCIceTransport
        RTCIceTransport
        setLocalDescription() and
        setRemoteDescription(). The underlying ICE state is managed by the ICE agent; as such, the state of an
        RTCIceTransport
        
When the ICE Agent indicates that it began gathering a
        generation of candidates for an RTCIceTransport
        
Let connection be the
            RTCPeerConnection
            
If connection's [[isClosed]] slot is
            true, abort these steps.
Let transport be the RTCIceTransport
            
Set transport's gatheringState
            gathering
            
Fire a simple event named gatheringstatechange
            
Update the ICE gathering state of connection.
When the ICE Agent indicates that it finished gathering a
        generation of candidates for an RTCIceTransport
        
Let connection be the
            RTCPeerConnection
            
If connection's [[isClosed]] slot is
            true, abort these steps.
Let transport be the RTCIceTransport
            
Create an RTCIceCandidate
            sdpMid
            sdpMLineIndex
            RTCIceTransport
            ufrag
            candidate
            
Fire an event named icecandidate
            
If another generation of candidates is still being gathered, abort these steps.
Set transport's gatheringState
            complete
            
Fire a simple event named gatheringstatechange
            
Update the ICE gathering state of connection.
When the ICE Agent indicates that a new ICE candidate is available for an RTCIceTransport
        
Let connection be the
            RTCPeerConnection
            
If connection's [[isClosed]] slot is
            true, abort these steps.
Let transport be the RTCIceTransport
            
Add the candidate to connection's localDescription
            
Create an RTCIceCandidate
            
Add newCandidate to transport's set of local candidates.
Fire an event named icecandidate
            
When the ICE Agent indicates that the
        RTCIceTransportState
        RTCIceTransport
        
Let connection be the
            RTCPeerConnection
            
If connection's [[isClosed]] slot is
            true, abort these steps.
Let transport be the RTCIceTransport
            
Let newState be the new indicated
            RTCIceTransportState
            
Set transport's state
            
Fire a simple event named statechange
            
Update the ICE connection state of connection.
Update the connection state of connection.
When the ICE Agent indicates that the selected candidate pair for an RTCIceTransport
        
Let connection be the
            RTCPeerConnection
            
If connection's [[isClosed]] slot is
            true, abort these steps.
Let transport be the RTCIceTransport
            
Let newCandidatePair be a newly created
            RTCIceCandidatePair
            null otherwise.
Set transport's selected candidate pair to newCandidatePair.
Fire a simple event named
            selectedcandidatepairchange
            
interface RTCIceTransport {
    readonly attribute RTCIceRole           role;
    readonly attribute RTCIceComponent      component;
    readonly attribute RTCIceTransportState state;
    readonly attribute RTCIceGathererState  gatheringState;
    sequence<RTCIceCandidate> getLocalCandidates();
    sequence<RTCIceCandidate> getRemoteCandidates();
    RTCIceCandidatePair?      getSelectedCandidatePair();
    RTCIceParameters?         getLocalParameters();
    RTCIceParameters?         getRemoteParameters();
             attribute EventHandler         onstatechange;
             attribute EventHandler         ongatheringstatechange;
             attribute EventHandler         onselectedcandidatepairchange;
};
        role of type RTCIceRole, readonlyThe role attribute MUST return the ICE role of the transport.
component of type RTCIceComponent, readonlyThe component attribute MUST return the ICE component of the transport. When RTP/RTCP mux is used, a single
                RTCIceTransport
                component is set to "RTP".
state of type RTCIceTransportState, readonlyThe state attribute MUST return the state of the transport.
gatheringState of type RTCIceGatheringState, readonlyThe gathering
              state attribute MUST return the gathering state of the transport.
onstatechange of type EventHandlerstatechange
              RTCIceTransport state changes.
            ongatheringstatechange of type
            EventHandlergatheringstatechange
              RTCIceTransportgathering state changes.
            onselectedcandidatepairchange of type
            EventHandlerselectedcandidatepairchange
              RTCIceTransport
              getLocalCandidatesReturns a sequence describing the local ICE candidates gathered for this RTCIceTransport
                onicecandidate
                
sequence<RTCIceCandidate>
              getRemoteCandidatesReturns a sequence describing the remote ICE candidates received by this RTCIceTransport
                addIceCandidate()
sequence<RTCIceCandidate>
              getSelectedCandidatePairReturns the selected candidate pair on which packets are sent, or null if there is no such pair.
RTCIceCandidatePair, nullable
              getLocalParametersReturns the local ICE parameters received by this
                RTCIceTransport
                setLocalDescription
                null if the parameters have not yet been received.
              
RTCIceParameters, nullable
              getRemoteParametersReturns the remote ICE parameters received by this
                RTCIceTransport
                setRemoteDescription
                null if the parameters have not yet been received.
              
RTCIceParameters, nullable
              dictionary RTCIceParameters {
    DOMString usernameFragment;
    DOMString password;
};
        RTCIceParameters Membersdictionary RTCIceCandidatePair {
    RTCIceCandidate local;
    RTCIceCandidate remote;
};
        RTCIceCandidatePair
          Memberslocal of type RTCIceCandidateThe local ICE candidate.
remote of type RTCIceCandidateThe remote ICE candidate.
RTCIceGathererState Enumenum RTCIceGathererState {
    "new",
    "gathering",
    "complete"
};
        | Enumeration description | |
|---|---|
| new | The was just created, and has not started gathering candidates yet. | 
| gathering | The is in the process of gathering candidates. | 
| complete | The has completed gathering and the end-of-candidates indication for this transport has been sent. It will not gather candidates again until an ICE restart causes it to restart. | 
RTCIceTransportState Enumenum RTCIceTransportState {
    "new",
    "checking",
    "connected",
    "completed",
    "failed",
    "disconnected",
    "closed"
};
        | Enumeration description | |
|---|---|
| new | The is gathering candidates and/or waiting for remote candidates to be supplied, and has not yet started checking. | 
| checking | The has received at least one remote candidate and is checking candidate pairs and has either not yet found a connection or consent checks [RFC7675] have failed on all previously successful candidate pairs. In addition to checking, it may also still be gathering. | 
| connected | The has found a usable connection, but is still checking other candidate pairs to see if there is a better connection. It may also still be gathering and/or waiting for additional remote candidates. If consent checks [RFC7675] fail on the connection in use, and there are no other successful candidate pairs available, then the state transitions to "checking" (if there are candidate pairs remaining to be checked) or "disconnected" (if there are no candidate pairs to check, but the peer is still gathering and/or waiting for additional remote candidates). | 
| completed | The has finished gathering, received an indication that there are no more remote candidates, finished checking all candidate pairs and found a connection. If consent checks [RFC7675] subsequently fail on all successful candidate pairs, the state transitions to "failed". | 
| failed | The has finished gathering, received an indication that there are no more remote candidates, finished checking all candidate pairs, and all pairs have either failed connectivity checks or have lost consent. | 
| disconnected | The ICE Agent has determined that connectivity is currently lost for this . This is more aggressive thanfailed, and may trigger intermittently (and resolve itself without action) on a flaky network. The way this state is determined is implementation dependent. Examples include:
 has finished checking all existing candidates pairs and failed to find a connection (or consent checks [RFC7675] once successful, have now failed), but it is still gathering and/or waiting for additional remote candidates. | 
| closed | The has shut down and is no longer responding to STUN requests. | 
The failed and completed states require an indication that there are no additional remote candidates. This can be indicated by calling addIceCandidate with a candidate value whose candidate property is set to an empty string or by canTrickleIceCandidates being set to
        false.
Some example transitions might be:
RTCIceTransport
          setLocalDescription or setRemoteDescription):
          newnew, remote candidates received):
          checkingchecking, found usable connection):
          connectedchecking, checks fail but gathering still in progress): disconnectedchecking, gave up): faileddisconnected, new local candidates):
          checkingconnected, finished all checks):
          completedcompleted, lost connectivity):
          disconnectednewRTCPeerConnection.close(): closedRTCIceRole Enumenum RTCIceRole {
    "controlling",
    "controlled"
};
        | Enumeration description | |
|---|---|
| controlling | A controlling agent as defined by [ICE], Section 3. | 
| controlled | A controlled agent as defined by [ICE], Section 3. | 
RTCIceComponent Enumenum RTCIceComponent {
    "rtp",
    "rtcp"
};
        | Enumeration description | |
|---|---|
| rtp | The ICE Transport is used for RTP (or RTP/RTCP-multiplexing), as defined in [ICE], Section 4.1.1.1. Protocols multiplexed with RTP (e.g. data channel) share its component ID. | 
| rtcp | The ICE Transport is used for RTCP as defined by [ICE], Section 4.1.1.1. | 
The track
        RTCTrackEvent
        
Firing an
      RTCTrackEvent event named e with an
        RTCRtpReceiver
        MediaStreamTrack
        MediaStream[] streams, means that an event with the name e, which does not bubble (except where otherwise stated) and is not cancelable (except where otherwise stated), and which uses the RTCTrackEvent
        receiver
        track
        streams
        
[Constructor(DOMString type, RTCTrackEventInit eventInitDict)]
interface RTCTrackEvent : Event {
    readonly attribute RTCRtpReceiver           receiver;
    readonly attribute MediaStreamTrack         track;
    [SameObject]
    readonly attribute FrozenArray<MediaStream> streams;
    readonly attribute RTCRtpTransceiver        transceiver;
};
        RTCTrackEvent| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| type | DOMString | ✘ | ✘ | |
| eventInitDict | RTCTrackEventInit | ✘ | ✘ | 
receiver of type RTCRtpReceiver, readonlyThe receiver attribute represents the RTCRtpReceiver
                
track of type MediaStreamTrack, readonlyThe track attribute represents the
                MediaStreamTrack
                RTCRtpReceiver
                receiver.
streams of type FrozenArray<MediaStream>,
            readonlyThe streams attribute returns an array of MediaStream objects representing the
                MediaStreams that this event's
                track is a part of.
transceiver of type RTCRtpTransceiver, readonlyThe transceiver attribute represents the RTCRtpTransceiver
                
dictionary RTCTrackEventInit : EventInit {
    required RTCRtpReceiver        receiver;
    required MediaStreamTrack      track;
             sequence<MediaStream> streams = [];
    required RTCRtpTransceiver     transceiver;
};
        RTCTrackEventInit Membersreceiver of type RTCRtpReceiver, requiredThe receiver attribute represents the
                RTCRtpReceiver
                
track of type MediaStreamTrack, requiredThe track attribute represents the
                MediaStreamTrack
                RTCRtpReceiver
                receiver.
streams of type sequence<MediaStream>,
            defaulting to []The streams attribute returns an array of
                MediaStream objects representing the
                MediaStreams that this event's
                track is a part of.
transceiver of type RTCRtpTransceiver, requiredThe transceiver attribute represents the
                RTCRtpTransceiver
                
The Peer-to-peer Data API lets a web application send and receive generic application data peer-to-peer. The API for sending and receiving data models the behavior of WebSockets [WEBSOCKETS-API].
The Peer-to-peer data API extends the
        RTCPeerConnection
        
partial interface RTCPeerConnection {
    readonly attribute RTCSctpTransport? sctp;
    RTCDataChannel createDataChannel(USVString label,
                                     optional RTCDataChannelInit dataChannelDict);
             attribute EventHandler      ondatachannel;
};
        sctp of type RTCSctpTransport, readonly,
            nullableThe SCTP transport over which SCTP data is sent and received. If SCTP has not been negotiated, the value is null. This attribute MUST return the RTCSctpTransport
                sctpTransport]] internal slot.
ondatachannel of type EventHandlerdatachannel
              createDataChannelCreates a new RTCDataChannel
                RTCDataChannelInit
                
When the createDataChannel method is invoked, the user agent MUST run the following steps.
              
Let connection be the
                    RTCPeerConnection
                    
If connection's [[isClosed]] slot is
                    true, throw an
                    InvalidStateError.
Let channel be a newly created
                    RTCDataChannel
                    
Initialize channel's label
                    
Set channel's ordered
                    maxPacketLifeTime
                    maxRetransmits
                    protocol
                    negotiated
                    id
                    priority
                    null if the corresponding dictionary member is missing.
                  
maxPacketLifeTime
                      maxRetransmits
                      id
                      negotiated is false and label is longer than 65535 bytes long, throw a
                  TypeError.
                negotiated is false and
                  protocol is longer than 65535 bytes long,
                  throw a TypeError.
                If both the maxPacketLifeTime
                    maxRetransmits
                    SyntaxError.
If an attribute, either maxPacketLifeTime
                    maxRetransmits
                    
If id
                    TypeError.
If the id
                    null (due to no ID being passed into createDataChannel), and the DTLS role of the SCTP transport has already been negotiated, then initialize id
                    id member of the dictionary is taken by an existing RTCDataChannel
                    ResourceInUse exception.
id
                      null after this step, it will be populated once the DTLS role is determined during the process of 
                    setting an RTCSessionDescription.
                    Return channel and continue the following steps in the background.
Create channel's associated underlying data transport and configure it according to the relevant properties of channel.
If channel was the first
                    RTCDataChannel
                    
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| label | USVString | ✘ | ✘ | |
| dataChannelDict | RTCDataChannelInit | ✘ | ✔ | 
RTCDataChannel
              RTCSctpTransport Interface
        The RTCSctpTransport
          
interface RTCSctpTransport {
    readonly attribute RTCDtlsTransport transport;
    readonly attribute unsigned long    maxMessageSize;
};
          transport of type RTCDtlsTransport, readonlyThe transport over which all SCTP packets for data channels will be sent and received.
maxMessageSize of type unsigned long, readonlyThe maximum size of data that can be passed to
                  RTCDataChannel
                  send()
                  
RTCDataChannel
      The RTCDataChannel
        RTCDataChannel
        RTCPeerConnection
        
There are two ways to establish a connection with
        RTCDataChannel
        RTCDataChannel
        negotiated
        RTCDataChannelInit
        RTCDataChannelEvent
        RTCDataChannel
        RTCDataChannel
        RTCDataChannel
        negotiated
        RTCDataChannelInit
        RTCDataChannel
        negotiated
        RTCDataChannelInit
        id
        RTCDataChannel
        id
        
Each RTCDataChannel
        
A RTCDataChannel
        maxRetransmits
        maxPacketLifeTime
        
A RTCDataChannel
        createDataChannel
        RTCDataChannelEvent
        connecting state. When the
        RTCDataChannel
        RTCDataChannel as open.
When the user agent is to announce a RTCDataChannel as
      open, the user agent MUST queue a task to run the following steps:
      
If the associated RTCPeerConnection
            true, abort these steps.
Let channel be the RTCDataChannel
            
Set channel's readyState
            open.
Fire a simple event named open
            
When an underlying data transport is to be announced (the other peer created a channel with negotiated
        
If the associated RTCPeerConnection
            true, abort these steps.
Let channel be a newly created
            RTCDataChannel
            
Let configuration be an information bundle received from the other peer as a part of the process to establish the underlying data transport described by the WebRTC DataChannel Protocol specification [RTCWEB-DATA-PROTOCOL].
Initialize channel's label
            ordered
            maxPacketLifeTime
            maxRetransmits
            protocol
            negotiated
            id
            
Set channel's readyState
            connecting.
Fire a datachannel event named
            datachannel
            RTCPeerConnection
            
An RTCDataChannel
        close
        readyState
        closing. This will eventually render the data transport closed.
When a RTCDataChannel
        
Let channel be the RTCDataChannel
            
Set channel's readyState
            closed.
If the transport was closed
            with an error, fire an RTCError event at channel with
            errorDetail set to "sctp-failure".
Fire a simple event named close
            
In some cases, the user agent may be unable to create an
        RTCDataChannel
        id
        RTCDataChannel
        
Let channel be the RTCDataChannel
            
Set channel's readyState
            closed.
Fire an RTCError event at channel with
            errorDetail set to "data-channel-failure".
Fire a simple event named close
            
interface RTCDataChannel : EventTarget {
    readonly attribute USVString           label;
    readonly attribute boolean             ordered;
    readonly attribute unsigned short?     maxPacketLifeTime;
    readonly attribute unsigned short?     maxRetransmits;
    readonly attribute USVString           protocol;
    readonly attribute boolean             negotiated;
    readonly attribute unsigned short?     id;
    readonly attribute RTCPriorityType     priority;
    readonly attribute RTCDataChannelState readyState;
    readonly attribute unsigned long       bufferedAmount;
             attribute unsigned long       bufferedAmountLowThreshold;
             attribute EventHandler        onopen;
             attribute EventHandler        onbufferedamountlow;
             attribute EventHandler        onerror;
             attribute EventHandler        onclose;
    void close();
             attribute EventHandler        onmessage;
             attribute DOMString           binaryType;
    void send(USVString data);
    void send(Blob data);
    void send(ArrayBuffer data);
    void send(ArrayBufferView data);
};
        label of type USVString, readonlyThe label attribute represents a label that can be used to distinguish this
                RTCDataChannel
                RTCDataChannel
                RTCDataChannel
                RTCDataChannel
                
ordered of type boolean, readonlyThe ordered attribute returns true if the RTCDataChannel
                RTCDataChannel
                
maxPacketLifeTime of type unsigned short, readonly,
            nullableThe maxPacketLifeTime attribute returns the length of the time window (in milliseconds) during which transmissions and retransmissions may occur in unreliable mode, or null if unset. The attribute MUST be initialized to null by default and MUST return the value to which it was set when the RTCDataChannel
                
maxRetransmits of type unsigned short, readonly,
            nullableThe maxRetransmits attribute returns the maximum number of retransmissions that are attempted in unreliable mode, or null if unset. The attribute
                MUST be initialized to null by default and MUST return the value to which it was set when the RTCDataChannel
                
protocol of type USVString, readonlyThe protocol attribute returns the name of the sub-protocol used with this
                RTCDataChannel
                RTCDataChannel
                
negotiated of type boolean, readonlyThe negotiated attribute returns true if this RTCDataChannel
                RTCDataChannel
                
id of type unsigned short, readonly, nullableThe id attribute returns the ID for this
                RTCDataChannel
                null by default, which is what will be returned if the ID was not provided at channel creation time, and the DTLS role of the SCTP transport has not yet been negotiated. Otherwise, it will return the ID that was either selected by the script or generated by the user agent according to [
                RTCWEB-DATA-PROTOCOL]. After the ID is set to a non-null value, it will not change.
priority of type RTCPriorityType, readonlyThe priority attribute returns the priority for this RTCDataChannel
                RTCDataChannel
                
readyState of type RTCDataChannelState, readonlyThe readyState attribute represents the state of the RTCDataChannel object. It MUST return the value to which the user agent last set it (as defined by the processing model algorithms).
bufferedAmount of type unsigned long, readonlyThe bufferedAmount attribute MUST return the number of bytes of application data (UTF-8 text and binary data) that have been queued using
                send()
                send()
                
bufferedAmountLowThreshold of type unsigned longThe bufferedAmountLowThreshold attribute sets the threshold at which the bufferedAmount
                bufferedAmount
                bufferedamountlow
                bufferedAmountLowThreshold
                RTCDataChannel
                
onopen of type EventHandleropen
              onbufferedamountlow of type
            EventHandlerbufferedamountlow
              onerror of type EventHandlerThe event type of this event handler is RTCErrorEvent
                errorDetail contains "sctp-failure",
                sctpCauseCode contains the SCTP Cause Code value, and message contains the SCTP Cause-Specific-Information, possibly with additional text.
onclose of type EventHandlerThe event type of this event handler is
                close
                
onmessage of type EventHandlerThe event type of this event handler is
                message
                
binaryType of type DOMStringThe binaryType attribute MUST, on getting, return the value to which it was last set. On setting, the user agent MUST set the IDL attribute to the new value. When a RTCDataChannel
                binaryType
                blob".
This attribute controls how binary data is exposed to scripts. See the [WEBSOCKETS-API] for more information.
closeCloses the RTCDataChannel
                RTCDataChannel
                
When the close method is called, the user agent
                MUST run the following steps:
Let channel be the
                    RTCDataChannel
                    
If channel's readyState
                    closing or closed, then abort these steps.
                  
Set channel's readyState
                    closing.
If the closing procedure has not started yet, start it.
void
              sendRun the steps described by the send()
                string object.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| data | USVString | ✘ | ✘ | 
void
              sendRun the steps described by the send()
                Blob object.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| data | Blob | ✘ | ✘ | 
void
              sendRun the steps described by the send()
                ArrayBuffer object.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| data | ArrayBuffer | ✘ | ✘ | 
void
              sendRun the steps described by the send()
                ArrayBufferView object.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| data | ArrayBufferView | ✘ | ✘ | 
void
              dictionary RTCDataChannelInit {
    boolean         ordered = true;
    unsigned short  maxPacketLifeTime;
    unsigned short  maxRetransmits;
    USVString       protocol = "";
    boolean         negotiated = false;
    [EnforceRange]
    unsigned short  id;
    RTCPriorityType priority = "low";
};
        RTCDataChannelInit Membersordered of type boolean, defaulting to
            trueIf set to false, data is allowed to be delivered out of order. The default value of true, guarantees that data will be delivered in order.
maxPacketLifeTime of type unsigned shortLimits the time (in milliseconds) during which the channel will transmit or retransmit data if not acknowledged. This value may be clamped if it exceeds the maximum value supported by the user agent.
maxRetransmits of type unsigned shortLimits the number of times a channel will retransmit data if not successfully delivered. This value may be clamped if it exceeds the maximum value supported by the user agent.
protocol of type USVString, defaulting to
            ""Subprotocol name used for this channel.
negotiated of type boolean, defaulting to
            falseThe default value of false tells the user agent to announce the channel in-band and instruct the other peer to dispatch a corresponding RTCDataChannel
                RTCDataChannel
                id
                
id of type unsigned shortOverrides the default selection of ID for this channel.
priority of type RTCPriorityType, defaulting to
            lowPriority of this channel.
The send() method is overloaded to handle different data argument types. When any version of the method is called, the user agent MUST run the following steps:
Let channel be the RTCDataChannel
            
If channel's readyStateconnecting, throw an
            InvalidStateError.
Execute the sub step that corresponds to the type of the methods argument:
string object:
Let data be the object and increase the
                bufferedAmount
                
Blob object:
Let data be the raw data represented by the
                Blob object and increase the bufferedAmount
                
ArrayBuffer object:
Let data be the data stored in the buffer described by the ArrayBuffer object and increase the
                bufferedAmount
                ArrayBuffer in bytes.
              
ArrayBufferView object:
Let data be the data stored in the section of the buffer described by the ArrayBuffer object that the
                ArrayBufferView object references and increase the
                bufferedAmount
                ArrayBufferView in bytes.
              
If channel's underlying data transport is not established yet, or if the closing procedure has started, then abort these steps.
Attempt to send data on channel's
            underlying data transport; if the data cannot be sent, e.g. because it would need to be buffered but the buffer is full, the user agent MUST abruptly close channel's underlying
          data transport with an error.
enum RTCDataChannelState {
    "connecting",
    "open",
    "closing",
    "closed"
};
        | RTCDataChannelStateEnumeration description | |
|---|---|
| connecting | The user agent is attempting to establish the underlying
                data transport. This is the initial state of a
                   | 
| open | The underlying data transport is established and communication is possible. This is the initial state of a
                   | 
| closing | The  | 
| closed | The underlying data transport has been
                   | 
The datachannel
        RTCDataChannelEvent
        
Firing a datachannel event named
      e with a RTCDataChannel
        RTCDataChannelEvent
        channel
        
[Constructor(DOMString type, RTCDataChannelEventInit eventInitDict)]
interface RTCDataChannelEvent : Event {
    readonly attribute RTCDataChannel channel;
};
        RTCDataChannelEvent| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| type | DOMString | ✘ | ✘ | |
| eventInitDict | RTCDataChannelEventInit | ✘ | ✘ | 
channel of type RTCDataChannel, readonlyThe channel attribute represents the RTCDataChannel
                
dictionary RTCDataChannelEventInit : EventInit {
    required RTCDataChannel channel;
};
        RTCDataChannelEventInit
          Memberschannel of type RTCDataChannel, requiredThe RTCDataChannel
                
A RTCDataChannel
        
readyState
            connecting and at least one event listener is registered for open events, message events,
            error events, or close events.
readyState
            open and at least one event listener is registered for
            message events, error events, or
            close events.
readyState
            closing and at least one event listener is registered for error events, or close events.
underlying data transport is established and data is queued to be transmitted.
This section describes an interface on RTCRtpSender
      RTCPeerConnection
      
The Peer-to-peer DTMF API extends the RTCRtpSender
        
partial interface RTCRtpSender {
    readonly attribute RTCDTMFSender? dtmf;
};
        dtmf of type RTCDTMFSender, readonly, nullableThe dtmf attribute returns a RTCDTMFSender which can be used to send DTMF. A null value indicates that this RTCRtpSender cannot send DTMF.
RTCDTMFSender
      interface RTCDTMFSender : EventTarget {
    void insertDTMF(DOMString tones,
                    optional unsigned long duration = 100,
                    optional unsigned long interToneGap = 70);
             attribute EventHandler ontonechange;
    readonly attribute DOMString    toneBuffer;
};
        ontonechange of type EventHandlerThe event type of this event handler is
                tonechange
                
toneBuffer of type DOMString, readonlyThe toneBuffer attribute MUST return a list of the tones remaining to be played out. For the syntax, content, and interpretation of this list, see insertDTMF
                
insertDTMFAn RTCDTMFSender
                insertDTMF method is used to send DTMF tones.
The tones parameter is treated as a series of characters. The characters 0 through 9, A through D, #, and * generate the associated DTMF tones. The characters a to d MUST be normalized to uppercase on entry and are equivalent to A to D. As noted in [ RTCWEB-AUDIO] Section 3, support for the characters 0 through 9, A through D, #, and * are required. The character ',' MUST be supported, and indicates a delay of 2 seconds before processing the next character in the tones parameter. All other characters (and only those other characters) MUST be considered unrecognized.
The duration parameter indicates the duration in ms to use for each character passed in the tones parameters. The duration cannot be more than 6000 ms or less than 40 ms. The default duration is 100 ms for each tone.
The interToneGap parameter indicates the gap between tones in ms. The user agent clamps it to at least 30 ms. The default value is 70 ms.
The browser MAY increase the duration and interToneGap times to cause the times that DTMF start and stop to align with the boundaries of RTP packets but it MUST not increase either of them by more than the duration of a single RTP audio packet.
When the insertDTMF() method is invoked, the user agent MUST run the following steps:
RTCRtpSender
                  Let transceiver be the
                    RTCRtpTransceiver
                    
transceiver.stopped is
                  true, throw an
                  InvalidStateError.transceiver.currentDirection is recvonly or inactive,
                  throw an InvalidStateError.InvalidCharacterError.
                toneBuffer
                  duration parameter is less than 40, set it to 40. If, on the other hand, the value is greater than 6000, set it to 6000.interToneGap parameter is less than 30, set it to 30.toneBuffer
                  transceiver.stopped is
                      true, abort these steps.transceiver.currentDirection is recvonly or inactive, abort these steps.toneBuffer
                      tonechange
                      RTCDTMFSender
                      toneBuffer
                      duration ms on the associated RTP media stream, using the appropriate codec.duration + interToneGap ms from now that runs the steps labelled Playout task.tonechange
                      RTCDTMFSender
                      Calling insertDTMF
                
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| tones | DOMString | ✘ | ✘ | |
| duration | unsigned long = 100 | ✘ | ✔ | |
| interToneGap | unsigned long = 70 | ✘ | ✔ | 
void
              The tonechange
        RTCDTMFToneChangeEvent
        
Firing a tonechange event named
      e with a DOMString tone means that an event with the name e, which does not bubble (except where otherwise stated) and is not cancelable (except where otherwise stated), and which uses the RTCDTMFToneChangeEvent
        tone
        
[Constructor(DOMString type, RTCDTMFToneChangeEventInit eventInitDict)]
interface RTCDTMFToneChangeEvent : Event {
    readonly attribute DOMString tone;
};
        RTCDTMFToneChangeEvent| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| type | DOMString | ✘ | ✘ | |
| eventInitDict | RTCDTMFToneChangeEventInit | ✘ | ✘ | 
tone of type DOMString, readonlyThe tone attribute contains the character for the tone that has just begun playout (see
                insertDTMF ). If the value is the empty string, it indicates that the toneBuffer
                
dictionary RTCDTMFToneChangeEventInit : EventInit {
    required DOMString tone;
};
        RTCDTMFToneChangeEventInit
          Memberstone of type DOMStringThe tone attribute contains the character for the tone that has just begun playout (see
                insertDTMF ). If the value is the empty string, it indicates that the toneBuffer
                
The basic statistics model is that the browser maintains a set of statistics referenced by a selector. The selector may, for example, be a MediaStreamTrack. For a track to be a valid selector, it MUST be a MediaStreamTrack that is sent or received by the RTCPeerConnection
        getStats() method and the browser emits (in the JavaScript) a set of statistics that are relevant to the selector, according to the stats selection algorithm. Note that that algorithm takes the sender or receiver of a selector.
The statistics returned are designed in such a way that repeated queries can be linked by the RTCStats
        id dictionary member. Thus, a Web application can make measurements over a given time period by requesting measurements at the beginning and end of that period.
The Statistics API extends the RTCPeerConnection
        
partial interface RTCPeerConnection {
    Promise<RTCStatsReport> getStats(optional MediaStreamTrack? selector = null);
};
        getStatsGathers stats for the given selector and reports the result asynchronously.
When the 
              getStats() method is invoked, the user agent
                MUST run the following steps:
Let selectorArg be the method's first argument.
Let connection be the
                    RTCPeerConnection
                    
If selectorArg is neither null nor a valid MediaStreamTrack, return a promise rejected with a newly
                    created
                    TypeError.
Let selector be a RTCRtpSender or
                    RTCRtpReceiver on connection which
                    track member matches selectorArg. If no such sender or receiver exists, or if more than one sender or receiver fit this criteria, return a promise rejected with a newly
                    created
                    InvalidAccessError.
Let p be a new promise.
Run the following steps in parallel:
Gather the stats indicated by selector according to the stats selection algorithm.
Resolve p with the resulting
                        RTCStatsReport
                        
Return p.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| selector | MediaStreamTrack =
                    null | ✔ | ✔ | 
Promise<RTCStatsReport>
              RTCStatsReport Object
      The getStats() method delivers a successful result in the form of an
        RTCStatsReport
        RTCStatsReport
        idRTCStats instances), and their corresponding RTCStats
        
An RTCStatsReport
        RTCStats
        RTCRtpSender uses multiple SSRCs to carry its track over the network, the RTCStatsReport
        RTCStats-derived dictionary per SSRC (which can be distinguished by the value of the "ssrc" stats attribute).
interface RTCStatsReport {
    readonly maplike<DOMString, object>;
};
        This interface has "entries", "forEach", "get", "has", "keys", "values", @@iterator methods and a "size" getter brought by
          readonly maplike.
Use these to retrieve the various dictionaries descended from
          RTCStats
          RTCStats
          
An RTCStats
        RTCStats
        timestamp and type. Specific stats are added by extending the RTCStats
        
Note that while stats names are standardized, any given implementation may be using experimental values or values not yet known to the Web application. Thus, applications MUST be prepared to deal with unknown stats.
Statistics need to be synchronized with each other in order to yield reasonable values in computation; for instance, if "bytesSent" and "packetsSent" are both reported, they both need to be reported over the same interval, so that "average packet size" can be computed as "bytes / packets" - if the intervals are different, this will yield errors. Thus implementations MUST return synchronized values for all stats in an
        RTCStats
        
dictionary RTCStats {
    DOMHighResTimeStamp timestamp;
    RTCStatsType        type;
    DOMString           id;
};
        RTCStats Memberstimestamp of type DOMHighResTimeStampThe timestamp, of type
                DOMHighResTimeStamp [HIGHRES-TIME], associated with this object. The time is relative to the UNIX epoch (Jan 1, 1970, UTC). For statistics that came from a remote source (e.g., from received RTCP packets), timestamp represents the time at which the information arrived at the local endpoint. The remote timestamp can be found in an additional field in an
                RTCStats
                
type of type RTCStatsTypeThe type of this object.
The type attribute MUST be initialized to the name of the most specific type this
                RTCStats
                
id of type DOMStringA unique id that is associated with the object that was inspected to produce this
                RTCStats
                RTCStats
                RTCStatsReport
                
enum RTCStatsType {
};
      The set of valid values for RTCStatsType, and the dictionaries derived from RTCStats that they indicate, are documented in [
        WEBRTC-STATS].
The stats selection algorithm is as follows:
null, gather stats for the whole connection, add them to result, return
          result, and abort these steps.
        RTCRtpSender, gather stats for and add the following objects to result:
          RTCOutboundRTPStreamStats objects corresponding to
              selector.
            RTCOutboundRTPStreamStats objects added.
            RTCRtpReceiver, gather stats for and add the following objects to result:
          RTCInboundRTPStreamStats objects corresponding to selector.
            RTCInboundRTPStreamStats added.
            
        A stats object is said to "correspond to" a selector if its "ssrc" stats attribute matches an ssrc in one of the encoding parameters of the selector.
      
The stats listed in [WEBRTC-STATS] are intended to cover a wide range of use cases. Not all of them have to be implemented by every WebRTC implementation.
An implementation MUST support generating statistics of the following types when the corresponding objects exist on a PeerConnection, with the attributes that are listed when they are valid for that object:
An implementation MAY support generating any other statistic defined in [WEBRTC-STATS], and MAY generate statistics that are not documented.
Consider the case where the user is experiencing bad sound and the application wants to determine if the cause of it is packet loss. The following example code might be used:
var baselineReport, currentReport;
var selector = pc.getSenders()[0].track;
pc.getStats(selector).then(function (report) {
    baselineReport = report;
})
.then(function() {
    return new Promise(function(resolve) {
        setTimeout(resolve, aBit); // ... wait a bit
    });
})
.then(function() {
    return pc.getStats(selector);
})
.then(function (report) {
    currentReport = report;
    processStats();
})
.catch(function (error) {
  log(error.toString());
});
function processStats() {
    // compare the elements from the current report with the baseline
    currentReport.forEach (now => {
        if (now.type != "outboundrtp")
            return;
        // get the corresponding stats from the baseline report
        base = baselineReport.get(now.id);
        if (base) {
            remoteNow = currentReport.get(now.remoteId);
            remoteBase = baselineReport.get(base.remoteId);
            var packetsSent = now.packetsSent - base.packetsSent;
            var packetsReceived = remoteNow.packetsReceived - remoteBase.packetsReceived;
            // if fractionLost is > 0.3, we have probably found the culprit
            var fractionLost = (packetsSent - packetsReceived) / packetsSent;
        }
    }
}
      WebRTC offers and answers (and hence the channels established by
        RTCPeerConnection
        RTCPeerConnection
        setRemoteDescription is called) acts as the Relying Party (RP) and verifies the assertion.
The interaction with the IdP is designed to decouple the browser from any particular identity provider; the browser need only know how to load the IdP's JavaScript, the location of which is determined by the IdP's identity, and the generic interface to generating and validating assertions. The IdP provides whatever logic is necessary to bridge the generic protocol to the IdP's specific requirements. Thus, a single browser can support any number of identity protocols, including being forward compatible with IdPs which did not exist at the time the browser was written.
Identity is marked as a feature at risk, due to lack of implementer commitment.
An IdP is used to generate an identity assertion as follows:
setIdentityProvider() method has been called, the IdP provided shall be used.setIdentityProvider() method has not been called, then the user agent MAY use an IdP configured into the browser.
          In order to verify assertions, the IdP domain name and protocol are taken from the domain and protocol fields of the identity assertion.
In order to communicate with the IdP, the user agent loads the IdP JavaScript from the IdP. The URI for the IdP script is a well-known URI formed from the domain
 and protocol
 fields, as specified in [RTCWEB-SECURITY-ARCH].
The IdP MAY generate an HTTP redirect to another "https" origin, the browser MUST treat a redirect to any other scheme as a fatal error.
The user agent instantiates an isolated interpreted context, a JavaScript realm that operates in the origin of the loaded JavaScript. Note that a redirect will change the origin of the loaded script.
The realm is populated with a global that implements both the
          RTCIdentityProviderGlobalScope and
          WorkerGlobalScope [WEBWORKERS] interfaces.
The user agent provides an instance of
          RTCIdentityProviderRegistrar
          
[Global,
 Exposed=RTCIdentityProviderGlobalScope]
interface RTCIdentityProviderGlobalScope : WorkerGlobalScope {
    readonly attribute RTCIdentityProviderRegistrar rtcIdentityProvider;
};
          rtcIdentityProvider of type
              RTCIdentityProviderRegistrar,
              readonlyRTCIdentityProvider instance with the browser.
              An environment that mimics the identity provider realm can be provided by any script. However, only scripts running in the origin of the IdP are able to generate an identical environment. Other origins can load and run the IdP proxy code, but they will be unable to replicate data that is unique to the origin of the IdP.
This means that it is critical that an IdP use data that is restricted to its own origin when generating identity assertions. Otherwise, another origin could load the IdP script and use it to impersonate users.
The data that the IdP script uses could be stored on the client (for example, in IndexedDB) or loaded from servers. Data that is acquired from a server SHOULD require credentials and be protected from cross-origin access.
There is no risk to the integrity of identity assertions if an IdP validates an identity assertion without using origin-private data.
An IdP proxy implements the RTCIdentityProvider
        
Once instantiated, the IdP script is executed. The IdP MUST call the
        register() function on the
        RTCIdentityProviderRegistrar instance during script execution. If an IdP is not registered during this script execution, the user agent cannot use the IdP proxy and MUST fail any future attempt to interact with the IdP.
[Exposed=RTCIdentityProviderGlobalScope]
interface RTCIdentityProviderRegistrar {
    void register(RTCIdentityProvider idp);
};
        registerThis method is invoked by the IdP when its script is first executed. This registers RTCIdentityProvider
                
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| idp | RTCIdentityProvider | ✘ | ✘ | 
void
              The callback functions in RTCIdentityProvider are exposed by identity providers and is called by
          RTCPeerConnection to acquire or validate identity assertions.
        
dictionary RTCIdentityProvider {
    required GenerateAssertionCallback generateAssertion;
    required ValidateAssertionCallback validateAssertion;
};
          RTCIdentityProvider
            MembersgenerateAssertion of type
              GenerateAssertionCallback,
              requiredA user agent invokes this method on the IdP to request the generation of an identity assertion.
The IdP provides a promise that resolves to an
                  RTCIdentityAssertionResult
                  
validateAssertion of type
              ValidateAssertionCallback,
              requiredA user agent invokes this method on the IdP to request the validation of an identity assertion.
The IdP returns a Promise that resolves to an
                  RTCIdentityValidationResult
                  
callback GenerateAssertionCallback = Promise<RTCIdentityAssertionResult> (DOMString contents,
                                                                          DOMString origin,
                                                                          RTCIdentityProviderOptions options);
          GenerateAssertionCallback
            Parameterscontents of type DOMStringorigin of type DOMStringRTCPeerConnection
                RTCPeerConnection and therefore can be trusted to be correct.
              options of type RTCIdentityProviderOptionssetIdentityProvider. Though the dictionary is an optional argument to
                setIdentityProvider, default values are used as necessary when passing the value to the identity provider; see the definition of RTCIdentityProviderOptions
                callback ValidateAssertionCallback = Promise<RTCIdentityValidationResult> (DOMString assertion,
                                                                           DOMString origin);
          ValidateAssertionCallback
            Parametersassertion of type DOMStringa=identity in the session description; that is, the value that was part of the
                RTCIdentityAssertionResult
                origin of type DOMStringRTCPeerConnection
                dictionary RTCIdentityAssertionResult {
    required RTCIdentityProviderDetails idp;
    required DOMString                  assertion;
};
          RTCIdentityAssertionResult
            Membersidp of type RTCIdentityProviderDetails,
              requiredAn IdP provides these details to identify the IdP that validates the identity assertion. This struct contains the same information that is provided to
                  setIdentityProvider.
assertion of type DOMString, requiredAn identity assertion. This is an opaque string that MUST contain all information necessary to assert identity. This value is consumed by the validating IdP.
dictionary RTCIdentityProviderDetails {
    required DOMString domain;
             DOMString protocol = "default";
};
          RTCIdentityProviderDetails
            Membersdomain of type DOMString, requiredThe domain name of the IdP that validated the associated identity assertion.
protocol of type DOMString, defaulting to
              "default"The protocol parameter used for the IdP.
dictionary RTCIdentityValidationResult {
    required DOMString identity;
    required DOMString contents;
};
          RTCIdentityValidationResult
            Membersidentity of type DOMString, requiredThe validated identity of the peer.
contents of type DOMString, requiredThe payload of the identity assertion. An IdP that validates an identity assertion MUST return the same string that was provided to the original IdP that generated the assertion.
The user agent uses the contents string to determine if the identity assertion matches the session description.
The identity assertion request process is triggered by a call to
        createOffer, createAnswer, or
        getIdentityAssertion. When these calls are invoked and an identity provider has been set, the following steps are executed:
The RTCPeerConnection instantiates an IdP as described in Identity
          Provider Selection and Registering an
          IdP Proxy. If the IdP cannot be loaded, instantiated, or the IdP proxy is not registered, this process fails.
The RTCPeerConnection invokes the generateAssertion
            RTCIdentityProvider
            
The RTCPeerConnection generates the
            contents parameter to this method as described in [
            RTCWEB-SECURITY-ARCH]. The value of contents includes the fingerprint of the certificate that was selected or generated during the construction of the RTCPeerConnection. The
            origin parameter contains the origin of the script that calls the RTCPeerConnection method that triggers this behavior. The usernameHint value is the same value that is provided to setIdentityProvider, if any such value was provided.
The IdP proxy returns a Promise to the
            RTCPeerConnection. The IdP proxy is expected to generate the identity assertion asynchronously.
If the user has been authenticated by the IdP, and the IdP is able to generate an identity assertion, the IdP resolves the promise with an identity assertion in the form of an
            RTCIdentityAssertionResult
            
This step depends entirely on the IdP. The methods by which an IdP authenticates users or generates assertions is not specified, though they could involve interacting with the IdP server or other servers.
If the IdP proxy produces an error or returns a promise that does not resolve to a valid
            RTCIdentityValidationResult
            
The RTCPeerConnection MAY store the identity assertion for use with future offers or answers. If a fresh identity assertion is needed for any reason, applications can create a new
            RTCPeerConnection.
If the identity request was triggered by a
            createOffer() or createAnswer(), then the assertion is converted to a JSON string, base64-encoded and inserted into an a=identity attribute in the session description.
          
If assertion generation fails, then the promise for the corresponding function call is rejected with a newly created OperationError.
An IdP MAY reject an attempt to generate an identity assertion if it is unable to verify that a user is authenticated. This might be due to the IdP not having the necessary authentication information available to it (such as cookies).
Rejecting the promise returned by generateAssertion
          RTCError with errorDetail set to "idp-need-login".
The URL to login at will be passed to the application in the
          idpLoginUrl attribute of the
          RTCPeerConnection.
An application can load the login URL in an IFRAME or popup window; the resulting page then SHOULD provide the user with an opportunity to enter any information necessary to complete the authorization process.
Once the authorization process is complete, the page loaded in the IFRAME or popup sends a message using postMessage [ webmessaging] to the page that loaded it (through the window.opener attribute for popups, or through window.parent for pages loaded in an IFRAME). The message MUST consist of the DOMString "LOGINDONE". This message informs the application that another attempt at generating an identity assertion is likely to be successful.
Identity assertion validation happens when setRemoteDescription
        RTCPeerConnection
        setRemoteDescription.
The identity assertion request process involves the following asynchronous steps:
The RTCPeerConnection awaits any prior identity validation. Only one identity validation can run at a time for an
            RTCPeerConnection. This can happen because the resolution of setRemoteDescription is not blocked by identity validation unless there is a target peer
          identity.
The RTCPeerConnection loads the identity assertion from the session description and decodes the base64 value, then parses the resulting JSON. The idp parameter of the resulting dictionary contains a domain and an optional
            protocol value that identifies the IdP, as described in [
            RTCWEB-SECURITY-ARCH].
The RTCPeerConnection instantiates the identified IdP as described in 9.1.1 Identity Provider
        Selection and
            9.2 Registering an IdP Proxy. If the IdP cannot be loaded, instantiated or the IdP proxy is not registered, this process fails.
          
The RTCPeerConnection invokes the validateAssertion
            
The assertion parameter is taken from the decoded identity assertion. The origin parameter contains the origin of the script that calls the RTCPeerConnection method that triggers this behavior.
The IdP proxy returns a promise and performs the validation process asynchronously.
The IdP proxy verifies the identity assertion using whatever means necessary. Depending on the authentication protocol this could involve interacting with the IdP server.
If the IdP proxy produces an error or returns a promise that does not resolve to a valid
            RTCIdentityValidationResult
            
Once the assertion is successfully verified, the IdP proxy resolves the promise with an
            RTCIdentityValidationResult
            
The RTCPeerConnection decodes the contents
            a=fingerprint attribute in the session description. This ensures that the certificate used by the remote peer for communications is covered by the identity assertion.
A user agent is required to fail to communicate with peers that offer a certificate that doesn't match an
              a=fingerprint line in the negotiated session description.
            
The RTCPeerConnection validates that the domain portion of the identity matches the domain of the IdP as described in [
            RTCWEB-SECURITY-ARCH]. If this check fails then the identity validation fails.
The RTCPeerConnection resolves the peerIdentity
            RTCIdentityAssertion that includes the IdP domain and peer identity.
The user agent MAY display identity information to a user in its UI. Any user identity information that is displayed in this fashion MUST use a mechanism that cannot be spoofed by content.
If identity validation fails, the peerIdentity
        OperationError.
If identity validation fails and there is a target peer
      identity for the RTCPeerConnection, the promise returned by setRemoteDescription MUST be rejected with the same
        DOMException.
If identity validation fails and there is no a target peer
      identity, the value of the peerIdentity
        
Errors in IdP processing will - in most cases - result in the failure of the procedure that invoked the IdP proxy. This will result in the rejection of the promise returned by getIdentityAssertion
        createOffer
        createAnswer
        setRemoteDescription
        setRemoteDescription
        peerIdentity
        
If an error occurs these promises are rejected with a
        RTCError if an error occurs in interacting with the IdP proxy. The following scenarios result in errors:
A RTCPeerConnection might be configured with an identity provider, but loading of the IdP URI fails. Any procedure that attempts to invoke such an identity provider and cannot load the URI fails with an RTCError with errorDetail set to "idp-load-failure" and the httpRequestStatusCode attribute of the error set to the HTTP status code of the response.
If the IdP loads fails due to the TLS certificate used for the HTTPS connection not being trusted, it fails with an
            RTCError with errorDetail set to "idp-tls-failure". This typically happens when the IdP uses certificate pinning and an intermediary such as an enterprise firewall has intercepted the TLS connection.
If the script loaded from the identity provider is not valid JavaScript or does not implement the correct interfaces, it causes an IdP failure with an RTCError with
            errorDetail set to "idp-bad-script-failure".
An apparently valid identity provider might fail in several ways.
            
            If the IdP token has expired, then the IdP MUST fail with an
            RTCError with errorDetail set to "idp-token-expired".
            
            If the IdP token is not valid, then the IdP MUST fail with an
            RTCError with errorDetail set to "idp-token-invalid".
            
            If an identity provider throws an exception or returns a promise that is ultimately rejected, then the procedure that depends on the IdP
            MUST also fail. These types of errors will cause an IdP failure with an
            RTCError with errorDetail set to "idp-execution-failure".
          
The user agent SHOULD limit the time that it allows for an IdP to 15 seconds. This includes both the loading of the IdP proxy and the identity assertion generation or validation. Failure to do so potentially causes the corresponding operation to take an indefinite amount of time. This timer can be cancelled when the IdP proxy produces a response. Expiration of this timer cases an IdP failure with an
            RTCError with errorDetail set to "idp-timeout".
          
If the identity provider requires the user to login, the operation will fail RTCError with errorDetail set to "idp-need-login" and the idpLoginUrl attribute of the error set to the URL that can be used to login.
Even when the IdP proxy produces a positive result, the procedure that uses this information might still fail. Additional validation of a RTCIdentityValidationResult value is still necessary. The procedure for validation of identity
        assertions describes additional steps that are required to successfully validate the output of the IdP proxy.
Any error generated by the IdP MAY provide additional information in the idpErrorInfo attribute. The information in this string is defined by the IdP in use.
The Identity API extends the RTCPeerConnection
        
partial interface RTCPeerConnection {
    void               setIdentityProvider(DOMString provider,
                                           optional RTCIdentityProviderOptions options);
    Promise<DOMString> getIdentityAssertion();
    readonly attribute Promise<RTCIdentityAssertion> peerIdentity;
    readonly attribute DOMString?                    idpLoginUrl;
    readonly attribute DOMString?                    idpErrorInfo;
};
        peerIdentity of type Promise<RTCIdentityAssertion>,
            readonlyA promise that resolves with the identity of the peer if the identity is successfully validated.
This promise is rejected if an identity assertion is present in a remote session description and validation of that assertion fails for any reason. If the promise is rejected, a new unresolved value is created, unless a target peer identity has been established. If this promise successfully resolves, the value will not change.
idpLoginUrl of type DOMString, readonly, nullableThe URL that an application can navigate to so that the user can login to the IdP, as described in 9.3.1 User Login Procedure.
idpErrorInfo of type DOMString, readonly, nullableAn attribute that the IdP can use to pass additional information back to the applications about the error. The format of this string is defined by the IdP and may be JSON.
setIdentityProviderSets the identity provider to be used for a given
                RTCPeerConnection object. Applications need not make this call; if the browser is already configured for an IdP, then that configured IdP might be used to get an assertion.
When the setIdentityProvider method is invoked, the user agent MUST run the following steps:
If the RTCPeerConnection
                    true, throw an
                    InvalidStateError.
Set the current identity provider values to the tuple (provider, options).
If any identity provider value has changed, discard any stored identity assertion.
Identity provider information is not used until an identity assertion is required, either in response to a call to
                getIdentityAssertion, or a session description is requested with a call to either createOffer or
                createAnswer.
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| provider | DOMString | ✘ | ✘ | |
| options | RTCIdentityProviderOptions | ✘ | ✔ | 
void
              getIdentityAssertionInitiates the process of obtaining an identity assertion. Applications need not make this call. It is merely intended to allow them to start the process of obtaining identity assertions before a call is initiated. If an identity is needed, either because the browser has been configured with a default identity provider or because the setIdentityProvider
                
When getIdentityAssertion is invoked, queue a task to run the following steps:
If the RTCPeerConnection
                    true, throw an
                    InvalidStateError.
Request an identity assertion from the IdP.
Resolve the promise with the base64 and JSON encoded assertion.
Promise<DOMString>
              dictionary RTCIdentityProviderOptions {
    DOMString protocol = "default";
    DOMString usernameHint;
    DOMString peerIdentity;
};
        RTCIdentityProviderOptions Membersprotocol of type DOMStringThe name of the protocol that is used by the identity provider. This MUST NOT include '/' (U+002F) or '\' (U+005C) characters. This value defaults to "default" if not provided.
usernameHint of type DOMStringA hint to the identity provider about the identity of the principal for which it should generate an identity assertion. If absent, the value undefined is used.
peerIdentity of type DOMStringThe identity of the peer. For identity providers that bind their assertions to a particular pair of communication peers, this allows them to generate an assertion that includes both local and remote identities. If this value is omitted, but a value is provided for the peerIdentity member of RTCConfiguration
                RTCConfiguration
                
[Constructor(DOMString idp, DOMString name)]
interface RTCIdentityAssertion {
    attribute DOMString idp;
    attribute DOMString name;
};
        RTCIdentityAssertion Attributesidp of type DOMStringThe domain name of the identity provider that validated this identity.
name of type DOMStringAn RFC5322-conformant [RFC5322] representation of the verified peer identity. This identity will have been verified via the procedures described in [RTCWEB-SECURITY-ARCH].
The identity system is designed so that applications need not take any special action in order for users to generate and verify identity assertions; if a user has configured an IdP into their browser, then the browser will automatically request/generate assertions and the other side will automatically verify them and display the results. However, applications may wish to exercise tighter control over the identity system as shown by the following examples.
This example shows how to configure the identity provider.
pc.setIdentityProvider("example.com");
        This example shows how to configure the identity provider with all the options.
pc.setIdentityProvider("example.com", {
    protocol: "default",
    usernameHint: "alice@example.com",
    peerIdentity: "bob@example.net"
});
        This example shows how to consume identity assertions inside a Web application.
pc.peerIdentity.then(identity =>
  console.log("IdP= " + identity.idp + " identity=" + identity.name));
        The MediaStreamTrack interface, as defined in the [
        GETUSERMEDIA] specification, typically represents a stream of data of audio or video. One or more MediaStreamTracks can be collected in a MediaStream (strictly speaking, a
        MediaStream as defined in [GETUSERMEDIA] may contain zero or more MediaStreamTrack objects).
A MediaStreamTrack may be extended to represent a media flow that either comes from or is sent to a remote peer (and not just the local camera, for instance). The extensions required to enable this capability on the MediaStreamTrack object will be described in this section. How the media is transmitted to the peer is described in [
        RTCWEB-RTP], [RTCWEB-AUDIO], and [RTCWEB-TRANSPORT].
A MediaStreamTrack sent to another peer will appear as one and only one MediaStreamTrack to the recipient. A peer is defined as a user agent that supports this specification. In addition, the sending side application can indicate what MediaStream object(s) the MediaStreamTrack is member of. The corresponding MediaStream object(s) on the receiver side will be created (if not already present) and populated accordingly.
As also described earlier in this document, the objects
        RTCRtpSender and RTCRtpReceiver can be used by the application to get more fine grained control over the transmission and reception of MediaStreamTracks.
Channels are the smallest unit considered in the
        MediaStream specification. Channels are intended to be encoded together for transmission as, for instance, an RTP payload type. All of the channels that a codec needs to encode jointly MUST be in the same MediaStreamTrack and the codecs SHOULD be able to encode, or discard, all the channels in the track.
The concepts of an input and output to a given
        MediaStreamTrack apply in the case of
        MediaStreamTrack objects transmitted over the network as well. A MediaStreamTrack
        RTCPeerConnection
        MediaStreamTrack from a local source, for instance a camera via [GETUSERMEDIA], will have an output that represents what is transmitted to a remote peer if the object is used with an RTCPeerConnection
        
The concept of duplicating MediaStream and
        MediaStreamTrack objects as described in [GETUSERMEDIA] is also applicable here. This feature can be used, for instance, in a video-conferencing scenario to display the local video from the user's camera and microphone in a local monitor, while only transmitting the audio to the remote peer (e.g. in response to the user using a "video mute" feature). Combining different MediaStreamTrack objects into new MediaStream objects is useful in certain situations.
      
In this document, we only specify aspects of the following objects that are relevant when used along with an
          RTCPeerConnection
          MediaStream and
          MediaStreamTrack.
The id attribute specified in MediaStream returns an id that is unique to this stream, so that streams can be recognized at the remote end of the RTCPeerConnection
          
When a MediaStream is created to represent a stream obtained from a remote peer, the id attribute is initialized from information provided by the remote source.
        
The id of a MediaStream object is unique to the source of the stream, but that does not mean it is not possible to end up with duplicates. For example, the tracks of a locally generated stream could be sent from one user agent to a remote peer using RTCPeerConnection
            
A MediaStreamTrack object's reference to its
        MediaStream in the non-local media source case (an RTP source, as is the case for MediaStreamTracks received over an RTCPeerConnection
        
When an RTCPeerConnection
        MediaStreamTrack
        false.
When one of the SSRCs for RTP source media streams received by an RTCPeerConnection
        MediaStreamTrack
        true. If and when packets are received again, the muted state MUST be
      updated with the value false.
The procedure update a track's muted state is specified in [ GETUSERMEDIA].
When a MediaStreamTrack
        RTCRtpReceiver
        ended [GETUSERMEDIA] (such as via a call to
        receiver.track.stop), the user agent MAY choose to free resources allocated for the incoming stream, by for instance turning off the decoder of receiver.
The basics of MediaTrackSupportedConstraints,
          MediaTrackCapabilites, MediaTrackConstraints and MediaTrackSettings is outlined in [GETUSERMEDIA]. However, the MediaTrackSettings for a
          MediaStreamTrack sourced by a
          RTCPeerConnection
          RTCSessionDescription
          setRemoteDescription and the actual RTP data. This means that certain members, such as facingMode,
          echoCancellation, latency,
          deviceId and groupId, will always be missing.
        
A MediaStream acquired using getUserMedia() is, by default, accessible to an application. This means that the application is able to access the contents of tracks, modify their content, and send that media to any peer it chooses.
WebRTC supports calling scenarios where media is sent to a specifically identified peer, without the contents of media streams being accessible to applications. This is enabled by use of the
        peerIdentity parameter to getUserMedia().
An application willingly relinquishes access to media by including a
        peerIdentity parameter in the
        MediaStreamConstraints. This attribute is set to a
        DOMString containing the identity of a specific peer.
The MediaStreamConstraints dictionary is expanded to include the peerIdentity parameter.
partial dictionary MediaStreamConstraints {
    DOMString peerIdentity;
};
        peerIdentity of type DOMStringIf set, peerIdentity isolates media from the application. Media can only be sent to the identified peer.
A user that is prompted to provide consent for access to a camera or microphone can be shown the value of the peerIdentity parameter, so that they can be informed that the consent is more narrowly restricted.
      
When the peerIdentity option is supplied to
        getUserMedia(), all of the MediaStreamTracks in the resulting MediaStream are isolated so that content is not accessible to any application. Isolated
        MediaStreamTracks can be used for two purposes:
Displayed in an appropriate media tag (e.g., a video or audio element). The browser MUST ensure that content is inaccessible to the application by ensuring that the resulting content is given the same protections as content that is CORS cross-origin, as described in the relevant Security and privacy considerations section of [HTML5].
Used as the argument to addTrack on an
            RTCPeerConnection
            
A MediaStreamTrack that is added to another
        MediaStream remains isolated. When an isolated
        MediaStreamTrack is added to a MediaStream with a different peerIdentity, the MediaStream gets a combination of isolation restrictions. A MediaStream containing
        MediaStreamTrack instances with mixed isolation properties can be displayed, but cannot be sent using
        RTCPeerConnection
        
Any peerIdentity property MUST be retained on cloned copies of MediaStreamTracks.
MediaStreamTrack is expanded to include an
          isolated attribute and a corresponding event. This allows an application to quickly and easily determine whether a track is accessible.
        
partial interface MediaStreamTrack {
    readonly attribute boolean      isolated;
             attribute EventHandler onisolationchange;
};
          isolated of type boolean, readonlyA MediaStreamTrack is isolated (and the corresponding isolated attribute set to
                  true) when content is inaccessible to the owning document. This occurs as a result of setting the
                  peerIdentity option. A track is also isolated if it comes from a cross origin source.
onisolationchange of type
              EventHandlerThis event handler, of type isolationchange, is fired when the value of the isolated attribute changes.
                
A MediaStreamTrack with a peerIdentity option set can be added to any RTCPeerConnection
          
A MediaStreamTrack from a stream acquired using the
              peerIdentity option can be transmitted if the
              RTCPeerConnection
              name attribute of the peerIdentity attribute of the RTCPeerConnection
              peerIdentity option passed to getUserMedia().
Rules for matching identity are described in [ RTCWEB-SECURITY-ARCH].
The peer has indicated that it will respect the isolation properties of streams. That is, a DTLS connection with a promise to respect stream confidentiality, as defined in [RTCWEB-ALPN] has been established.
Failing to meet these conditions means that no media can be sent for the affected MediaStreamTrack. Video MUST be replaced by black frames, audio MUST be replaced by silence, and equivalently information-free content MUST be provided for other media types.
Remotely sourced MediaStreamTracks MUST be isolated if they are received over a DTLS connection that has been negotiated with track isolation. This protects isolated media from the application in the receiving browser. These tracks MUST only be displayed to a user using the appropriate media element (e.g., <video> or <audio>).
        
Any MediaStreamTrack that has the
          peerIdentity option set causes all tracks sent using the same RTCPeerConnection
          RTCPeerConnection
          RTCPeerConnection
          
Tracks that are not bound to a particular peerIdentity do not cause other streams to be isolated, these tracks simply do not have their content transmitted.
If a stream becomes isolated after initially being accessible, or an isolated stream is added to an active session, then media for that stream is replaced by information-free content (e.g., black frames or silence).
Media isolation ensures that the content of a
          MediaStreamTrack is not accessible to web applications. However, to ensure that media with a peerIdentity option set can be sent to peers, some meta-information about the media will be exposed to applications.
Applications will be able to observe the parameters of the media that affect session negotiation and conversion into RTP. This includes the codecs that might be supported by the track, the bitrate, the number of packets, and the current settings that are set on the
          MediaStreamTrack.
In particular, the statistics that
          RTCPeerConnection
          
Most of these data are exposed to the network when the media is transmitted. Only the settings for the MediaStreamTrack present a new source of information. This can includes the frame rate and resolution of video tracks, the bandwidth of audio tracks, and other information about the source, which would not otherwise be revealed to a network observer. Since settings don't change at a high frequency or in response to changes in media content, settings only reveal limited reveal information about the content of a track. However, any setting that might change dynamically in response to the content of an isolated MediaStreamTrack MUST have changes suppressed.
        
This section is non-normative.
When two peers decide they are going to set up a connection to each other, they both go through these steps. The STUN/TURN server configuration describes a server they can use to get things like their public IP address or to set up NAT traversal. They also have to send data for the signaling channel to each other using the same out-of-band mechanism they used to establish that they were going to communicate in the first place.
var signalingChannel = new SignalingChannel();
var configuration = { "iceServers": [{ "urls": "stuns:stun.example.org" }] };
var pc;
// call start() to initiate
function start() {
    pc = new RTCPeerConnection(configuration);
    // send any ice candidates to the other peer
    pc.onicecandidate = function (evt) {
        signalingChannel.send(JSON.stringify({ "candidate": evt.candidate }));
    };
    // let the "negotiationneeded" event trigger offer generation
    pc.onnegotiationneeded = function () {
        pc.createOffer().then(function (offer) {
            return pc.setLocalDescription(offer);
        })
        .then(function () {
            // send the offer to the other peer
            signalingChannel.send(JSON.stringify({ "desc": pc.localDescription }));
        })
        .catch(logError);
    };
    // once remote track arrives, show it in the remote video element
    pc.ontrack = function (evt) {
        // don't set srcObject again if it is already set.
        if (!remoteView.srcObject)
          remoteView.srcObject = evt.streams[0];
    };
    // get a local stream, show it in a self-view and add it to be sent
    navigator.mediaDevices.getUserMedia({ "audio": true, "video": true })
        .then(function (stream) {
            selfView.srcObject = stream;
            pc.addTrack(stream.getAudioTracks()[0], stream);
            pc.addTrack(stream.getVideoTracks()[0], stream);
        })
        .catch(logError);
}
signalingChannel.onmessage = function (evt) {
    if (!pc)
        start();
    var message = JSON.parse(evt.data);
    if (message.desc) {
        var desc = message.desc;
        // if we get an offer, we need to reply with an answer
        if (desc.type == "offer") {
            pc.setRemoteDescription(desc).then(function () {
                return pc.createAnswer();
            })
            .then(function (answer) {
                return pc.setLocalDescription(answer);
            })
            .then(function () {
                var str = JSON.stringify({ "desc": pc.localDescription });
                signalingChannel.send(str);
            })
            .catch(logError);
        } else if (desc.type == "answer") {
            pc.setRemoteDescription(desc).catch(logError);
        } else {
            log("Unsupported SDP type. Your code may differ here.");
        }
    } else
        pc.addIceCandidate(message.candidate).catch(logError);
};
function logError(error) {
    log(error.name + ": " + error.message);
}
        When two peers decide they are going to set up a connection to each other and want to have the ICE, DTLS, and media connections "warmed up" such that they are ready to send and receive media immediately, they both go through these steps.
var signalingChannel = new SignalingChannel();
var configuration = { "iceServers": [{ "urls": "stuns:stun.example.org" }] };
var pc;
var audio = null;
var audioSendTrack = null;
var video = null;
var videoSendTrack = null;
var started = false;
// Call warmup() to warm-up ICE, DTLS, and media, but not send media yet.
function warmup(answerer) {
    pc = new RTCPeerConnection(configuration);
    if (!answerer) {
      audio = pc.addTransceiver("audio");
      video = pc.addTransceiver("video");
    }
    // send any ice candidates to the other peer
    pc.onicecandidate = function (evt) {
        signalingChannel.send(JSON.stringify({ "candidate": evt.candidate }));
    };
    // let the "negotiationneeded" event trigger offer generation
    pc.onnegotiationneeded = function () {
        pc.createOffer().then(function (offer) {
            return pc.setLocalDescription(offer);
        })
        .then(function () {
            // send the offer to the other peer
            signalingChannel.send(JSON.stringify({ "desc": pc.localDescription }));
        })
        .catch(logError);
    };
    // once remote track arrives, show it in the remote video element
    pc.ontrack = function (evt) {
        if (evt.track.kind === "audio") {
          if (answerer) {
            audio = evt.transceiver;
            audio.setDirection("sendrecv");
            if (started && audioSendTrack) {
              audio.sender.replaceTrack(audioSendTrack);
            }
          }
        } else if (evt.track.kind === "video") {
          if (answerer) {
            video = evt.transceiver;
            video.setDirection("sendrecv");
            if (started && videoSendTrack) {
              video.sender.replaceTrack(videoSendTrack);
            }
          }
        }
        // don't set srcObject again if it is already set.
        if (!remoteView.srcObject)
          remoteView.srcObject = evt.streams[0];
    };
    // get a local stream, show it in a self-view and add it to be sent
    navigator.mediaDevices.getUserMedia({ "audio": true, "video": true })
      .then(function (stream) {
        selfView.srcObject = stream;
        audioSendTrack = stream.getAudioTracks()[0];
        if (started) {
          audio.sender.replaceTrack(audioSendTrack);
        }
        videoSendTrack = stream.getVideoTracks()[0];
        if (started) {
          video.sender.replaceTrack(videoSendTrack);
        }
      })
      .catch(logError);
}
// Call start() to start sending media.
function start() {
  started = true;
  signalingChannel.send(JSON.stringify({ "start": true }));
}
signalingChannel.onmessage = function (evt) {
    if (!pc)
        warmup(true);
    var message = JSON.parse(evt.data);
    if (message.desc) {
        var desc = message.desc;
        // if we get an offer, we need to reply with an answer
        if (desc.type == "offer") {
            pc.setRemoteDescription(desc).then(function () {
                return pc.createAnswer();
            })
            .then(function (answer) {
                return pc.setLocalDescription(answer);
            })
            .then(function () {
                var str = JSON.stringify({ "desc": pc.localDescription });
                signalingChannel.send(str);
            })
            .catch(logError);
        } else
            pc.setRemoteDescription(desc).catch(logError);
    } else if (message.start) {
      started = true;
      if (audio && audioSendTrack) {
        audio.sender.replaceTrack(audioSendTrack);
      }
      if (video && videoSendTrack) {
        video.sender.replaceTrack(videoSendTrack);
      }
    } else
        pc.addIceCandidate(message.candidate).catch(logError);
};
function logError(error) {
    log(error.name + ": " + error.message);
}
        The answerer may wish to send media in parallel with sending the answer, and the offerer may wish to render the media before the answer arrives.
var signalingChannel = new SignalingChannel();
var configuration = { "iceServers": [{ "urls": "stuns:stun.example.org" }] };
var pc;
// call start() to initiate
function start() {
    pc = new RTCPeerConnection(configuration);
    // send any ice candidates to the other peer
    pc.onicecandidate = function (evt) {
        signalingChannel.send(JSON.stringify({ "candidate": evt.candidate }));
    };
    // let the "negotiationneeded" event trigger offer generation
    pc.onnegotiationneeded = function () {
        pc.createOffer().then(function (offer) {
            return pc.setLocalDescription(offer);
        })
        .then(function () {
            // send the offer to the other peer
            signalingChannel.send(JSON.stringify({ "desc": pc.localDescription }));
        })
        .catch(logError);
    };
    // get a local stream, show it in a self-view and add it to be sent
    navigator.mediaDevices.getUserMedia({ "audio": true, "video": true })
        .then(function (stream) {
            selfView.srcObject = stream;
            var remoteStream = new MediaStream();
            var audioSender = pc.addTrack(stream.getAudioTracks()[0], stream);
            var videoSender = pc.addTrack(stream.getVideoTracks()[0], stream);
            [audioSender, videoSender].forEach(function(sender) {
                remoteStream.addTrack(pc.getReceivers.find(function (receiver) {
                    return receiver.mid == sender.mid;
                }).track);
            });
            // Render the media even before ontrack fires.
            remoteView.srcObject = remoteStream;
        })
        .catch(logError);
}
signalingChannel.onmessage = function (evt) {
    if (!pc)
        start();
    var message = JSON.parse(evt.data);
    if (message.desc) {
        var desc = message.desc;
        // if we get an offer, we need to reply with an answer
        if (desc.type == "offer") {
            pc.setRemoteDescription(desc).then(function () {
                return pc.createAnswer();
            })
            .then(function (answer) {
                return pc.setLocalDescription(answer);
            })
            .then(function () {
                var str = JSON.stringify({ "desc": pc.localDescription });
                signalingChannel.send(str);
            })
            .catch(logError);
        } else
            pc.setRemoteDescription(desc).catch(logError);
    } else
        pc.addIceCandidate(message.candidate).catch(logError);
};
function logError(error) {
    log(error.name + ": " + error.message);
}
        A client wants to send multiple RTP encodings (simulcast) to a server.
var signalingChannel = new SignalingChannel();
var configuration = { "iceServers": [{ "urls": "stuns:stun.example.org" }] };
var pc;
// call start() to initiate
function start() {
    pc = new RTCPeerConnection(configuration);
    // let the "negotiationneeded" event trigger offer generation
    pc.onnegotiationneeded = function () {
        pc.createOffer().then(function (offer) {
            return pc.setLocalDescription(offer);
        })
        .then(function () {
            // send the offer to the other peer
            signalingChannel.send(JSON.stringify({ "desc": pc.localDescription }));
        })
        .catch(logError);
    };
    // get a local stream, show it in a self-view and add it to be sent
    navigator.mediaDevices.getUserMedia({ "audio": true, "video": true })
        .then(function (stream) {
            selfView.srcObject = stream;
            pc.addTransceiver(stream.getAudioTracks()[0], {direction: "sendonly"});
            pc.addTransceiver(stream.getVideoTracks()[0], {
                direction: "sendonly",
                sendEncodings: [
                    {
                      rid: "f",
                    },
                    {
                      rid: "h",
                      scaleDownResolutionBy: 2.0
                    },
                    {
                      rid: "q",
                      scaleDownResolutionBy: 4.0
                    }
                ]
            });
        })
        .catch(logError);
}
signalingChannel.onmessage = function (evt) {
    var message = JSON.parse(evt.data);
    if (message.desc)
        pc.setRemoteDescription(message.desc).catch(logError);
    else
        pc.addIceCandidate(message.candidate).catch(logError);
};
function logError(error) {
    log(error.name + ": " + error.message);
}
        This example shows how to create a
          RTCDataChannel
          RTCDataChannel
          
var signalingChannel = new SignalingChannel();
var configuration = { "iceServers": [{ "urls": "stuns:stun.example.org" }] };
var pc;
var channel;
// call start(true) to initiate
function start(isInitiator) {
    pc = new RTCPeerConnection(configuration);
    // send any ice candidates to the other peer
    pc.onicecandidate = function (evt) {
        signalingChannel.send(JSON.stringify({ "candidate": evt.candidate }));
    };
    // let the "negotiationneeded" event trigger offer generation
    pc.onnegotiationneeded = function () {
        pc.createOffer().then(function (offer) {
            return pc.setLocalDescription(offer);
        })
        .then(function () {
            // send the offer to the other peer
            signalingChannel.send(JSON.stringify({ "desc": pc.localDescription }));
        })
        .catch(logError);
    };
    if (isInitiator) {
        // create data channel and setup chat
        channel = pc.createDataChannel("chat");
        setupChat();
    } else {
        // setup chat on incoming data channel
        pc.ondatachannel = function (evt) {
            channel = evt.channel;
            setupChat();
        };
    }
}
signalingChannel.onmessage = function (evt) {
    if (!pc)
        start(false);
    var message = JSON.parse(evt.data);
    if (message.desc) {
        var desc = message.desc;
        // if we get an offer, we need to reply with an answer
        if (desc.type == "offer") {
            pc.setRemoteDescription(desc).then(function () {
                return pc.createAnswer();
            })
            .then(function (answer) {
                return pc.setLocalDescription(answer);
            })
            .then(function () {
                var str = JSON.stringify({ "desc": pc.localDescription });
                signalingChannel.send(str);
            })
            .catch(logError);
        } else
            pc.setRemoteDescription(desc).catch(logError);
    } else
        pc.addIceCandidate(message.candidate).catch(logError);
};
function setupChat() {
    channel.onopen = function () {
        // e.g. enable send button
        enableChat(channel);
    };
    channel.onmessage = function (evt) {
        showChatMessage(evt.data);
    };
}
function sendChatMessage(msg) {
    channel.send(msg);
}
function logError(error) {
    log(error.name + ": " + error.message);
}
        This shows an example of one possible call flow between two browsers. This does not show the procedure to get access to local media or every callback that gets fired but instead tries to reduce it down to only show the key events and messages.
Examples assume that sender is an RTCRtpSender.
Sending the DTMF signal "1234" with 500 ms duration per tone:
if (sender.dtmf) {
    var duration = 500;
    sender.dtmf.insertDTMF("1234", duration);
} else
    log("DTMF function not available");
      Send the DTMF signal "1234", and light up the active key using
        lightKey(key) while the tone is playing (assuming that
        lightKey("") will darken all the keys):
if (sender.dtmf) {
  sender.dtmf.ontonechange = function (e) {
      if (!e.tone)
          return;
      // light up the key when playout starts
      lightKey(e.tone);
      // turn off the light after tone duration
      setTimeout(lightKey, sender.duration, "");
  };
  sender.dtmf.insertDTMF("1234");
} else
    log("DTMF function not available");
      Send a 1-second "1" tone followed by a 2-second "2" tone:
if (sender.dtmf) {
  sender.dtmf.ontonechange = function (e) {
      if (e.tone == "1")
          sender.dtmf.insertDTMF("2", 2000);
  };
  sender.dtmf.insertDTMF("1", 1000);
} else
    log("DTMF function not available");
      It is always safe to append to the tone buffer. This example appends before any tone playout has started as well as during playout.
if (sender.dtmf) {
  sender.dtmf.insertDTMF("123");
  // append more tones to the tone buffer before playout has begun
  sender.dtmf.insertDTMF(sender.toneBuffer + "456");
  sender.dtmf.ontonechange = function (e) {
      if (e.tone == "1")
          // append more tones when playout has begun
          sender.dtmf.insertDTMF(sender.toneBuffer + "789");
  };
} else
    log("DTMF function not available");
      Send the DTMF signal "123" and abort after sending "2".
if (sender.dtmf) {
  sender.dtmf.ontonechange = function (e) {
      if (e.tone == "2")
          // empty the buffer to not play any tone after "2"
          sender.dtmf.insertDTMF("");
  };
  sender.dtmf.insertDTMF("123");
} else
    log("DTMF function not available");
      This section and its subsections extend the list of Error subclasses defined in [ECMASCRIPT-6.0] following the pattern for NativeError in section 19.5.6 of that specification. Assume the following:
%RTCError% and
        %RTCErrorPrototype% are available as if they had been included in ([ECMASCRIPT-6.0], Table 7) and all referencing sections, e.g. ([
        ECMASCRIPT-6.0], section 8.2.2), thus behave appropriately.The following terms used in this section are defined in [ECMASCRIPT-6.0].
| Term/Notation | Section in [ECMASCRIPT-6.0] | 
|---|---|
| Type(X) | 6 | 
| intrinsic object | 6.1.7.4 | 
| [[ErrorData]] | 19.5.1 | 
| internal slot | 6.1.7.2 | 
| NewTarget | various uses, but no definition | 
| active function object | 8.3 | 
| OrdinaryCreateFromConstructor() | 9.1.14 | 
| ReturnIfAbrupt() | 6.2.2.4 | 
| Assert | 5.2 | 
| String | 4.3.17-19, depending on context | 
| PropertyDescriptor | 6.2.4 | 
| [[Value]] | 6.1.7.1 | 
| [[Writable]] | 6.1.7.1 | 
| [[Enumerable]] | 6.1.7.1 | 
| [[Configurable]] | 6.1.7.1 | 
| DefinePropertyOrThrow() | 7.3.7 | 
| abrupt completion | 6.2.2 | 
| ToString() | 7.1.12 | 
| [[Prototype]] | 9.1 | 
| %Error% | 19.5.1 | 
| Error | 19.5 | 
| %ErrorPrototype% | 19.5.3 | 
| Object.prototype.toString | 19.1.3.6 | 
The RTCError Constructor is the %RTCError% intrinsic object. When RTCError is called as a function rather than as a constructor, it creates and initializes a new
          RTCError object. A call of the object as a function is equivalent to calling it as a constructor with the same arguments. Thus the function call RTCError(...) is equivalent to the object creation expression new
        RTCError(...) with the same arguments.
        
The RTCError constructor is designed to be subclassable. It may be used as the value of an extends clause of a class definition. Subclass constructors that intend to inherit the specified RTCError behaviour must include a super call to the
          RTCError constructor to create and initialize the subclass instance with an [[ErrorData]] internal slot.
RTCErrorDetailType Enum
          enum RTCErrorDetailType {
    "data-channel-failure",
    "idp-bad-script-failure",
    "idp-execution-failure",
    "idp-load-failure",
    "idp-need-login",
    "idp-timeout",
    "idp-tls-failure",
    "idp-token-expired",
    "idp-token-invalid",
    "sctp-failure",
    "sdp-syntax-error"
};
            | Enumeration description | |
|---|---|
| data-channel-failure | The data channel has failed. | 
| idp-bad-script-failure | The script loaded from the identity provider is not valid JavaScript or did not implement the correct interfaces. | 
| idp-execution-failure | The identity provider has thrown an exception or returned a rejected promise. | 
| idp-load-failure | Loading of the IdP URI has failed. The httpRequestStatusCodeattribute is set to the HTTP status code of the response. | 
| idp-need-login | The identity provider requires the user to login. The idpLoginUrlattribute is set to the URL that can be used to login. | 
| idp-timeout | The IdP timer has expired. | 
| idp-tls-failure | The TLS certificate used for the IdP HTTPS connection is not trusted. | 
| idp-token-expired | The IdP token has expired. | 
| idp-token-invalid | The IdP token is invalid. | 
| sctp-failure | The SCTP negotiation has failed or the connection has been terminated with a fatal error. The sdpCauseCodeattribute is set to the SCTP cause code. | 
| sdp-syntax-error | The SDP syntax is not valid. The sdpLineNumberattribute is set to the line number in the SDP where the syntax error was detected. | 
When the RTCError function is called with arguments errorDetail and message the following steps are taken:
"%RTCErrorPrototype%", «[[ErrorData]]» ).
            errorDetail", errorDetailDesc).message", msgDesc).The value of the [[Prototype]] internal slot of the
          RTCError
          %Error%.
Besides the length property (whose value is 1), the RTCError
          
The initial value of RTCError.prototype is the RTCError
          prototype object. This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
The RTCError
          
The value of the [[Prototype]] internal slot of the
          RTCError
          %ErrorPrototype%.
The initial value of the constructor property of the prototype for the RTCError
            %RTCError%.
The initial value of the errorDetail property of the prototype for the RTCError
            
The initial value of the sdpLineNumber property of the prototype for the RTCError
            
The initial value of the httpRequestStatusCode property of the prototype for the RTCError
            
The initial value of the sctpCauseCode property of the prototype for the RTCError
            
The initial value of the message property of the prototype for the
            RTCError
            
The initial value of the name property of the prototype for the RTCError constructor is
            "RTCError".
RTCError
          RTCError
          
The following interface is defined for cases when an RTCError is raised as an event:
[Exposed=Window,
 Constructor(DOMString type, RTCErrorEventInit eventInitDict)]
interface RTCErrorEvent : Event {
    readonly attribute RTCError? error;
};
        RTCErrorEventConstructs a new
                RTCErrorEvent
                
| Parameter | Type | Nullable | Optional | Description | 
|---|---|---|---|---|
| type | DOMString | ✘ | ✘ | |
| eventInitDict | RTCErrorEventInit | ✘ | ✘ | 
dictionary RTCErrorEventInit : EventInit {
    RTCError? error = null;
};
        RTCErrorEventInit
          MembersThis section is non-normative.
The following events fire on RTCDataChannel
      
| Event name | Interface | Fired when... | 
|---|---|---|
| open | Event | The object's underlying data
            transport has been established (or re-established). | 
| message | MessageEvent[
            webmessaging] | A message was successfully received. | 
| bufferedamountlow | Event | The object'sdecreases from above itsto less than or equal to its. | 
| error |  | An error occurred on the data channel. | 
| close | Event | The object's underlying data
            transport has been closed. | 
The following events fire on RTCPeerConnection
      
| Event name | Interface | Fired when... | 
|---|---|---|
| track |  | A new incoming MediaStreamTrackhas been created to represent incoming media received by a specific
          . | 
| negotiationneeded | Event | The browser wishes to inform the application that session negotiation needs to be done (i.e. a createOffer call followed by setLocalDescription). | 
| signalingstatechange | Event | The signaling state has changed. This state change is the result of either orbeing invoked. | 
| iceconnectionstatechange | Event | The RTCPeerConnection's ICE connection state has changed. | 
| icegatheringstatechange | Event | The RTCPeerConnection's ICE gathering state has changed. | 
| icecandidate |  | A new is made available to the script. | 
| connectionstatechange | Event | The RTCPeerConnectionconnectionStatehas changed. | 
| icecandidateerror |  | A failure occured when gathering ICE candidates. | 
| datachannel |  | A new is dispatched to the script in response to the other peer creating a channel. | 
| isolationchange | Event | A new Eventis dispatched to the script when the isolated attribute on aMediaStreamTrackchanges. | 
| fingerprintfailure | Event | The RTCPeerConnection's DTLS Certificate did not match any of the fingerprints in the SDP. | 
The following events fire on RTCDTMFSender
      
| Event name | Interface | Fired when... | 
|---|---|---|
| tonechange |  | The object has either just begun playout of a tone (returned as theattribute) or just ended the playout of tones in the(returned as an empty value in theattribute). | 
The following events fire on RTCIceTransport
      
| Event name | Interface | Fired when... | 
|---|---|---|
| statechange | Event | The state changes. | 
| gatheringstatechange | Event | The gathering state changes. | 
| selectedcandidatepairchange | Event | The 's selected candidate pair changes. | 
The following events fire on RTCDtlsTransport
      
| Event name | Interface | Fired when... | 
|---|---|---|
| statechange | Event | The state changes. | 
This section is non-normative.
This section is non-normative; it specifies no new behaviour, but instead summarizes information already present in other parts of the specification. The overall security considerations of the general set of APIs and protocols used in WebRTC are described in [ RTCWEB-SECURITY-ARCH].
This document extends the Web platform with the ability to set up real time, direct communication between browsers and other devices, including other browsers.
This means that data and media can be shared between applications running in different browsers, or between an application running in the same browser and something that is not a browser, something that is an extension to the usual barriers in the Web model against sending data between entities with different origins.
The WebRTC specification provides no user prompts or chrome indicators for communication; it assumes that once the Web page has been allowed to access media, it is free to share that media with other entities as it chooses. Peer-to-peer exchanges of data view WebRTC datachannels can thus occur without any user explicit consent or involvement, similarly as a server-mediated exchange (e.g. via Web Sockets) could occur without user involvement.
The peerIdentity
        
Even without WebRTC, the Web server providing a Web application will know the public IP address to which the application is delivered. Setting up communications exposes additional information about the browser’s network context to the web application, and may include the set of (possibly private) IP addresses available to the browser for WebRTC use. Some of this information has to be passed to the corresponding party to enable the establishment of a communication session.
Revealing IP addresses can leak location and means of connection; this can be sensitive. Depending on the network environment, it can also increase the fingerprinting surface and create persistent cross-origin state that cannot easily be cleared by the user.
A connection will always reveal the IP addresses proposed for communication to the corresponding party. The application can limit this exposure by choosing not to use certain addresses using the settings exposed by the RTCIceTransportPolicy dictionary, and by using relays (for instance TURN servers) rather than direct connections between participants. One will normally assume that the IP address of TURN servers is not sensitive information. These choices can for instance be made by the application based on whether the user has indicated consent to start a media connection with the other party.
Mitigating the exposure of IP addresses to the application itself requires limiting the IP addresses that can be used, which will impact the ability to communicate on the most direct path between endpoints. Browsers are encouraged to provide appropriate controls for deciding which IP addresses are made available to applications, based on the security posture desired by the user. The choice of which addresses to expose is controlled by local policy (see [RTCWEB-IP-HANDLING] for details).
Since the browser is an active platform executing in a trusted network environment (inside the firewall), it is important to limit the damage that the browser can do to other elements on the local network, and it is important to protect data from interception, manipulation and modification by untrusted participants.
Mitigations include:
These measures are specified in the relevant IETF documents.
The fact that communication is taking place cannot be hidden from adversaries that can observe the network, so this has to be regarded as public information.
A mechanism, peerIdentity
        
As described above, the list of IP addresses exposed by the WebRTC API can be used as a persistent cross-origin state.
Beyond IP addresses, the WebRTC API exposes information about the underlying media system via the RTCRtpSender.getCapabilities and RTCRtpReceiver.getCapabilities methods, including detailed and ordered information about the codecs that the system is able to produce and consume. A subset of that information is likely to be represented in the SDP session descriptions generated, exposed and transmitted during session
      negotiation. That information is in most cases persistent across time and origins, and increases the fingerprint surface of a given device.
If set, the configured default ICE servers exposed by getDefaultIceServers on
        RTCPeerConnection instances also provides persistent across time and origins information which increases the fingerprinting surface of a given browser.
When establishing DTLS connections, the WebRTC API can generate certificates that can be persisted by the application (e.g. in IndexedDB). These certificates are not shared across origins, and get cleared when persistent storage is cleared for the origin.
This section will be removed before publication.
The editors wish to thank the Working Group chairs and Team Contact, Harald Alvestrand, Stefan Håkansson, Erik Lagerway and Dominique Hazaël-Massieux, for their support. Substantial text in this specification was provided by many people including Martin Thomson, Harald Alvestrand, Justin Uberti, Eric Rescorla, Peter Thatcher, Jan-Ivar Bruaroey and Peter Saint-Andre. Dan Burnett would like to acknowledge the significant support received from Voxeo and Aspect during the development of this specification.
The RTCRtpSender and RTCRtpReceiver objects were initially described in the W3C ORTC CG, and have been adapted for use in this specification.