Root cause of the periodic drops (found via the new logs): mpv was
exiting cleanly (err=nil, exit 0) with its status line at 100% — i.e.
end-of-stream. UniFi Protect closes some cameras' RTSP connections every
20-40s; with --keep-open=no --idle=no mpv treated that as the file
ending, exited, and the supervisor relaunched it ~3s later (the visible
drop).
- Add --loop-file=inf so mpv reopens the stream the instant it EOFs,
in the same process and window: sub-second recovery, no teardown,
no supervisor bounce. The supervisor now only fires for real crashes.
- Clean up the logged exit "reason": strip ANSI escapes and skip mpv's
transient A/V status prints, so a genuine error surfaces instead of
"\x1b[KV: 00:00:35 / 00:00:35 (100%)". Tests cover the parsing.
Also fold in the for_window IPC fix: sway's IPC parser splits comma-
joined command lists at the top level and does not fold the continuation
into for_window (unlike the config-file parser), so the map-time
placement rules errored with "Only views can have borders" and never
installed. Register each command separately; drop the redundant
border none (the kiosk config already sets default_border none).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>