A real-time video conferencing application built with Mediasoup, Socket.IO, and WebRTC. This application supports multiple participants in a room with audio/video streaming, active speaker detection, dynamic media routing, and real-time chat functionality.
Screen.Recording.2025-06-03.at.1.1.mp4
- Live Chat: Real-time messaging during video conferences
- Role-based Permissions:
- Viewers can send and receive messages
- Streamers can view messages but cannot send (focus on streaming)
- Clean UI: Beautiful glassmorphism chat interface matching the app theme
- Message Management: Messages stored locally (not persisted on server)
- Minimizable Chat: Floating chat icon in bottom-left corner
- Auto-scroll: New messages automatically scroll into view
- User Names: Display actual participant names in chat
- Name-based Identity: Users enter their names when joining rooms
- Position Optimized: Chat positioned in bottom-left for better UX
- Real-time Sync: Instant message delivery via Socket.IO
- Message Counter: Unread message notifications when minimized
graph TD
%% Client Side
A[Client] -->|has| B[Socket.IO]
B -->|has| C[Device]
C -->|contains| D[Transports]
D -->|upstream| E[Producer Transport]
D -->|downstream| F[Consumer Transport]
%% New Chat Component
B -->|real-time| G[Chat System]
G -->|messages| H[Local State]
%% Server Side
I[Server] -->|has| J[Workers]
J -->|has| K[Routers]
K -->|contains| L[Transports]
L -->|upstream| M[Producer Transport]
L -->|downstream| N[Consumer Transport]
%% Chat Relay
I -->|relays| O[Chat Messages]
%% Media Flow
E -->|media| P[Media Router]
F -->|media| P
M -->|media| P
N -->|media| P
-
Mediasoup Workers
- Manages media processing and routing
- Handles WebRTC transport
- Supports multiple codecs (Opus for audio, H264/VP8 for video)
- Configurable ports and logging
-
Room Management
- Dynamic room creation and management
- Participant tracking
- Active speaker detection
- Media router per room
- Chat room isolation: Messages only sent to participants in same room
-
Participant Management
- User identification with custom names
- Transport management
- Producer/Consumer handling
- Socket connection management
- Role-based permissions: Streamer vs Viewer capabilities
-
Real-time Chat System π
- Socket.IO message relay
- Role-based messaging permissions
- Local message storage (not persisted)
- Real-time message synchronization
- Clean, minimizable UI interface
-
Media Handling
- Audio/Video streaming
- Active speaker detection
- Dynamic media routing
- Transport negotiation
// Supported Codecs
- Audio: Opus (48kHz, 2 channels)
- Video: H264 and VP8// WebRTC Transport Settings
- Max Incoming Bitrate: 5Mbps
- Initial Available Outgoing Bitrate: 5Mbps
- Port Range: 40000-41000-
Room Management
join: Join/create a roomdisconnect: Handle participant disconnectionhangUp: Graceful room exit
-
Transport Management
request-transport: Request new transportconnect-transport: Connect transport with DTLS parameters
-
Media Handling
produce: Start media productionconsume: Consume media from other participantsunpause: Resume media consumption
-
Speaker Management
updateSpeakers: Update active speaker listnewProducersToConsume: Notify about new media producers
-
Chat System π
chatMessage: Send/receive chat messages- Room-based message relay
- Real-time message broadcasting
- Install dependencies:
# Server
cd server
npm install
# Client
cd client
npm install-
Configure environment:
- Update
config.jswith your network settings - Set appropriate port ranges
- Configure media codecs if needed
- Update
-
Start the application:
# Start server (Terminal 1)
cd server
npm start
# Start client (Terminal 2)
cd client
npm run dev- Access the application:
- Open browser to
http://localhost:5173 - Enter your name and room name
- Choose "Join as Streamer" or "Join as Viewer"
- Open browser to
- Real-time video/audio streaming
- Dynamic room creation and management
- Active speaker detection
- Automatic media routing
- Multiple codec support
- Scalable worker architecture
- WebRTC transport optimization
- Real-time messaging during video calls
- Role-based permissions: Viewers can chat, streamers view-only
- Beautiful UI: Glassmorphism design matching app theme
- Smart positioning: Bottom-left placement for optimal UX
- Minimizable interface with message counters
- Auto-scroll for new messages
- Name-based identity in chat
- Clean, modern interface with gradient themes
- Responsive design for all screen sizes
- Smooth animations and transitions
- Intuitive controls and navigation
- Join room as "Streamer"
- View incoming chat messages from viewers
- Focus on streaming without chat distractions
- Join room as "Viewer"
- Send messages to engage with the stream
- See messages from other viewers in real-time
- Minimize/maximize chat as needed
- Messages display with sender name and timestamp
- 200 character limit per message
- Real-time delivery to all room participants
- Messages not saved on server (privacy-focused)
- Clean, readable message bubbles
- mediasoup: ^3.15.2
- socket.io: ^4.8.1
- express: ^4.21.2
- React 18
- Vite
- Socket.IO Client
- Tailwind CSS
- Mediasoup Client
- DTLS encryption for media
- WebRTC security features
- Transport authentication
- Room access control
- Chat isolation: Messages only within room boundaries
- No message persistence: Privacy-focused chat system
- Worker-based architecture
- Dynamic bitrate control
- Efficient media routing
- Active speaker optimization
- Transport pooling
- Lightweight chat: Local state management for fast UI
- Graceful worker failure handling
- Transport error recovery
- Room cleanup on participant exit
- Connection state management
- Chat connectivity: Automatic reconnection for messages
- Chat messages not appearing: Check browser console for socket connection errors
- Video not working: Ensure camera/microphone permissions are granted
- Connection issues: Verify server is running on correct port (3030)
- Chrome 90+ (Recommended)
- Firefox 88+
- Safari 14+
- Edge 90+