This repository has no description

fix(liveness): use lastSeenAt as authoritative offline signal, 5m threshold master

The previous check flipped to 'offline' after 15s of no local segments. Way too aggressive — a brief stall would send the user to the offline page. The 15s was also tied to the local segment, which isn't the right signal: navigating away and back resets the local segment even if the streamer's been gone for hours. Two changes: 1. Bump OFFLINE_AFTER_SECONDS from 15 to 300 (5m). 5 minutes gives transient stalls a chance to recover without falsely flipping. 2. Tie the offline check to livestream.record.lastSeenAt instead of the local segment. The director (server) updates lastSeenAt every ~30s whenever it ingests a segment, so this is the server's view of 'when did we last see a segment from this streamer'. A 5-minute gap is the authoritative offline signal. 3. Add a hard offline trigger for livestream.record.endedAt — if the streamer explicitly ended, immediately go offline regardless of timestamps. The check needed a re-render driver to actually progress over time when no segments are arriving, so the hook now runs a 1s tick while a livestream is being tracked. Stale threshold unchanged at 10s (per request). Stale is still based on local segment age — that's about in-flight playback quality, which is a different concern from 'is the stream over'.


+42 -2
1 changed file