Urgent.News

What's breaking now, across hundreds of outlets.

Tech

How Group Jam keeps everyone in sync without streaming a single byte of audio

Group Jam lets a few friends listen to the same song at the same moment, each on their own phone or desktop. A common first question is "so you stream the audio through your servers?" No. The room server never touches audio. It relays a handful of small JSON frames, and every device fetches and plays its own copy of the track. That leaves a fun problem. How do you keep several independent…

Group Jam allows friends to listen to the same song simultaneously on their phones or desktops. Strangely, nobody questions whether the audio is streamed through the servers. The room server remains silent, relaying a few JSON frames that each device fetches and plays its own copy of the track. The challenge then arises: how to keep several independent players on various networks, with slightly incorrect clocks, in sync.

The solution involves a shared clock, a playback anchor published by the host, and guests that adjust their speed slightly rather than constantly jumping around. This approach is outlined in the core/jam/ component of the app, along with the room server in jam-server.

Clocks can be unreliable, so the first step is to estimate how far each device's clock is from the room server's clock. Similar to NTP, every guest sends a ping with its local time, and the server responds with its own time and the answer's arrival time. By calculating the offset, the server determines the clock's deviation from the true time.

JamClock keeps track of the last 16 samples, selecting the one with the smallest round trip time as the most accurate offset estimate. Samples older than 15 minutes are discarded to prevent outdated estimates from persisting.

Once everyone shares a clock, playback can be described using a simple tuple. The host publishes a JamAnchor, indicating the track, its position in the queue, the position at server time, and the playback rate. Anyone can determine the current room position using this information. Importantly, the anchor stays valid until any change occurs, with the host updating it when the track, play state, player state, or next song's sources change.

Coalescing requests with a minimum gap of 250ms between anchors prevents a flood of quick skips from overwhelming the room.

A buffering host sends an anchor with advancing set to false, signaling that the room is paused. Guests then wait for the next anchor instead of moving ahead of the player that isn't progressing. This flag distinguishes between a paused room and a room waiting for the network, requiring only one boolean.

Every guest runs a small sync loop, checking the room's position using positionAt with the shared clock and comparing it to the position of its own player. The difference in position is the drift, and JamDriftCorrector decides how to address it. If there's nothing to follow, like a paused room or a buffering host, the loop sleeps until the room or local player changes, with a 30-second safety recheck.

Three outcomes are possible: none (drift within a 120ms dead band), nudge (adjust playback rate to catch up), or seek (persistent drift exceeding 1.5 seconds).

Rewritten by urgent.news; may contain errors — check the original. How we use AI.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

We track opens and clicks to improve the newsletter.

See today's edition · More options

More in Tech

Part 4: Alias or Index Pattern? Index Design for Two-Way Elasticsearch Replication

In a two-stream design, the index name is the replication contract. Here is how we chose between aliases and index patterns, whether the site suffix can be automated, and how to make an app that…

  • Two-stream design uses index name suffix for replication contract
  • Index name site yyyymm determines lead cluster and auto-follow pattern
  • Aliases simplify writes but require one-to-one mapping and verification

Schema Markup That Still Matters in 2026

The schema markup that still matters in 2026 is the markup that describes your entity and your page accurately: Organization or LocalBusiness on the business itself, WebSite and WebPage for structure…

  • Schema markup remains relevant in 2026 for accurate entity and page description.
  • Google emphasizes structured data doesn't guarantee rich results or better rankings.

Your PLC Doesn't Care About Your Event Loop

Four lessons from putting asyncio on the factory floor At some point, almost every automation team picks up Python. It rarely starts as a big decision.

  • Round-trips to PLCs are costly; batch requests to reduce latency.
  • Async ADS clients can block event loops if decoding large responses improperly.
  • Separate protocol (ADS) from transport (TCP/MQTT) for easier network changes.

Web Audio Cues & Ghost Previews in a Connect 4 Game

I built this tutorial around a single-file GridDrop Connect 4 browser game prompt so you can go from an empty editor to a working tabletop match without setting up bundlers, frameworks, or external…

  • Connect 4 browser game built in single index.html file
  • Features audio cues, AI modes, and accessibility
  • Deployable on GitHub Pages, Netlify, or Vercel

More from Sunday, 6 December 2026 →