.dev

Modules1 min read

Highlight clips

Ask players with a replay buffer to save the moment that just happened.

clips:1Tier A · Decorate

Good for

  • Saving clutch plays and final kills automatically
  • Tournament highlights without anyone recording

Try it in game, no code

/tehoapi clip * Grand final

Your server knows when something great happens: a clutch, a final kill, a record run. Mark the moment, and every player who has the replay buffer turned on gets a clip saved, covering a few seconds before and after.

Mark a moment

Java
teho.clips().mark("final-kill-" + matchId, "Final kill on Lighthouse", 8000, 3000)
        .thenAccept(clip -> {
            if (clip.saved()) {
                stats.recordClip(teho.uniqueId(), clip.id());
            }
        });

The arguments are an id, a title, how much to keep before the moment (up to 60 seconds) and after it (up to 30 seconds). The future completes once the clip is written.

ClipsApi.ClipNotes
saved()Whether a clip was written.
id()Your id.
url()Where the clip ended up, when there is one.
error()Why not, for example when the player has the replay buffer off.

What the player gets

Players opt in to the replay buffer in Settings -> Servers. Clips are MJPEG .avi files in the game folder under teho-clips, named with a timestamp and your title. Players who have it off get nothing, and your future completes with saved() == false.

No code

Text
/tehoapi clip * Grand final