How I measured playback drift in StreamSync
When I built StreamSync for my full-stack internship at Internmo, I needed a way to tell whether people in the same watch room were actually watching the same moment. Give the room one clock StreamSync keeps
When I built StreamSync for my full-stack internship at Internmo, I needed a way to tell whether people in the same watch room were actually watching the same moment.
Give the room one clock
StreamSync keeps the roomβs playback state on the server and shares it over Socket.IO. A viewer estimates its clock offset, calculates where the playhead should be now, and compares that with its local video position.
I used three levels of correction. If the difference was small, I left playback alone. If it was moderate, I used a gentler correction. For a larger gap, the viewer sought directly to the expected position. The goal was to keep people in sync without making the video visibly jump every time a small difference appeared.
Measure drift separately from message delivery
I ran two Chrome clients, one host and one viewer, for 60 seconds. I measured the absolute gap between the viewerβs local playhead and the position the room clock predicted. The median absolute drift was 117 ms in that run.
That number describes this two-browser test. For another pass, Iβd introduce different delays for each viewer and report both the median and p95, along with how long it takes to get back in sync after reconnecting. That would show how the design behaves when the connection is less predictable.
Message delivery time and playhead drift measure different things. A fast message can still leave a viewer out of sync if it arrives with a stale position.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.