# `ExSDP.Media`
[🔗](https://github.com/membraneframework/ex_sdp/blob/v1.2.0/lib/ex_sdp/media.ex#L1)

This module represents the Media field of SDP.

For more details please see [RFC4566 Section 5.14](https://tools.ietf.org/html/rfc4566#section-5.14)

# `t`

```elixir
@type t() :: %ExSDP.Media{
  attributes: [ExSDP.Attribute.t()],
  bandwidth: [ExSDP.Bandwidth.t()],
  connection_data: [ExSDP.ConnectionData.t()],
  encryption: ExSDP.Encryption.t() | nil,
  fmt: binary() | [0..127],
  port: :inet.port_number(),
  port_count: non_neg_integer(),
  protocol: binary(),
  title: binary() | nil,
  type: type()
}
```

# `type`

```elixir
@type type() :: :audio | :video | :text | :application | :message | binary()
```

Represents type of media. In [RFC4566](https://tools.ietf.org/html/rfc4566#section-5.14)
there are defined "audio", "video", "text", "application", and "message" types.

Known types are represented as atoms others are binaries.

# `add_attribute`

> This function is deprecated. Use ExSDP.add_attribute/2 instead.

```elixir
@spec add_attribute(t(), ExSDP.Attribute.t()) :: t()
```

# `add_attributes`

> This function is deprecated. Use ExSDP.add_attributes/2 instead.

```elixir
@spec add_attributes(t(), [ExSDP.Attribute.t()]) :: t()
```

# `apply_session`

```elixir
@spec apply_session(t(), ExSDP.t()) :: t()
```

# `get_attribute`

> This function is deprecated. Use ExSDP.get_attribute/2 instead.

```elixir
@spec get_attribute(t(), ExSDP.Attribute.key()) :: ExSDP.Attribute.t() | nil
```

# `get_attributes`

> This function is deprecated. Use ExSDP.get_attributes/2 instead.

```elixir
@spec get_attributes(t(), ExSDP.Attribute.key()) :: [ExSDP.Attribute.t()]
```

# `new`

```elixir
@spec new(type(), :inet.port_number(), binary(), binary() | 0..127 | [0..127], [
  {:port_count, non_neg_integer()}
]) :: t()
```

# `parse`

```elixir
@spec parse(binary()) ::
  {:ok, t()} | {:error, :invalid_media_spec | :malformed_port_number}
```

# `parse_optional`

```elixir
@spec parse_optional([binary()], t()) :: {:ok, {[binary()], t()}} | {:error, atom()}
```

---

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