A peer-to-peer web camera streaming application built with WebRTC, Socket.IO, and Express. Stream your camera to another device on your local network with minimal latency.
- Real-time video streaming using WebRTC
- Peer-to-peer connection (no server routing for video)
- Automatic network interface detection
- Mobile-friendly interface
- Simple host/viewer architecture
- Connection status monitoring
- Automatic reconnection handling
- Cross-browser compatibility
- iOS and Android support
- Clone the repository:
git clone https://github.com/mehmetkahya0/local-web-camera.git
cd local-web-camera
- Install dependencies:
npm install
- Start the server:
npm start
- Open the application:
- On the host device:
http://localhost:8080
- On viewer devices: Use the URL displayed in the console or shared by the host
-
Frontend:
- Native WebRTC API
- Vanilla JavaScript
- HTML5
- CSS3
-
Backend:
- Node.js
- Express
- Socket.IO
- STUN/TURN servers
- Click "Start Camera" to enable your device's camera
- Click "Share Link" to generate a viewing URL
- Share the generated URL with the viewer
- Open the http://[Host_Device_Local_IP]?room=SHARED_LINK_ROOM_ID
- Wait for the connection to be established
- The stream will start automatically
The server runs on port 8080 by default. To change this:
- Open
server.js
- Modify the
port
constant - Restart the server
- Both devices must be on the same network (for best performance)
- Port 8080 must be accessible
- STUN/TURN servers must be reachable
- WebRTC must not be blocked by firewall
- Node.js โฅ 14.0.0
- Modern web browser with WebRTC support
- Camera and microphone access
- Network connectivity
- HTTPS ready (certificates included)
- Peer-to-peer encryption (WebRTC)
- One viewer per stream limit
- Automatic connection monitoring
- Cross-Origin Resource Sharing (CORS) protection
- End-to-end encryption via WebRTC
- DTLS (Datagram Transport Layer Security) protocol
- Secure signaling through Socket.IO
- Network isolation between peers
- No video/audio data storage on server
- Temporary session-only data
- Automatic data cleanup on disconnection
- No personal information collection
- Unique room IDs per session
- Auto-expiring session tokens
- IP-based rate limiting
- Validation of all incoming connections
- Use HTTPS in production
- Keep Node.js and dependencies updated
- Change default port in public deployments
- Enable firewall rules as needed
# Run security audit on dependencies
npm audit
# Check for known vulnerabilities
npm audit fix
# Update dependencies to secure versions
npm update
The application includes real-time data visualization capabilities using charts:
- Connection Status: Displays real-time connection status of users
- Bandwidth Usage: Shows network bandwidth consumption
- User Activity: Tracks active users over time
- Open the dashboard panel
- Select desired chart type from the dropdown
- Charts will update automatically in real-time
graph TD
A[Data Collection] --> B[Processing]
B --> C[Chart Rendering]
C --> D[Real-time Updates]
D --> B
Charts can be customized through the settings panel:
- Update frequency (1-60 seconds)
- Data retention period
- Display options
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Multiple viewer support
- Chat functionality
- Screen sharing
- Recording capability
- Bandwidth adaptation
- Room password protection
- iOS Safari may require user interaction to start playing video
- Some networks may block WebRTC connections
- Connection quality depends on network conditions
Mehmet Kahya - @mehmetkahya0
Project Link: https://github.com/mehmetkahya0/local-web-camera
- WebRTC Community
- Socket.IO Team
- Node.js Community
Made with โค๏ธ by Mehmet Kahya