RTCPeerConnection : EventTarget
Enables Real Time Communication of audio, video, and data to another browser/computer using the WebRTC peer to peer protocol.
Although WebRTC is a peer to peer protocol, the peers need some information about each other before they can communicate. Typically this is done with a Signaling Server, but any mechanism to transfer data can be used. The following demonstrates setting up the peer connection using the clipboard (via copy/paste) to transfer the connection data.
Offerer
This example demonstrates the peer that creates the offer.Example:
RunResults:
Answerer
This example demonstrates the peer that receives the offer and creates the answer.Example:
RunResults:
Constructors
The elements of the iceServers
property in the configuration
argument should be of type: { url : (String or Iterable<String>), username : String, credential : String, credentialType : String }
Instance Properties
Returns true
if the remote peer accepts trickled ice candidates. Only valid after calling setRemoteDescription()
.
One of 'closed'
, 'failed'
, 'disconnected'
, 'new'
, 'connecting'
, or 'connected'
.
One of 'closed'
, 'failed'
, 'disconnected'
, 'new'
, 'checking'
, 'completed'
, or 'connected'
.
One of 'stable'
, 'have-local-offer'
, 'have-remote-offer'
, 'have-local-pranswer'
, 'have-remote-pranswer'
, or 'closed'
Instance Methods
direction : | String | One of 'sendrecv' , 'sendonly' , 'recvonly' , 'inactive' , or 'stopped' . Defaults to 'sendrecv' . |
streams : | Iterable<MediaStream> | |
sendEncodings : | Iterable |
The elements of the sendEncodings
property in the configuration
argument should be of type: { rid : String, active : Boolean /* Default = true
*/, maxBitrate : Number, scalingResolutionDownBy : Number }