Skip to content

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.

License

Notifications You must be signed in to change notification settings

mehmetkahya0/local-web-camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Local Web Camera ๐ŸŽฅ

GitHub license GitHub stars GitHub issues GitHub forks Node.js Version WebRTC Visitors

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.

๐ŸŒŸ Features

  • 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

๐Ÿš€ Quick Start

  1. Clone the repository:
git clone https://github.com/mehmetkahya0/local-web-camera.git
cd local-web-camera
  1. Install dependencies:
npm install
  1. Start the server:
npm start
  1. 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

๐Ÿ› ๏ธ Tech Stack

  • Frontend:

    • Native WebRTC API
    • Vanilla JavaScript
    • HTML5
    • CSS3
  • Backend:

    • Node.js
    • Express
    • Socket.IO
    • STUN/TURN servers

๐Ÿ“ฑ Usage

As a Host:

  1. Click "Start Camera" to enable your device's camera
  2. Click "Share Link" to generate a viewing URL
  3. Share the generated URL with the viewer

As a Viewer:

  1. Open the http://[Host_Device_Local_IP]?room=SHARED_LINK_ROOM_ID
  2. Wait for the connection to be established
  3. The stream will start automatically

๐Ÿ”ง Configuration

The server runs on port 8080 by default. To change this:

  1. Open server.js
  2. Modify the port constant
  3. Restart the server

๐ŸŒ Network Requirements

  • 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

๐Ÿ“‹ System Requirements

  • Node.js โ‰ฅ 14.0.0
  • Modern web browser with WebRTC support
  • Camera and microphone access
  • Network connectivity

๐Ÿ”’ Security Features

  • HTTPS ready (certificates included)
  • Peer-to-peer encryption (WebRTC)
  • One viewer per stream limit
  • Automatic connection monitoring
  • Cross-Origin Resource Sharing (CORS) protection

๐Ÿ›ก๏ธ Security

Network Security

  • End-to-end encryption via WebRTC
  • DTLS (Datagram Transport Layer Security) protocol
  • Secure signaling through Socket.IO
  • Network isolation between peers

Data Protection

  • No video/audio data storage on server
  • Temporary session-only data
  • Automatic data cleanup on disconnection
  • No personal information collection

Access Control

  • Unique room IDs per session
  • Auto-expiring session tokens
  • IP-based rate limiting
  • Validation of all incoming connections

Best Practices

  1. Use HTTPS in production
  2. Keep Node.js and dependencies updated
  3. Change default port in public deployments
  4. Enable firewall rules as needed

Security Audit Commands

# Run security audit on dependencies
npm audit

# Check for known vulnerabilities
npm audit fix

# Update dependencies to secure versions
npm update

Chart Features

The application includes real-time data visualization capabilities using charts:

Available Charts

  • Connection Status: Displays real-time connection status of users
  • Bandwidth Usage: Shows network bandwidth consumption
  • User Activity: Tracks active users over time

Using Charts

  1. Open the dashboard panel
  2. Select desired chart type from the dropdown
  3. 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
Loading

Chart Configuration

Charts can be customized through the settings panel:

  • Update frequency (1-60 seconds)
  • Data retention period
  • Display options

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”ฎ Future Improvements

  • Multiple viewer support
  • Chat functionality
  • Screen sharing
  • Recording capability
  • Bandwidth adaptation
  • Room password protection

๐Ÿ› Known Issues

  • iOS Safari may require user interaction to start playing video
  • Some networks may block WebRTC connections
  • Connection quality depends on network conditions

๐Ÿ“ž Contact

Mehmet Kahya - @mehmetkahya0

Project Link: https://github.com/mehmetkahya0/local-web-camera

๐Ÿ™ Acknowledgments

  • WebRTC Community
  • Socket.IO Team
  • Node.js Community

Made with โค๏ธ by Mehmet Kahya

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published