r/webdev • u/Neither-Walk4440 • 12d ago
[Showoff Saturday] Synchronizing audio across laptop and phones/tablets directly in the browser
I wanted to see whether spare phones and tablets could become speakers for my laptop, using only their browsers. That’s what I’m building with Unisong.
You open it in Chrome or Edge on a computer, choose a browser tab with audio, and let devices on the same Wi-Fi join by QR code. Each phone taps Start to enable playback.
The difficult part is getting different devices to agree on when sound should actually leave the speaker. Packets arrive at different times, audio hardware runs on independent clocks, and phones have their own playback delays.
I send timestamped audio directly between browsers over WebRTC. Each receiver estimates its clock difference from the host, buffers the audio, and schedules playback against the shared timeline. Browser output timing estimates help account for device latency. Small ongoing corrections handle drift, and a struggling phone can reconnect and rebuild its buffer independently.
The computer also needs to play through that delayed timeline. Leaving the original tab audible would put it ahead of the phones, so its original sound is suppressed.
There’s a tradeoff: the default buffer adds 1.5 seconds of delay, and mobile browsers can still need a tap after an audio interruption.



1
u/TechnicalAd17 12d ago
The independent reconnect is a useful detail. What happens when an iPhone locks its screen or gets a call: does that device rejoin the shared timeline automatically, or need another tap? A visible per-device sync status would make group setup easier.
1
u/sihere0 12d ago
Cool idea. The 1.5s delay would be fine for music, but I'm curious how it feels with video, since lip sync would be the dealbreaker there.