Peer-to-peer group video calls
Listen to the same Spotify queue
Share link to join, no signups needed!
How it works
Video chat
The server has a list of all connected peers, that every peer has access to. When this list changes, the newly added peer will try to call all peers on the list using PeerJS.
Spotify Playback Sync
The main server keeps a queue of songs for every room that exists. When a new song is added to the queue, all peers in the room will receive the new song.
If a user has authenticated their Spotify, the web app will automatically sync the queue with their Spotify account. It does so by creating a playlist in their Spotify account ("SAUF.chat – Queue") and adding all songs in the queue to it. If tracks get added to the queue, the web app will automatically add them to the playlist.
The server then keeps track of when the playback was started and how long each song in the list is. That way, we don’t rely on play/pause events being passed to the respective clients for timing the playback correctly, but by having a deterministic playback structure.
By knowing the length of the songs and when the playlist was started, we can calculate where to skip to, should you join later. Actually playing the next song is done by Spotify tho, because we simply let it play the playlist.