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

connect_option()

@type connect_option() :: map()

create_option()

@type create_option() :: map() | Mediasoup.WebRtcTransport.Options.t()

event_type()

@type event_type() ::
  :on_close
  | :on_sctp_state_change
  | :on_ice_state_change
  | :on_dtls_state_change
  | :on_ice_selected_tuple_change

ice_parameter()

@type ice_parameter() :: map()

t()

@type t() :: %Mediasoup.WebRtcTransport{id: String.t(), pid: pid()}

transport_stat()

@type transport_stat() :: map()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(web_rtc_transport)

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

Closes the WebRtcTransport.

closed?(web_rtc_transport)

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

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

connect(web_rtc_transport, option)

@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

consume(transport, option)

@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

consume_data(transport, option)

@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

dtls_parameters(web_rtc_transport)

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

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

dtls_state(web_rtc_transport)

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

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

dump(web_rtc_transport)

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

Dump internal stat for WebRtcTransport.

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

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

Starts observing event.

get_stats(web_rtc_transport)

@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

ice_candidates(web_rtc_transport)

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

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

ice_parameters(web_rtc_transport)

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

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

ice_role(web_rtc_transport)

@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

ice_selected_tuple(web_rtc_transport)

@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

ice_state(web_rtc_transport)

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

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

id(web_rtc_transport)

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

WebRtcTransport identifier.

produce(transport, option)

@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

produce_data(transport, option)

@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

restart_ice(web_rtc_transport)

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

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

sctp_parameters(web_rtc_transport)

@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

sctp_state(web_rtc_transport)

@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

set_max_incoming_bitrate(web_rtc_transport, bitrate)

@spec set_max_incoming_bitrate(t(), integer()) :: {:ok} | {:error, :terminated}

set_max_outgoing_bitrate(web_rtc_transport, bitrate)

@spec set_max_outgoing_bitrate(t(), integer()) :: {:ok} | {:error, :terminated}

start_link(opt)

struct_from_pid(pid)

@spec struct_from_pid(pid()) :: t()

struct_from_pid_and_ref(pid, reference)