Skip to content

timer

A countdown timer that reads a Unix-millisecond deadline from screen.data and renders the remaining duration. Re-renders once per second while mounted.

The deadline is interpreted against the relay’s wall clock — not the phone’s — so countdowns stay consistent across players whose device clocks may be off. The SDK learns the offset from heartbeat ping timestamps.

C# factory

WidgetDefinitions.Timer(
id: "countdown",
positionX: 0.5f, positionY: 0.2f,
sizeW: 0.4f, sizeH: 0.1f,
endsAtKey: "round_ends_at",
format: "mm:ss",
label: "Time left: {value}",
style: "title"
);
// Then push the deadline:
manager.UpdateScreenDataForAll("round", new
{
round_ends_at = DateTimeOffset.UtcNow.AddSeconds(60).ToUnixTimeMilliseconds()
});

Wire format

FieldTypeRequiredNotes
idstringyes
type"timer"yes
position_x, position_y, size_w, size_hnumberno0..1 anchor + size.
ends_at_keystringnoData key holding a unix-ms deadline. Default ends_at.
format"mm:ss" | "seconds"noRender format. Default "mm:ss".
labelstringnoWrapping template. Use {value} for the formatted duration.
style"title" | "subtitle" | "body"noTypographic preset.
align"left" | "center" | "right"no
colorstringno7-digit hex.

Events

Display only.

Example

// Start a 30-second round — every connected phone counts down in sync.
manager.ShowScreenToAll("round", new
{
round_ends_at = DateTimeOffset.UtcNow.AddSeconds(30).ToUnixTimeMilliseconds()
});