# Replay: ended event

> The ended event of the Replay interface fires when playback reaches the last tick.

The **`ended`** event of the [`Replay`](/docs/client/replay) interface fires when playback reaches [`lastTick`](/docs/client/replay/lasttick), by [`play()`](/docs/client/replay/play) or [`step()`](/docs/client/replay/step).

## Syntax

```ts
addEventListener("ended", (event) => {})
```

## Event type

A generic `Event`.

## Description

Playback has stopped by the time the event fires, after the last tick's [`tick` event](/docs/client/replay/tick-event). A [`seek()`](/docs/client/replay/seek) to the last tick doesn't fire it.

## Examples

### Showing a replay button at the end

When a clip ends, the viewer offers to watch it again.

```ts
// watch-again.ts
import type { Replay } from "@irtio/client/replay";

export function offerRewatch(replay: Replay, button: HTMLButtonElement): void {
  button.hidden = true;
  button.addEventListener("click", () => {
    button.hidden = true;
    replay.seek(replay.firstTick);
    replay.play();
  });
  replay.addEventListener("ended", () => (button.hidden = false));
}
```

## See also

- [`Replay.lastTick`](/docs/client/replay/lasttick)
- [`tick` event](/docs/client/replay/tick-event)
