This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The RTCPeerConnection()
constructor returns a newly-created RTCPeerConnection
, which represents a connection between the local device and a remote peer.
pc = new RTCPeerConnection([configuration]);
configuration
Optional
RTCConfiguration
dictionary providing options to configure the new connection.bundlePolicy
Optional
RTCBundlePolicy
. If this value isn't included in the dictionary, "balanced"
is assumed.certificates
Optional
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. RTCPeerConnection.setConfiguration()
.iceCandidatePoolSize
Optional
RTCPeerConnection.setLocalDescription()
is called. iceServers
Optional
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 ICE agent may choose to use its own ICE servers; otherwise, the connection attempt will be made with no STUN or TURN server available, which limits the connection to local peers.iceTransportPolicy
Optional
RTCIceTransportPolicy
enum. If this isn't specified, "all"
is assumed.peerIdentity
Optional
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
RTCRtcpMuxPolicy
enum. The default is "require"
.A newly-created RTCPeerConnection
object, configured as described by configuration
, if specified; otherwise, configured to appropriate basic defaults.
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'RTCPeerConnection()' in that specification. | Working Draft | Initial definition. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 22 (22) | ? | ? | ? |
iceCandidatePoolSize | 59 | ? | ? | ? | ? | ? |
Feature | Android Webview | Chrome for Android | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support | No support | (Yes) | (Yes) | 24.0 (24) | ? | ? | ? | ? |
iceCandiatePoolSize | No support | 59 | ? | ? | ? | ? | ? | ? |
RTCPeerConnection
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/RTCPeerConnection