# `Laev.NowPlaying`
[🔗](https://github.com/alexdont/laev/blob/main/lib/laev/now_playing.ex#L1)

Whether mpv is still playing something laev started, and what.

mpv is launched detached, so laev can leave its Now Playing page — esc goes
back to the menu and the film keeps running. That is the whole point, but it
used to be one-way: nothing led back, and the page holds the things you want
mid-film (rate it, switch source, queue the next episode).

A launch records what it started; liveness is read back from the tracker's
own heartbeat. The mpv script rewrites `played/<key>` every 5 seconds for as
long as the player is up — pause included, since a paused mpv still reports
a position — so a recent write means mpv is alive, and nothing to write
means it is gone. That file is deliberately the signal rather than the
position file: positions are synced, and a sync pull rewrites all of them at
once, which would make every title look like it just played.

# `clear`

Forget it — the player is gone, or the user quit laev with it.

# `current`

What mpv is playing right now as `{ctx, stream}`, or nil when nothing is.

The stream half can be all nils for a play recorded before this existed;
the page copes, because everything but "replay" works from the context.

# `mark`

Record what was just launched. Best-effort: never breaks playback.

---

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