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

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

# `event_type`

```elixir
@type event_type() ::
  :on_close | :on_pause | :on_resume | :on_video_orientation_change | :on_score
```

# `mediaKind`

```elixir
@type mediaKind() :: String.t()
```

  audio or video

# `producerType`

```elixir
@type producerType() :: String.t()
```

https://mediasoup.org/documentation/v3/mediasoup/api/#ProducerType
  "simple" or "simulcast" or "svc"

# `rtpParameters`

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

# `t`

```elixir
@type t() :: %Mediasoup.Producer{
  id: String.t(),
  kind: mediaKind(),
  pid: pid(),
  rtp_parameters: rtpParameters(),
  type: producerType()
}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `close`

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

  Closes the producer. Triggers a "producerclose" event in all its associated consumers.
  https://mediasoup.org/documentation/v3/mediasoup/api/#producer-close

# `closed?`

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

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

# `dump`

```elixir
@spec dump(t()) :: map()
```

Dump internal stat for Producer.

# `event`

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

Starts observing event.

# `get_stats`

```elixir
@spec get_stats(t()) :: list() | {:error, reason :: term()}
```

Returns current RTC statistics of the producer.
Check the [RTC Statistics](https://mediasoup.org/documentation/v3/mediasoup/rtc-statistics/)
section for more details (TypeScript-oriented, but concepts apply here as well).

# `id`

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

Producer identifier.

# `kind`

```elixir
@spec kind(t()) :: mediaKind()
```

  The media kind

# `pause`

```elixir
@spec pause(t()) :: {:ok} | {:error}
```

Pauses the producer (no RTP is sent to its associated consumers). Triggers a "producerpause" event in all its associated consumers.
https://mediasoup.org/documentation/v3/mediasoup/api/#producer-pause

# `paused?`

```elixir
@spec paused?(t()) :: boolean() | {:error}
```

Whether the producer is paused.
https://mediasoup.org/documentation/v3/mediasoup/api/#producer-paused

# `resume`

```elixir
@spec resume(t()) :: {:ok} | {:error}
```

Resumes the producer (RTP is sent again to its associated consumers). Triggers a "producerresume" event in all its associated consumers.
https://mediasoup.org/documentation/v3/mediasoup/api/#producer-resume

# `rtp_parameters`

```elixir
@spec rtp_parameters(t()) :: rtpParameters()
```

  RtpParameters.
  https://mediasoup.org/documentation/v3/mediasoup/rtp-parameters-and-capabilities/#RtpParameters

# `score`

```elixir
@spec score(t()) :: list() | {:error}
```

The score of each RTP stream being received, representing their tranmission quality.
https://mediasoup.org/documentation/v3/mediasoup/api/#producer-score

# `start_link`

# `struct_from_pid`

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

# `struct_from_pid_and_ref`

# `type`

```elixir
@spec type(t()) :: producerType()
```

  Producer type.
  https://mediasoup.org/documentation/v3/mediasoup/api/#ProducerType

---

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