This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

RTCPeerConnection

Summary

Provides for the connection between remote peers, the transmission of locally generated MediaStream data and arbitrary data between peers.

Properties

iceGatheringState
Returns the gathering state of the ICE agent.
iceState
Returns the ICE state of the ICE agent.
localDescription
Returns the RTCSessionDescription most recently passed to the setLocalDescription() method along with any local candidate descriptions generated since the method was called.
localStreams
Returns an array of MediaStream objects added to the connection with addStream().
onaddstream
Handles the addstream event fired when setRemoteDescription() is called.
ondatachannel
Handles the datachannel event.
ongatheringchange
Handles the gatheringchange event for a change to the iceGatheringState property.
onicecandidate
Handles the icechange event for a change to the apis/webrtc/RTCPeerConnection/iceState property. It is called any time there is a new ICE candidate added to a previous offer or answer.
onicechange
Handles the icechange event. It is called any time the iceState changes.
onidentityresult
Handles the identityresult event for the success or failure of an identity verification.
onnegotiationneeded
Handles the negotiationneeded event.
onopen
Handles the open event. Testing.
onremovestream
Handles the removeStream event for when setRemoteDescription() is called to remove a MediaStream object on the remote peer.
onstatechange
Handles the statechange event for when the readyState property is changed, i.e. with a call to setLocalDescription() or setRemoteDescription(). The event does not fire when a new RTCPeerConnection object is created.
peerIdentity
Contains the peer identity assertion information if an identity assertion was provided and verified.
readyState
Returns the ready state of the peer connection.
remoteDescription
Returns the RTCSessionDescription most recently passed to the setRemoteDescription() method along with any remote candidate descriptions supplied with addIceCandidate(). Returns null if the remote description has not been set.
remoteStreams
Returns an array of MediaStream objects added to the connection by the remote peer. This array is updated when the addstream and removestream events are fired.

Methods

addIceCandidate
Provides a remote candidate to the ICE agent.
addStream
Adds a new stream to the RTCPeerConnection.
close
Closes a peer connection, stops all active ICE processing and any active streaming, and releases any relevant resources such as TURN permissions.
createAnswer
Creates a session description compatible with the remote configuration.
createDataChannel
Creates an RTCDataChannel object with the given label.
createOffer
Creates a session description compatible with the local configuration.
getIdentityAssertion
Provides an identity assertion.
getStats
Retrieves status information for a given MediaStreamTrack.
removeStream
Removes the given stream from the localStreams array in the RTCPeerConnection and fires the negotiationneeded event.
setIdentityProvider
Sets the identity provider. Not required if the browser is already configured for an identity provider.
setLocalDescription
Applies the supplied RTCSessionDescription to the local description.
setRemoteDescription
Applies the supplied RTCSessionDescription to the remote description.
updateIce
Updates the ICE agent process that gathers local candidates and remote candidates.

Events

icecandidate
:

icechange
:

identityresult
:

negotiationneeded

The browser anticipates a session negotiation is required.

It is triggered whenever addStream, removeStream or setIdentityProvider methods were called successfully and RTCPeerConnection signalingState is stable .

open
:

statechange
: