RTCConfiguration

The RTCConfiguration dictionary is used to provide configuration options for an RTCPeerConnection. It may be passed into the constructor when instantiating a connection, or used with the RTCPeerConnection.getConfiguration() and RTCPeerConnection.setConfiguration() methods, which allow inspecting and changing the configuration while a connection is established.

The options include ICE server and transport settings and identity information.

Properties

bundlePolicy Optional
Specifies how to handle negotiation of candidates when the remote peer is not compatible with the SDP BUNDLE standard. This must be one of the values from the enum RTCBundlePolicy. If this value isn't included in the dictionary, "balanced" is assumed.
certificates Optional
An Array of objects of type RTCCertificate which are used by the connection for authentication. If this property isn't specified, a set of certificates is generated automatically for each RTCPeerConnection instance. Although only one certificate is used by a given connection, providing certificates for multiple algorithms may improve the odds of successfully connecting in some circumstances. See Using certificates below for additional information.
This configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to RTCPeerConnection.setConfiguration().
iceCandidatePoolSize Optional
An unsigned 16-bit integer value which specifies the size of the prefetched ICE candidate pool. The default value is 0 (meaning no candidate prefetching will occur). You may find in some cases that connections can be established more quickly by allowing the ICE agent to start fetching ICE candidates before you start trying to connect, so that they're already available for inspection when RTCPeerConnection.setLocalDescription() is called.
Changing the size of the ICE candidate pool may trigger the beginning of ICE gathering.
iceServers Optional
An array of RTCIceServer objects, each describing one server which may be used by the ICE agent; these are typically STUN and/or TURN servers. If this isn't specified, the connection attempt will be made with no STUN or TURN server available, which limits the connection to local peers.
iceTransportPolicy Optional
The current ICE transport policy; this must be one of the values from the RTCIceTransportPolicy enumeration. If the policy isn't specified, all is assumed by default, allowing all candidates to be considered. A value of relay limits the candidates to those relayed through another server, such as a STUN or TURN server.
peerIdentity Optional
A DOMString which specifies the target peer identity for the RTCPeerConnection. If this value is set (it defaults to null), the RTCPeerConnection will not connect to a remote peer unless it can successfully authenticate with the given name.
rtcpMuxPolicy Optional
The RTCP mux policy to use when gathering ICE candidates, in order to support non-multiplexed RTCP. The value must be one of those from the RTCRtcpMuxPolicy enum. The default is "require".

Constants

RTCBundlePolicy enum

The RTCBundlePolicy enum defines string constants which are used to request a specific policy for gathering ICE candidates if the remote peer isn't "BUNDLE-aware" (compatible with the SDP BUNDLE standard for bundling multiple media streams on a single transport link). All browser implementations are BUNDLE-aware.

If the remote endpoint is BUNDLE-aware, all media tracks and data channels are bundled onto a single transport at the completion of negotiation, regardless of policy used, and any superfluous transports that were created initially are closed at that point.

Note: In technical terms, a BUNDLE lets all media flow between two peers flow across a single 5-tuple; that is, from a single IP and port on one peer to a single IP and port on the other peer, using the same transport protocol.

Constant Description
"balanced" The ICE agent initially creates one RTCDtlsTransport for each type of content added: audio, video, and data channels. If the remote endpoint is not BUNDLE-aware, then each of these DTLS transports then handles all the communication for one type of data.
"max-compat" The ICE agent initially creates one RTCDtlsTransport per media track and a separate one for data channels. If the remote endpoint is not BUNDLE-aware, everything is negotiated on these separate DTLS transports.
"max-bundle" The ICE agent initially creates only a single RTCDtlsTransport to carry all of the RTCPeerConnection's data. If the remote endpoint is not BUNDLE-aware, then only a single track will be negotiated and the rest ignored.

RTCIceTransportPolicy enum

The RTCIceTransportPolicy enum defines string constants which can be used to limit the transport policies of the ICE candidates to be considered during the connection process.

Constant Description
"all" All ICE candidates will be considered.
"public" Only ICE candidates with public IP addresses will be considered. Removed from the specification's May 13, 2016 working draft.
"relay" Only ICE candidates whose IP addresses are being relayed, such as those being passed through a TURN server, will be considered.

RTCRtcpMuxPolicy enum

The RTCRtcpMuxPolicy enum defines string constants which specify what ICE candidates are gathered to support non-multiplexed RTCP. <<<add a link to info about multiplexed RTCP.

Constant Description
"negotiate" Instructs the ICE agent to gather both RTP and RTCP candidates. If the remote peer can multiplex RTCP, then RTCP candidates are multiplexed atop the corresponding RTP candidates. Otherwise, both the RTP and RTCP candidates are returned, separately.
"require" Tells the ICE agent to gather ICE candidates for only RTP, and to multiplex RTCP atop them. If the remote peer doesn't support RTCP multiplexing, then session negotiation fails.

Using certificates

When you wish to provide your own certificates for use by an RTCPeerConnection instead of having the RTCPeerConnection generate them automatically, you do so through calls to RTCPeerConnection.generateCertificate().

This attribute supports providing multiple certificates because even though a given DTLS connection uses only one certificate, providing multiple certificates allows support for multiple encryption algorithms. The implementation of RTCPeerConnection will choose which certificate to use based on the algorithms it and the remote peer support, as determined during DTLS handshake.

If you don't provide certificates, new ones are generated automatically. One obvious benefit to providing your own is identity key continuity—if you use the same certificate for subsequent calls, the remote peer can tell you're the same caller. This also avoids the cost of generating new keys.

<<<--- add link to information about identity --->>>

Example

The configuration below establishes two ICE servers. The first one, stun:stun.services.mozilla.com, requires authentication, so the username and password are provided. The second server has two URLs: stun:stun.example.com and stun:stun-1.example.com.

var configuration = { iceServers: [{
                          urls: "stun:stun.services.mozilla.com",
                          username: "louis@mozilla.com",
                          credential: "webrtcdemo"
                      }, {
                          urls: ["stun:stun.example.com", "stun:stun-1.example.com"]
                      }]
};

var pc = new RTCPeerConnection(configuration);

Specifications

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCConfiguration' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
RTCConfigurationChrome Full support 23Edge Full support ≤79Firefox ? IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support 57Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 7.0
bundlePolicyChrome Full support 23Edge Full support ≤79Firefox ? IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support 57Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 7.0
certificatesChrome Full support 23Edge Full support ≤79Firefox ? IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support 57Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 7.0
iceCandidatePoolSizeChrome Full support 23Edge Full support ≤79Firefox ? IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support 57Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 7.0
iceServersChrome Full support 23Edge Full support ≤79Firefox ? IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support 57Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 7.0
iceTransportPolicyChrome Full support 23Edge Full support ≤79Firefox ? IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support 57Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 7.0
peerIdentityChrome Full support 23Edge Full support ≤79Firefox ? IE No support NoOpera Full support YesSafari ? WebView Android Full support YesChrome Android Full support 57Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 7.0
rtcpMuxPolicyChrome Full support 57
Notes
Full support 57
Notes
Notes Default for rtcpMuxPolicy is require
Edge Full support ≤79
Notes
Full support ≤79
Notes
Notes Default for rtcpMuxPolicy is require
Firefox ? IE No support NoOpera Full support 44
Notes
Full support 44
Notes
Notes Default for rtcpMuxPolicy is require
Safari ? WebView Android Full support YesChrome Android Full support 57Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support 7.0

Legend

Full support
Full support
No support
No support
Compatibility unknown
Compatibility unknown
See implementation notes.
See implementation notes.