# `Direct.Caps`
[🔗](https://github.com/alexdont/direct_stream/blob/v0.1.0/lib/direct/caps.ex#L1)

What a browser decodes, as it reported on connecting: a map with `:hevc`,
`:av1`, `:vp9` (and whatever else you carry, such as `:uhd` for 4K). The
page can learn these with `MediaSource.isTypeSupported` /
`canPlayType` and send them as connect params:

    {hevc: v.canPlayType('video/mp4; codecs="hvc1.1.6.L120.B0"') !== "",
     av1: MediaSource.isTypeSupported('video/mp4; codecs="av01.0.08M.08"'),
     vp9: MediaSource.isTypeSupported('video/mp4; codecs="vp09.00.10.08"')}

# `decodable?`

```elixir
@spec decodable?(String.t() | nil, map()) :: boolean()
```

Whether a codec, as a release name or ffprobe says it (`"hevc"`, `"x265"`,
`"av1"`, …), is one the browser with `caps` decodes itself. H.264 is,
everywhere.

# `from_params`

```elixir
@spec from_params(map(), keyword()) :: map()
```

The browser's abilities from string-keyed params (`%{"hevc" => true}`) as
a map of atoms; anything missing is "no". `:keys` adds names beyond
`hevc av1 vp9 uhd local`.

---

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