pub struct RTCPeerConnection { /* private fields */ }
Expand description

PeerConnection represents a WebRTC connection that establishes a peer-to-peer communications with another PeerConnection instance in a browser, or to another endpoint implementing the required protocols.

Implementations

on_signaling_state_change sets an event handler which is invoked when the peer connection’s signaling state changes

on_data_channel sets an event handler which is invoked when a data channel message arrives from a remote peer.

on_negotiation_needed sets an event handler which is invoked when a change has occurred which requires session negotiation

on_ice_candidate sets an event handler which is invoked when a new ICE candidate is found. Take note that the handler is gonna be called with a nil pointer when gathering is finished.

on_ice_gathering_state_change sets an event handler which is invoked when the ICE candidate gathering state has changed.

on_track sets an event handler which is called when remote track arrives from a remote peer.

on_ice_connection_state_change sets an event handler which is called when an ICE connection state is changed.

on_peer_connection_state_change sets an event handler which is called when the PeerConnectionState has changed

get_configuration returns a Configuration object representing the current configuration of this PeerConnection object. The returned object is a copy and direct mutation on it will not take affect until set_configuration has been called with Configuration passed as its only argument. https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-getconfiguration

create_offer starts the PeerConnection and generates the localDescription https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-createoffer

create_answer starts the PeerConnection and generates the localDescription

set_local_description sets the SessionDescription of the local peer

local_description returns PendingLocalDescription if it is not null and otherwise it returns CurrentLocalDescription. This property is used to determine if set_local_description has already been called. https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-localdescription

set_remote_description sets the SessionDescription of the remote peer

remote_description returns pending_remote_description if it is not null and otherwise it returns current_remote_description. This property is used to determine if setRemoteDescription has already been called. https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-remotedescription

add_ice_candidate accepts an ICE candidate string and adds it to the existing set of candidates.

ice_connection_state returns the ICE connection state of the PeerConnection instance.

get_senders returns the RTPSender that are currently attached to this PeerConnection

get_receivers returns the RTPReceivers that are currently attached to this PeerConnection

get_transceivers returns the RtpTransceiver that are currently attached to this PeerConnection

add_track adds a Track to the PeerConnection

remove_track removes a Track from the PeerConnection

add_transceiver_from_kind Create a new RtpTransceiver and adds it to the set of transceivers.

add_transceiver_from_track Create a new RtpTransceiver(SendRecv or SendOnly) and add it to the set of transceivers.

create_data_channel creates a new DataChannel object with the given label and optional DataChannelInit used to configure properties of the underlying channel such as data reliability.

set_identity_provider is used to configure an identity provider to generate identity assertions

write_rtcp sends a user provided RTCP packet to the connected peer. If no peer is connected the packet is discarded. It also runs any configured interceptors.

close ends the PeerConnection

CurrentLocalDescription represents the local description that was successfully negotiated the last time the PeerConnection transitioned into the stable state plus any local candidates that have been generated by the ICEAgent since the offer or answer was created.

PendingLocalDescription represents a local description that is in the process of being negotiated plus any local candidates that have been generated by the ICEAgent since the offer or answer was created. If the PeerConnection is in the stable state, the value is null.

current_remote_description represents the last remote description that was successfully negotiated the last time the PeerConnection transitioned into the stable state plus any remote candidates that have been supplied via add_icecandidate() since the offer or answer was created.

pending_remote_description represents a remote description that is in the process of being negotiated, complete with any remote candidates that have been supplied via add_icecandidate() since the offer or answer was created. If the PeerConnection is in the stable state, the value is null.

signaling_state attribute returns the signaling state of the PeerConnection instance.

icegathering_state attribute returns the ICE gathering state of the PeerConnection instance.

connection_state attribute returns the connection state of the PeerConnection instance.

sctp returns the SCTPTransport for this PeerConnection

The SCTP transport over which SCTP data is sent and received. If SCTP has not been negotiated, the value is nil. https://www.w3.org/TR/webrtc/#attributes-15

gathering_complete_promise is a Pion specific helper function that returns a channel that is closed when gathering is complete. This function may be helpful in cases where you are unable to trickle your ICE Candidates.

It is better to not use this function, and instead trickle candidates. If you use this function you will see longer connection startup times. When the call is connected you will see no impact however.

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.