Summary

Functions

Returns a specification to start this module under a supervisor.

Closes the PlainTransport.

Tells whether the given PlainTransport 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

PlainTransport 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

Local SRTP parameters representing the crypto suite and key material used to encrypt sending RTP and SRTP. Note that, if comedia mode is set, these local SRTP parameters may change after calling connect() with the remote SRTP parameters (to override the local SRTP crypto suite with the one given in connect(). https://mediasoup.org/documentation/v3/mediasoup/api/#plainTransport-srtpParameters

The transport tuple. If RTCP-mux is enabled (rtcpMux is set), this tuple refers to both RTP and RTCP. https://mediasoup.org/documentation/v3/mediasoup/api/#plainTransport-tuple

Types

connect_option()

@type connect_option() :: map()

create_option()

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

event_type()

@type event_type() :: :on_close | :on_tuple | :on_sctp_state_change

t()

@type t() :: %Mediasoup.PlainTransport{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(plain_transport)

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

Closes the PlainTransport.

closed?(plain_transport)

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

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

connect(plain_transport, option)

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

Provides the plain transport with the endpoint parameters. https://mediasoup.org/documentation/v3/mediasoup/api/#plainTransport-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

event(transport, listener, event_types \\ [:on_close, :on_tuple, :on_sctp_state_change])

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

Starts observing event.

get_stats(plain_transport)

@spec get_stats(t()) :: [transport_stat()] | {:error, :terminated}

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

id(plain_transport)

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

PlainTransport 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

sctp_parameters(plain_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/#plainTransport-sctpParameters

sctp_state(plain_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/#plainTransport-sctpState

srtp_parameters(plain_transport)

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

Local SRTP parameters representing the crypto suite and key material used to encrypt sending RTP and SRTP. Note that, if comedia mode is set, these local SRTP parameters may change after calling connect() with the remote SRTP parameters (to override the local SRTP crypto suite with the one given in connect(). https://mediasoup.org/documentation/v3/mediasoup/api/#plainTransport-srtpParameters

start_link(opt)

struct_from_pid(pid)

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

struct_from_pid_and_ref(pid, reference)

tuple(plain_transport)

@spec tuple(t()) :: TransportTuple.t() | {:error, :terminated}

The transport tuple. If RTCP-mux is enabled (rtcpMux is set), this tuple refers to both RTP and RTCP. https://mediasoup.org/documentation/v3/mediasoup/api/#plainTransport-tuple