View Source ExWebRTC.PeerConnection (ex_webrtc v0.1.0)
Implementation of the RTCPeerConnection.
Summary
Types
Possible PeerConnection states.
Messages sent by the ExWebRTC.
Possible PeerConnection signaling states.
Functions
Returns a specification to start this module under a supervisor.
Returns a list of all running peer connections.
Returns peer connection's statistics.
Types
@type answer_options() :: []
@type connection_state() ::
:closed | :failed | :disconnected | :new | :connecting | :connected
Possible PeerConnection states.
For the exact meaning, refer to the WebRTC W3C, section 4.3.3
@type offer_options() :: [{:ice_restart, boolean()}]
@type peer_connection() :: GenServer.server()
@type signal() :: {:ex_webrtc, pid(), :negotiation_needed | {:ice_candidate, ExWebRTC.ICECandidate.t()} | {:signaling_state_change, signaling_state()} | {:connection_state_change, connection_state()} | {:track, ExWebRTC.MediaStreamTrack.t()} | {:track_muted, ExWebRTC.MediaStreamTrack.id()} | {:track_ended, ExWebRTC.MediaStreamTrack.id()} | {:rtp, ExWebRTC.MediaStreamTrack.id(), ExRTP.Packet.t()}}
Messages sent by the ExWebRTC.
@type signaling_state() :: :stable | :have_local_offer | :have_remote_offer
Possible PeerConnection signaling states.
For the exact meaning, refer to the WebRTC W3C, section 4.3.1
@type transceiver_options() :: [{:direction, ExWebRTC.RTPTransceiver.direction()}]
Functions
@spec add_ice_candidate(peer_connection(), ExWebRTC.ICECandidate.t()) :: :ok | {:error, :no_remote_description}
@spec add_track(peer_connection(), ExWebRTC.MediaStreamTrack.t()) :: {:ok, ExWebRTC.RTPSender.t()}
@spec add_transceiver( peer_connection(), ExWebRTC.RTPTransceiver.kind() | ExWebRTC.MediaStreamTrack.t(), transceiver_options() ) :: {:ok, ExWebRTC.RTPTransceiver.t()}
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec close(peer_connection()) :: :ok
@spec create_answer(peer_connection(), answer_options()) :: {:ok, ExWebRTC.SessionDescription.t()} | {:error, :invalid_state}
@spec create_offer(peer_connection(), offer_options()) :: {:ok, ExWebRTC.SessionDescription.t()} | {:error, :invalid_state}
@spec get_all_running() :: [pid()]
Returns a list of all running peer connections.
@spec get_current_local_description(peer_connection()) :: ExWebRTC.SessionDescription.t() | nil
@spec get_current_remote_description(peer_connection()) :: ExWebRTC.SessionDescription.t() | nil
@spec get_stats(peer_connection()) :: %{required(atom() | integer()) => map()}
Returns peer connection's statistics.
See RTCStatsReport for the output structure.
@spec get_transceivers(peer_connection()) :: [ExWebRTC.RTPTransceiver.t()]
@spec remove_track(peer_connection(), ExWebRTC.RTPSender.id()) :: :ok | {:error, :invalid_sender_id}
@spec replace_track( peer_connection(), ExWebRTC.RTPSender.id(), ExWebRTC.MediaStreamTrack.t() ) :: :ok | {:error, :invalid_sender_id | :invalid_track_type}
@spec send_rtp(peer_connection(), String.t(), ExRTP.Packet.t()) :: :ok
@spec set_local_description(peer_connection(), ExWebRTC.SessionDescription.t()) :: :ok | {:error, atom()}
@spec set_remote_description(peer_connection(), ExWebRTC.SessionDescription.t()) :: :ok | {:error, atom()}
Link to this function
set_transceiver_direction(peer_connection, transceiver_id, direction)
View Source@spec set_transceiver_direction( peer_connection(), ExWebRTC.RTPTransceiver.id(), ExWebRTC.RTPTransceiver.direction() ) :: :ok | {:error, :invalid_transceiver_id}
@spec start(ExWebRTC.PeerConnection.Configuration.options()) :: GenServer.on_start()
@spec start_link(ExWebRTC.PeerConnection.Configuration.options()) :: GenServer.on_start()
@spec stop_transceiver(peer_connection(), ExWebRTC.RTPTransceiver.id()) :: :ok | {:error, :invalid_transceiver_id}