Replay: firstTick property
Available since
@irtio/client 5.0BrowsersNodeThe firstTick read-only property of the Replay interface is the first room tick the replay can show, the one loadReplay() shows it at.
Value
A number: a tick of the room that was recorded, so a replay of a room that had run for a while doesn’t start at 0. For a clip, it’s the tick of the clip’s first second.
Description
seek() clamps a tick before firstTick to it. The replay’s length in ticks is lastTick - firstTick, and in seconds that divided by the replay’s tickRate.
Examples
Showing a timestamp
A replay viewer shows how far into the replay the tick shown is, as minutes and seconds.
// timestamp.ts
import type { Replay } from "@irtio/client/replay";
export function timestamp(replay: Replay): string {
const seconds = Math.floor((replay.tick - replay.firstTick) / replay.tickRate);
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
}
See also
Runtime availability
| Browsers | Node | |
|---|---|---|
firstTick | 5.0 | 5.0 |