# `PhoenixReplay.Web.Live.Frame`
[🔗](https://github.com/elixir-vibe/phoenix_replay/blob/v0.6.2/lib/phoenix_replay/web/live/frame.ex#L1)

Re-renders a recorded view with its recorded assigns.

Loaded in an iframe by the player and driven through
`PhoenixReplay.Web.Player.Channel`. Recorded assigns are assigned directly, so
the recorded template renders unchanged. Frame state lives in
`socket.private`, except for the single `:phoenix_replay_frame` assign that
the layout and the fallback template need.

A view whose live render depends on code in the browser can define
`replay_render/1`, which the frame calls in place of `render/1`, and the
view renders in the layout the recording kept; see
`PhoenixReplay.Web.Rendering.render/3`.

Opened with `stage=1`, as `PhoenixReplay.Web.Export.Stage` opens it, the
frame pushes a `"phx_replay:shown"` event with the index after each
render, so the export takes its screenshot once the page shows it.

Form control values the browser recorded are pushed to the frame's
script with a `"phx_replay:inputs"` event after each render, which puts
them back into the replayed page; see `PhoenixReplay.Recording.State`.
So is the root layout rendered again with the replayed assigns, with
`"phx_replay:root"`, whose `<html>` and `<body>` attributes the script
copies, as the page's root layout renders only once.

LiveComponents in the template render through
`PhoenixReplay.Web.Live.ReplayComponent` with their recorded assigns; see
`PhoenixReplay.Web.Rendering`. A template that fails with the recorded
assigns shows a placeholder instead of crashing the frame.

A session that is still running is never read from the buffer here: the
player redacts it and hands it over with `PhoenixReplay.Web.Player.Channel.load/2`.
Until then the frame shows a placeholder.

---

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