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

A recorded LiveView session.

Holds the session metadata and an ordered list of `PhoenixReplay.Recording.Event`s.
Use `PhoenixReplay.Recording.Timeline` to reconstruct state at a point in time.

`dropped` counts collected events left out once a collector reached its
`:limit`, keyed by collector name, such as `"my_app.repo.query"` or `"log"`.

`client` describes the browser and the visit; see
`PhoenixReplay.Recording.Client`.

`layout` is the layout the view rendered in live, as module and template
names: the one `mount/3` or an `on_mount` hook returned with `layout:`,
else the one its `use Phoenix.LiveView, layout: ...` names, or `false`
for none. It is `nil` in recordings made before it was kept, which
replay in the layout the view names today.

# `id`

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

# `layout`

```elixir
@type layout() :: {String.t(), String.t()} | false
```

A layout by module and template name, such as `{"MyAppWeb.Layouts", "app"}`, or `false` for none.

# `t`

```elixir
@type t() :: %PhoenixReplay.Recording{
  client: PhoenixReplay.Recording.Client.t(),
  code: PhoenixReplay.Recording.Code.t() | nil,
  connected_at: integer(),
  dropped: %{required(String.t()) =&gt; pos_integer()},
  events: [PhoenixReplay.Recording.Event.t()],
  id: id(),
  layout: layout() | nil,
  params: map(),
  session: map(),
  url: String.t() | nil,
  view: module()
}
```

# `viewport`

```elixir
@type viewport() :: %{
  :width =&gt; pos_integer(),
  :height =&gt; pos_integer(),
  :dpr =&gt; number(),
  optional(:angle) =&gt; 0 | 90 | 180 | 270,
  optional(:color_scheme) =&gt; :light | :dark,
  optional(:reduced_motion) =&gt; boolean(),
  optional(:contrast) =&gt; :more | :less | :no_preference,
  optional(:pointer) =&gt; :coarse | :fine | :none,
  optional(:hover) =&gt; :hover | :none
}
```

The browser's viewport: its size in CSS pixels and pixel ratio, and when
the browser reports them, the screen's orientation angle and the media
settings the page's CSS could see: the color scheme, reduced motion,
contrast and the kind of pointer.

# `generate_id`

```elixir
@spec generate_id() :: id()
```

Generates a URL-safe random recording id.

# `upgrade`

```elixir
@spec upgrade(t()) :: t()
```

Brings a recording stored by an earlier version up to date.
`PhoenixReplay.Storage.Codec` calls it on every recording it decodes.

# `valid_id?`

```elixir
@spec valid_id?(term()) :: boolean()
```

Returns true when `id` has the shape produced by `generate_id/0`.

---

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