Skip to content

nandodeomkar/jiosync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

TubeSync

Chrome extension for synchronized YouTube playback. Watch together, miles apart.

How It Works

  • Host creates a room and gets a 6-character code
  • Guest joins with the code
  • Play/pause/seek events sync between both browsers via a relay server
  • Heartbeat every 5s keeps playback in sync (drift correction: hard seek >2s, soft nudge 0.3-2s)

Both users need to open the same YouTube video. The extension only syncs control signals, never video data.

Setup

Server

cd server
npm install
npm start

Deploy to Fly.io (Singapore region for India-Australia proximity):

cd server
fly launch --region sin
fly deploy

Set SIMULATE_LATENCY=200 env var to test with artificial delay.

Extension

  1. Update SERVER_URL in extension/background.js to your server URL
  2. Go to chrome://extensions
  3. Enable Developer mode
  4. Click Load unpacked → select the extension/ folder
  5. Pin the TubeSync extension

Usage

  1. Both users open the same video on YouTube
  2. User A clicks the extension → Create Room → shares the 6-char code
  3. User B clicks the extension → enters code → Join Room
  4. Play/pause/seek on either side syncs to the other

Architecture

Content Script ←→ Background (Service Worker) ←→ Socket.io Server ←→ Peer's Background ←→ Peer's Content Script
  • Content script: Hooks into the <video> element, sends/receives sync events
  • Background: Manages Socket.io connection, relays between content script and server
  • Server: Stateless room relay (in-memory, no database)

Sync Protocol

Event Description
PLAY Play triggered, includes currentTime
PAUSE Pause triggered, includes currentTime
SEEK Seek triggered, includes currentTime
BUFFER_START Host buffering — guest pauses
BUFFER_END Host recovered — guest resumes
HEARTBEAT Every 5s from host — guest corrects drift

All events include t_send timestamp for latency compensation.

Development

# Run server locally
cd server && npm start

# Update extension/background.js SERVER_URL to http://localhost:3000
# Load extension unpacked in chrome://extensions

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors