> For the complete documentation index, see [llms.txt](https://docs.rainmad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainmad.com/resources/watch-admin-menu/features/auto-replay-and-live-view.md).

# Auto replay and live view

Two ways to see a player's own screen from the web panel:

* **Auto replay:** a short clip of a player's screen when they die, get hurt by another player or file a ticket, or whenever staff ask for one. Clips are on the **Auto replay** page.
* **Live view:** watch one or more players' screens live on the **Live view** page.

Both are **off by default** and both need `rm_watch_key`.

## Tell your players first

When either one is on, every player gets a notice in chat that the server records short clips of their screen and that staff may watch it live.

* `cfg.replay.notice = 'first'` shows it on a player's first join, `'every'` on every join.
* `cfg.replay.noticeText` replaces the default text.

Say it in your server rules as well. Depending on where you and your players live, recording a screen may need more than a notice; that part is yours to check.

## Auto replay

```lua
cfg.replay = {
    enabled = false,
    onDeath = true,      -- a clip when a player dies
    onCombat = true,     -- when another player hurts them
    onReport = true,     -- the reporter's screen when they file a ticket
    pre = 15,            -- seconds before the moment (5 to 30)
    post = 5,            -- seconds after it (2 to 15)
    height = 540,        -- 360, 480, 540 or 720
    fps = 15,            -- 10 to 30
    kbps = 1200,         -- 400 to 4000
    codecs = { 'vp8', 'vp9' },
    cooldown = 60,       -- seconds before the same player triggers another automatic clip
    perHour = 120,       -- automatic clips the whole server may send in an hour
    notice = 'first',
    noticeText = '',
}
```

Each player's game keeps the last few seconds of its own screen. When something happens, the clip holds the seconds **before** it as well as after, and goes from the player's game straight to fivemad.com. It never passes through your game server.

* **Save a clip** on a player's card, or **Record** on the Auto replay page, asks for one by hand.
* Filter the page by what happened (Death, Combat, Manual, Report) and by player. A red mark shows the moment on the timeline, and **Jump to the moment** starts two seconds before it.
* **Keep** a clip that matters: kept clips are never deleted to make room.
* A player whose game cannot record video sends one screenshot instead (needs `screenshot-basic`), marked "still only".

| Limit                   | Default                                               |
| ----------------------- | ----------------------------------------------------- |
| One clip                | 16 MB (a 20 second clip at the defaults is 2 to 3 MB) |
| All clips of one server | 2 GB; the oldest clips nobody kept make room          |
| Kept for                | 14 days, unless kept                                  |
| Clips a day             | 500 per server                                        |

### What it costs players

While it is on, every player's PC records all the time. The **Cost on players** card shows what their games report: the time to encode one frame and the frame rate they reach. At the defaults a desktop CPU measured about 1 ms a frame; a slow laptop will be several times that. If players complain, lower `height` or `fps` first. **Measure it on your own players before you leave it on.**

## Live view

```lua
cfg.liveview = {
    enabled = false,
    maxStreams = 6,        -- players watched at the same time
    maxViewers = 2,        -- staff watching one player at once
    maxKbps = 2500,        -- the most one stream sends (300 to 6000)
    maxHeight = 720,       -- 360 to 1080
    maxFps = 30,           -- 10 to 60
    framesFallback = true, -- still frames when the video cannot connect
    iceServers = {},       -- your own STUN or TURN servers, optional
}
```

* **Watch live** on a player's card, or **Watch** in the Live view list. Up to nine tiles at once. The list filters by All, Admins and High ping.
* Each tile has its own quality (Auto, High 720p, Medium 540p, Low 360p) and a close button. **Auto** shares the bandwidth between the open tiles and steps a tile down when it falls behind; the tile says why.
* Every live view is in the staff log with who watched whom and for how long. Staff protection applies: nobody watches staff of their own rank or above.
* The video goes from the player's game to your browser. Each viewer is a separate upload from that player, which is what `maxViewers` and `maxKbps` protect.

### Players on strict networks

Some players (some mobile, office and carrier networks) cannot send video straight to a browser. Their tile falls back to **still frames**, one a second, and says so. A relay (TURN) server fixes that: add yours to `iceServers`:

```lua
iceServers = {
    { urls = 'turn:turn.example.com:3478', username = 'user', credential = 'secret' },
},
```

## Sound

There is **no sound** in live view or in clips. A FiveM page can read the game's picture but not its sound, and voice chat runs outside the page.

## Permissions

| Action                            | Default   | Category  |
| --------------------------------- | --------- | --------- |
| `replay:view`                     | moderator | Replays   |
| `replay:clip`                     | moderator | Replays   |
| `replay:delete` (keep and delete) | admin     | Replays   |
| `live:start`                      | admin     | Live view |

{% hint style="warning" %}
**Known issues:** with DLSS, FSR or frame generation on, the picture can come out black or include the game's menus. If a player's clips look wrong, ask them to try once with it off. These two features are new: try them on your own server before you rely on them.
{% endhint %}

{% hint style="danger" %}
**RedM:** auto replay and live view do **not** work on RedM today. RedM does not give a page the game's picture, so clients report that they cannot record and nothing is made. It will work once RedM adds it, with no change on your side.
{% endhint %}
