Summary

Functions

Returns a specification to start this module under a supervisor.

Closes the PipeTransport.

Tells whether the given PipeTransport 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 Rust process if the transport is a DirectTransport. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-consumedata

Dump internal stat for PipeTransport.

PipeTransport 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

Local SRTP parameters representing the crypto suite and key material used to encrypt sending RTP and SRTP. Those parameters must be given to the paired pipeTransport in the connect() method. https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-srtpParameters

The transport tuple. It refers to both RTP and RTCP since pipe transports use RTCP-mux by design. https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-tuple

Types

connect_option()

@type connect_option() :: %{
  :ip => String.t(),
  :port => integer(),
  optional(:srtpParameters) => srtp_parameters_t() | nil
}

event_type()

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

https://mediasoup.org/documentation/v3/mediasoup/api/#TransportTuple

sctp_parameters_t()

@type sctp_parameters_t() :: map()

https://mediasoup.org/documentation/v3/mediasoup/sctp-parameters/#SctpParameters

srtp_parameters_t()

@type srtp_parameters_t() :: map()

https://mediasoup.org/documentation/v3/mediasoup/srtp-parameters/#SrtpParameters

t()

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

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

Closes the PipeTransport.

closed?(pipe_transport)

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

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

connect(pipe_transport, option)

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

Provides the pipe RTP transport with the remote parameters. https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-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 Rust process if the transport is a DirectTransport. https://mediasoup.org/documentation/v3/mediasoup/api/#transport-consumedata

dump(pipe_transport)

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

Dump internal stat for PipeTransport.

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

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

Starts observing event.

get_stats(pipe_transport)

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

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

id(pipe_transport)

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

PipeTransport 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

sctp_parameters(pipe_transport)

@spec sctp_parameters(t()) :: sctp_parameters_t() | {:error, :terminated}

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

sctp_state(pipe_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/#pipeTransport-sctpState

srtp_parameters(pipe_transport)

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

Local SRTP parameters representing the crypto suite and key material used to encrypt sending RTP and SRTP. Those parameters must be given to the paired pipeTransport in the connect() method. https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-srtpParameters

start_link(opt)

struct_from_pid(pid)

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

struct_from_pid_and_ref(pid, reference)

tuple(pipe_transport)

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

The transport tuple. It refers to both RTP and RTCP since pipe transports use RTCP-mux by design. https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-tuple