70 lines
2.0 KiB
Markdown
70 lines
2.0 KiB
Markdown
# 🎬 VideoSync
|
|
|
|
Watch videos together in real-time. Each user loads a local video file — only sync commands and chat messages travel over the network.
|
|
|
|
## Features
|
|
|
|
- **Room system** — create a room, share the 6-character code with friends
|
|
- **File verification** — joiners must have the exact same file (matched by name + size)
|
|
- **Playback sync** — play, pause, seek, and speed changes broadcast to all clients instantly
|
|
- **Drift correction** — automatic re-sync every 5 seconds to keep everyone aligned
|
|
- **Live chat** — YouTube-style chat sidebar with colored usernames
|
|
- **Local playback** — multi-gigabyte files work fine since nothing is uploaded
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Install Bun (if not already installed)
|
|
curl -fsSL https://bun.sh/install | bash
|
|
|
|
# Start the server
|
|
bun run server.ts
|
|
```
|
|
|
|
Open **http://localhost:3000** in your browser.
|
|
|
|
## How It Works
|
|
|
|
1. Enter your name and select a video file → **Create Room**
|
|
2. Share the room code with a friend
|
|
3. Friend enters the code → **Join Room** → selects their copy of the same file
|
|
4. Play/pause/seek in either browser — the other stays in sync
|
|
|
|
## Deployment
|
|
|
|
```bash
|
|
# Run on a custom port
|
|
PORT=8080 bun run server.ts
|
|
```
|
|
|
|
For production, put behind **nginx** with WebSocket proxy support:
|
|
|
|
```nginx
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8080;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
```
|
|
|
|
## Tech Stack
|
|
|
|
| Component | Technology |
|
|
|-----------|-----------|
|
|
| Server | Bun (native HTTP + WebSocket) |
|
|
| Frontend | Vanilla HTML / CSS / JS |
|
|
| Dependencies | None |
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
├── server.ts # Bun WebSocket server
|
|
├── package.json
|
|
└── public/
|
|
├── index.html # Single-page app
|
|
├── style.css # Dark theme
|
|
└── app.js # Client sync + chat logic
|
|
```
|