Summary

Functions

Returns a specification to start this module under a supervisor.

Closes the router.

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

Dump internal stat for Router.

Router identifier.

Types

@type create_option() :: Mediasoup.Router.Options.t() | map()
@type event_type() :: :on_close | :on_dead
@type media_codec() :: %{
  :kind => :audio | :video | String.t(),
  :mimeType => String.t(),
  :clockRate => integer(),
  :channels => integer(),
  :parameters => map(),
  :rtcpFeedback => [map()],
  optional(:payloadType) => integer(),
  optional(:preferredPayloadType) => integer()
}
@type rtpCapabilities() :: any()
@type t() :: %Mediasoup.Router{id: String.t(), pid: pid()}

Functions

Link to this function

can_consume?(router, producer_id, rtp_capabilities)

View Source
@spec can_consume?(t(), String.t(), rtpCapabilities()) :: boolean()

Whether the given RTP capabilities are valid to consume the given producer. https://mediasoup.org/documentation/v3/mediasoup/api/#router-canConsume

Returns a specification to start this module under a supervisor.

See Supervisor.

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

Closes the router.

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

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

Link to this function

create_pipe_transport(router, option)

View Source
@spec create_pipe_transport(
  t(),
  Mediasoup.PipeTransport.Options.t()
) :: {:ok, Mediasoup.PipeTransport.t()} | {:error, String.t()}

Creates a new pipe transport. https://mediasoup.org/documentation/v3/mediasoup/api/#router-createPipeTransport

Link to this function

create_plain_transport(router, option)

View Source
@spec create_plain_transport(t(), Mediasoup.PlainTransport.create_option()) ::
  {:ok, Mediasoup.PlainTransport.t()} | {:error, String.t()}

Creates a new webrtc transport. https://mediasoup.org/documentation/v3/mediasoup/api/#router-createPlainTransport

Link to this function

create_webrtc_transport(router, option)

View Source
@spec create_webrtc_transport(t(), Mediasoup.WebRtcTransport.create_option()) ::
  {:ok, Mediasoup.WebRtcTransport.t()} | {:error, String.t()}

Creates a new webrtc transport. https://mediasoup.org/documentation/v3/mediasoup/api/#router-createWebRtcTransport

@spec dump(t()) :: map() | {:error}

Dump internal stat for Router.

Link to this function

event(router, listener, event_types \\ [:on_close, :on_dead])

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

Starts observing event.

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

Router identifier.

Link to this function

pipe_data_producer_to_router(router, data_producer_id, option)

View Source
@spec pipe_data_producer_to_router(
  t(),
  data_producer_id :: String.t(),
  Mediasoup.Router.PipeToRouterOptions.t()
) :: {:ok, Mediasoup.Router.PipeToRouterResult.t()} | {:error, String.t()}

Pipes the given data producer into another router. https://mediasoup.org/documentation/v3/mediasoup/api/#router-pipeToRouter

Link to this function

pipe_producer_to_router(router, producer_id, option)

View Source
@spec pipe_producer_to_router(
  t(),
  producer_id :: String.t(),
  Mediasoup.Router.PipeToRouterOptions.t()
) ::
  {:ok, Mediasoup.Router.PipeToRouterResult.t()} | {:error, String.t()}

Pipes the given media producer into another router. https://mediasoup.org/documentation/v3/mediasoup/api/#router-pipeToRouter

Link to this function

rtp_capabilities(router)

View Source
@spec rtp_capabilities(t()) :: rtpCapabilities()

An Object with the RTP capabilities of the router. https://mediasoup.org/documentation/v3/mediasoup/api/#router-rtpCapabilities

@spec struct_from_pid(pid()) :: t()
Link to this function

struct_from_pid_and_ref(pid, reference)

View Source