# `PhoenixReplay.Export.Options`
[🔗](https://github.com/elixir-vibe/phoenix_replay/blob/v0.6.2/lib/phoenix_replay/export/options.ex#L1)

What a video export shows and how it is encoded, as the player's export
dialog and `mix phoenix_replay.export` choose it.

  * `:from` and `:to` — the range of the recording, in milliseconds;
    `nil` for its start or end
  * `:skip_idle` — shorten stretches without activity to the `:idle`
    configured
  * `:pointer` — draw the pointer; the page scrolls as recorded either way
  * `:size` — `:recorded`, the recorded pixel ratio up to `:max_dpr`;
    `:one`, one pixel per CSS pixel; or `:half`, half of that
  * `:fps` — frames per second: 15, 30 or 60
  * `:quality` — `:small`, `:balanced` or `:best`; `:balanced` is the
    configured `:crf`, and the others trade it for size or detail

The defaults follow the `:export` configuration.

# `quality`

```elixir
@type quality() :: :small | :balanced | :best
```

# `size`

```elixir
@type size() :: :recorded | :one | :half
```

# `t`

```elixir
@type t() :: %PhoenixReplay.Export.Options{
  fps: pos_integer(),
  from: non_neg_integer() | nil,
  pointer: boolean(),
  quality: quality(),
  size: size(),
  skip_idle: boolean(),
  to: non_neg_integer() | nil
}
```

# `apply`

```elixir
@spec apply(t(), PhoenixReplay.Config.export()) :: map()
```

The `:export` configuration the options make: the frame rate, the idle
time, the pixel ratio, the quality and a `:scale` for the encoder.

# `frame_rates`

```elixir
@spec frame_rates() :: [pos_integer()]
```

The frame rates offered.

# `from_map`

```elixir
@spec from_map(%{required(String.t()) =&gt; term()}) :: t()
```

Reads options written by `to_map/1`.

# `new`

```elixir
@spec new(PhoenixReplay.Config.export()) :: t()
```

The defaults the `:export` configuration sets.

# `parse`

```elixir
@spec parse(map(), PhoenixReplay.Config.export()) :: {:ok, t()} | {:error, String.t()}
```

Reads options from string params, as a form or command-line flags send
them, onto the defaults: `"from"` and `"to"` in seconds, `"skip_idle"`,
and `"pointer"` as `"true"` or `"false"`, `"size"` as
`"recorded"`, `"1x"` or `"half"`, `"fps"`, and `"quality"` as `"small"`,
`"balanced"` or `"best"`. Missing params keep the defaults.

# `to_map`

```elixir
@spec to_map(t()) :: %{required(String.t()) =&gt; term()}
```

The options as a map of strings and numbers, for a job queue that stores
them as JSON, such as `PhoenixReplay.Export.Queue.Oban`; `from_map/1`
reads it back.

---

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