Summary

Functions

Returns a specification to start this module under a supervisor.

Closes the WebRtcTransport.

Tells whether the given WebRtcTransport is closed on the local node.

Instructs the router to send audio or video RTP (or SRTP depending on the transport class). This is the way to extract media from mediasoup. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-consume

Instructs the router to send data messages to the endpoint via SCTP protocol or directly to the Node.js process if the transport is a DirectTransport. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-consumedata

Dump internal stat for WebRtcTransport.

Local ICE role. Due to the mediasoup ICE Lite design, this is always “controlled”. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-iceRole

The selected transport tuple if ICE is in “connected” or “completed” state. It is undefined if ICE is not established (no working candidate pair was found). https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-iceSelectedTuple

WebRtcTransport identifier.

Instructs the router to receive audio or video RTP (or SRTP depending on the transport class). This is the way to inject media into mediasoup. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-produce

Instructs the router to receive data messages. Those messages can be delivered by an endpoint via SCTP protocol or can be directly sent from the Node.js application if the transport is a DirectTransport. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-producedata

Types

@type connect_option() :: map()
@type create_option() :: map() | Mediasoup.WebRtcTransport.Options.t()
@type event_type() ::
  :on_close
  | :on_sctp_state_change
  | :on_ice_state_change
  | :on_dtls_state_change
  | :on_ice_selected_tuple_change
@type ice_parameter() :: map()
@type t() :: %Mediasoup.WebRtcTransport{id: String.t(), pid: pid()}
@type transport_stat() :: map()

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

close(web_rtc_transport)

View Source
@spec close(t()) :: :ok

Closes the WebRtcTransport.

Link to this function

closed?(web_rtc_transport)

View Source
@spec closed?(t()) :: boolean()

Tells whether the given WebRtcTransport is closed on the local node.

Link to this function

connect(web_rtc_transport, option)

View Source
@spec connect(t(), connect_option()) :: {:ok} | {:error, String.t() | :terminated}

Provides the WebRTC transport with the endpoint parameters. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-connect

Link to this function

consume(transport, option)

View Source
@spec consume(t(), Mediasoup.Consumer.Options.t() | map()) ::
  {:ok, Mediasoup.Consumer.t()} | {:error, String.t() | :terminated}

Instructs the router to send audio or video RTP (or SRTP depending on the transport class). This is the way to extract media from mediasoup. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-consume

Link to this function

consume_data(transport, option)

View Source
@spec consume_data(t(), Mediasoup.DataConsumer.Options.t() | map()) ::
  {:ok, Mediasoup.DataConsumer.t()} | {:error, String.t() | :terminated}

Instructs the router to send data messages to the endpoint via SCTP protocol or directly to the Node.js process if the transport is a DirectTransport. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-consumedata

Link to this function

dtls_parameters(web_rtc_transport)

View Source
@spec dtls_parameters(t()) :: map() | {:error, :terminated}

Local DTLS parameters. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-dtlsParameters

Link to this function

dtls_state(web_rtc_transport)

View Source
@spec dtls_state(t()) :: String.t() | {:error, :terminated}

Current DTLS state. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-dtlsState

@spec dump(t()) :: any() | {:error, :terminated}

Dump internal stat for WebRtcTransport.

Link to this function

event(transport, listener, event_types \\ [:on_close, :on_sctp_state_change, :on_ice_state_change, :on_dtls_state_change, :on_ice_selected_tuple_change])

View Source
@spec event(t(), pid(), event_types :: [event_type()]) ::
  {:ok} | {:error, :terminated}

Starts observing event.

Link to this function

get_stats(web_rtc_transport)

View Source
@spec get_stats(t()) :: [transport_stat()] | {:error, reason :: term()}

Returns current RTC statistics of the WebRTC transport. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-getStats

Link to this function

ice_candidates(web_rtc_transport)

View Source
@spec ice_candidates(t()) :: [any()]

Local ICE candidates. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-iceCandidates

Link to this function

ice_parameters(web_rtc_transport)

View Source
@spec ice_parameters(t()) :: ice_parameter() | {:error, :terminated}

Local ICE parameters. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-iceParameters

Link to this function

ice_role(web_rtc_transport)

View Source
@spec ice_role(t()) :: String.t() | {:error, :terminated}

Local ICE role. Due to the mediasoup ICE Lite design, this is always “controlled”. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-iceRole

Link to this function

ice_selected_tuple(web_rtc_transport)

View Source
@spec ice_selected_tuple(t()) :: String.t() | nil | {:error, :terminated}

The selected transport tuple if ICE is in “connected” or “completed” state. It is undefined if ICE is not established (no working candidate pair was found). https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-iceSelectedTuple

Link to this function

ice_state(web_rtc_transport)

View Source
@spec ice_state(t()) :: String.t() | {:error, :terminated}

Current ICE state. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-iceState

@spec id(t()) :: String.t()

WebRtcTransport identifier.

Link to this function

produce(transport, option)

View Source
@spec produce(t(), Mediasoup.Producer.Options.t() | map()) ::
  {:ok, Mediasoup.Producer.t()} | {:error, String.t() | :terminated}

Instructs the router to receive audio or video RTP (or SRTP depending on the transport class). This is the way to inject media into mediasoup. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-produce

Link to this function

produce_data(transport, option)

View Source
@spec produce_data(t(), Mediasoup.DataProducer.Options.t() | map()) ::
  {:ok, Mediasoup.DataProducer.t()} | {:error, String.t() | :terminated}

Instructs the router to receive data messages. Those messages can be delivered by an endpoint via SCTP protocol or can be directly sent from the Node.js application if the transport is a DirectTransport. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-producedata

Link to this function

restart_ice(web_rtc_transport)

View Source
@spec restart_ice(t()) :: {:ok, ice_parameter()} | {:error, :terminated}

Current ICE state. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-iceState

Link to this function

sctp_parameters(web_rtc_transport)

View Source
@spec sctp_parameters(t()) :: map() | {:error, :terminated}

Local SCTP parameters. Or undefined if SCTP is not enabled. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-sctpParameters

Link to this function

sctp_state(web_rtc_transport)

View Source
@spec sctp_state(t()) :: String.t() | {:error, :terminated}

Current SCTP state. Or undefined if SCTP is not enabled. https://mediasoup.org/documentation/v3/mediasoup/api/#webRtcTransport-sctpState

Link to this function

set_max_incoming_bitrate(web_rtc_transport, bitrate)

View Source
@spec set_max_incoming_bitrate(t(), integer()) :: {:ok} | {:error, :terminated}
Link to this function

set_max_outgoing_bitrate(web_rtc_transport, bitrate)

View Source
@spec set_max_outgoing_bitrate(t(), integer()) :: {:ok} | {:error, :terminated}
@spec struct_from_pid(pid()) :: t()
Link to this function

struct_from_pid_and_ref(pid, reference)

View Source