RTCPeerConnection

< apis‎ | webrtc
Jump to: navigation, search

RTCPeerConnection

This page has been flagged with the following issues:

High-level issues:


W3C Working Draft

Summary

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


Properties

API Name Summary
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

API Name Summary
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

API Name Summary
addstream A new stream has been added to the remoteStreams array.
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
removestream A stream has been removed from the remoteStreams array.
statechange

Needs Examples: This section should include examples.



Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? ? ? ? ?

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic support ? ? ? ? ? ? ? ?