Your guide to the WebRTC universe, circa 1997!
Browse the classes below:
The RTCPeerConnection interface represents a WebRTC connection between the local computer and a remote peer.
Parameter | Description |
---|---|
configuration (Optional[RTCConfiguration]) | An optional RTCConfiguration. |
Properties:
Property | Description |
---|---|
connectionState: str | The current connection state. Possible values: "connected", "connecting", "closed", "failed", "new". When the state changes, the "connectionstatechange" event is fired. |
iceConnectionState: str | The current ICE connection state. Possible values: "checking", "completed", "closed", "failed", "new". When the state changes, the "iceconnectionstatechange" event is fired. |
iceGatheringState: str | The current ICE gathering state. Possible values: "complete", "gathering", "new". When the state changes, the "icegatheringstatechange" event is fired. |
localDescription: RTCSessionDescription | An RTCSessionDescription describing the session for the local end of the connection. |
remoteDescription: RTCSessionDescription | An RTCSessionDescription describing the session for the remote end of the connection. |
sctp: RTCSctpTransport|None | An RTCSctpTransport describing the SCTP transport being used for datachannels or None. |
signalingState | The current signaling state. Possible values: "closed", "have-local-offer", "have-remote-offer", "stable". When the state changes, the "signalingstatechange" event is fired. |
Methods:
Method | Description |
---|---|
await addIceCandidate(candidate) | Add a new RTCIceCandidate received from the remote peer. The specified candidate must have a value for either sdpMid or sdpMLineIndex. |
addTrack(track) | Add a MediaStreamTrack to the set of media tracks which will be transmitted to the remote peer. |
addTransceiver(trackOrKind, direction='sendrecv') | Add a new RTCRtpTransceiver. |
await close() | Terminate the ICE agent, ending ICE processing and streams. |
await createAnswer() | Create an SDP answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection. |
createDataChannel(label, maxPacketLifeTime=None, maxRetransmits=None, ordered=True, protocol='', negotiated=False, id=None) | Create a data channel with the given label. |
await createOffer() | Create an SDP offer for the purpose of starting a new WebRTC connection to a remote peer. |
getReceivers() | Returns the list of RTCRtpReceiver objects that are currently attached to the connection. |
getSenders() | Returns the list of RTCRtpSender objects that are currently attached to the connection. |
await getStats() | Returns statistics for the connection. |
getTransceivers() | Returns the list of RTCRtpTransceiver objects that are currently attached to the connection. |
await setLocalDescription(sessionDescription) | Change the local description associated with the connection. |
await setRemoteDescription(sessionDescription) | Changes the remote description associated with the connection. |
The RTCSessionDescription dictionary describes one end of a connection and how it’s configured.
The RTCConfiguration dictionary is used to provide configuration options for an RTCPeerConnection.
Parameter | Description |
---|---|
iceServers: Optional[list[RTCIceServer]]=None | A list of RTCIceServer objects to configure STUN / TURN servers. |
The RTCIceCandidate interface represents a candidate Interactive Connectivity Establishment (ICE) configuration which may be used to establish an RTCPeerConnection.
The RTCIceGatherer interface gathers local host, server reflexive and relay candidates, as well as enabling the retrieval of local Interactive Connectivity Establishment (ICE) parameters which can be exchanged in signaling.
Properties:
Property | Description |
---|---|
state: str | The current state of the ICE gatherer. |
Methods:
Method | Description |
---|---|
await gather() | Gather ICE candidates. |
classmethod getDefaultIceServers() | Return the list of default RTCIceServer. |
getLocalCandidates() | Retrieve the list of valid local candidates associated with the ICE gatherer. |
getLocalParameters() | Retrieve the ICE parameters of the ICE gatherer. |
The RTCIceTransport interface allows an application access to information about the Interactive Connectivity Establishment (ICE) transport over which packets are sent and received.
Parameter | Description |
---|---|
gatherer(RTCIceGatherer) | An RTCIceGatherer. |
Properties:
Property | Description |
---|---|
iceGatherer: RTCIceGatherer | The ICE gatherer passed in the constructor. |
role: str | The current role of the ICE transport. Either ‘controlling’ or ‘controlled’. |
state: str | The current state of the ICE transport. |
Methods:
Method | Description |
---|---|
await addRemoteCandidate(candidate) | Add a remote candidate. |
getRemoteCandidates() | Retrieve the list of candidates associated with the remote RTCIceTransport. |
await start(remoteParameters) | Initiate connectivity checks. |
await stop() | Irreversibly stop the RTCIceTransport. |
More info on WebRTC
Best viewed with: or
!