The problem
The client needed to broadcast images, videos and playlists to several screens at once, with all of them showing exactly the same moment of the video.
There were two constraints: the system had to run inside the internal network, on the client's own servers, and the screens are ordinary Smart TVs, with unreliable clocks and a network that can drop.
The approach
- 01
A shared start instant
The server sends the instant the broadcast started, and each screen works out which point of the video it should be at. A TV that joins late or loses its connection jumps to that point on its own.
- 02
Estimating the server's time
The player uses the browser's monotonic clock and estimates the offset to the server from the lowest-latency sample, as NTP does. If the TV was in standby and its clock stalled, the new estimate replaces the old one immediately.
- 03
A native Android TV app
A small app with a native 4K video player that launches when the TV powers on and always talks to the server with certificate validation on.
- 04
Working offline
Content is copied to the TV before it goes on air, and the page keeps the last known schedule. If the server becomes unreachable, the screens keep playing.
- 05
Large files, sent in chunks
Videos up to 1.5 GB are uploaded in parts that can be retried individually, instead of a single request that restarts from zero if the connection drops.