A real-time collaborative video streaming platform where users can watch videos together in synchronized rooms. Users can create rooms, invite friends, and enjoy synchronized video playback with real-time chat and interaction.
- Create and join streaming rooms
- Real-time video synchronization across all users in a room
- Play/pause synchronization
- Seek position synchronization
- Progress tracking
- YouTube video support
- User authentication and authorization
- Profile management
- Friend system with friend requests
- User search functionality
- Online/offline status tracking
- Create new streaming rooms
- Join existing rooms
- Leave rooms
- Room information display
- Viewer count tracking
- Room duration tracking
- React with TypeScript
- Socket.IO Client for real-time communication
- React Player for video playback
- Context API for state management
- Tailwind CSS for styling
- Modern UI components with animations
- Node.js with Express
- Socket.IO for real-time communication
- MongoDB with Mongoose
- TypeScript
- Nodemon for development
- Split server architecture (HTTP and Socket)
- Node.js (v14 or higher)
- MongoDB
- npm or yarn
- Clone the repository
git clone <repository-url>
cd streaming-room- Install dependencies
# Install all dependencies (frontend, backend, and root)
npm run install:all- Environment Setup
Create
.envfiles in both server and ui directories:
Server (.env):
PORT=9998
MONGODB_URI=your_mongodb_uri
UI (.env):
REACT_APP_API_URL=http://localhost:9998
- Start the application
# Start all servers with a single command
npm start
# Or for development mode with hot reloading
npm run devThe above command will start:
- HTTP Server (port 9998)
- Socket Server (port 9998)
- Frontend Development Server (port 3000)
streaming-room/
├── server/
│ ├── src/
│ │ ├── db/ # Database models and operations
│ │ │ ├── users.ts # User management
│ │ │ └── rooms.ts # Room management
│ │ ├── socket/ # Socket.IO server implementation
│ │ ├── http/ # HTTP server implementation
│ │ └── routes/ # API routes
│ └── package.json
└── ui/
├── src/
│ ├── components/ # Reusable components
│ │ ├── NavBar.tsx
│ │ └── StreamingRoomListItem.tsx
│ ├── contexts/ # React contexts
│ │ └── Auth.tsx
│ ├── pages/ # Page components
│ │ ├── Home.tsx
│ │ ├── Profile.tsx
│ │ └── StreamingRoom.tsx
│ └── api/ # API integration
└── package.json
joinRoom: Join a streaming roomsocket.emit("joinRoom", roomId: string, email: string)
leaveRoom: Leave a streaming roomsocket.emit("leaveRoom", roomId: string, email: string)
play: Start video playbacksocket.emit("play", roomId: string, email: string)
pause: Pause video playbacksocket.emit("pause", roomId: string, email: string)
seek: Seek to a specific timesocket.emit("seek", roomId: string, email: string, time: number)
onProgress: Update video progresssocket.emit("onProgress", roomId: string, email: string, time: number)
play: Trigger video playbackpause: Trigger video pauseseek: Update video positiononProgress: Sync video progress
- User registration
- User login
- Session management
- Protected routes
- View and edit profile information
- Update YouTube URL
- Profile picture support
- Online status indicator
- Send friend requests
- Accept/reject friend requests
- View friends list
- Search for users
- Friend status indicators
The backend is split into two servers:
- HTTP Server: Handles REST API requests
- User authentication
- Profile management
- Friend system
- Room management
- Socket Server: Manages real-time video synchronization
- Video playback control
- Progress synchronization
- Room state management
Both servers need to be running simultaneously for the application to work properly.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.