# `Mediasoup.PlainTransport`
[🔗](https://github.com/oviceinc/mediasoup-elixir/blob/main/lib/plain_transport.ex#L1)

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

# `connect_option`

```elixir
@type connect_option() :: map()
```

# `create_option`

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

# `event_type`

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

# `t`

```elixir
@type t() :: %Mediasoup.PlainTransport{id: String.t(), pid: pid()}
```

# `transport_stat`

```elixir
@type transport_stat() :: map()
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `close`

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

  Closes the PlainTransport.

# `closed?`

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

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

# `connect`

```elixir
@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`

```elixir
@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`

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

Starts observing event.

# `get_stats`

```elixir
@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`

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

PlainTransport identifier.

# `produce`

```elixir
@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`

```elixir
@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`

```elixir
@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`

```elixir
@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`

# `struct_from_pid`

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

# `struct_from_pid_and_ref`

# `tuple`

```elixir
@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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
