A real-time video broadcasting application built with Django and WebRTC. This application allows users to create WebRTC broadcasts and share them with viewers through unique stream IDs.
👉 Frontend Repo: WebCamBroadcast_Frontend
- Real-time video broadcasting using WebRTC
- WebSocket-based signaling server built with Django Channels
- Unique stream IDs for each broadcast
- Dedicated broadcaster and viewer interfaces
- Containerized deployment with Docker
- Docker
-
Clone the repository
git clone <repository-url> cd <project-directory>
-
Build the Docker image
sudo docker build -t django-webrtc-app .
-
Run the container
sudo docker run -p 8000:8000 django-webrtc-app
After starting the application, you can access:
-
Broadcaster interface (served via frontend repo): https://github.com/dharshan-kumarj/WebCamBroadcast_Frontend
-
Generate stream ID:
http://localhost:8000/api/get-stream-id/
-
Viewer interface (served via frontend repo):
http://localhost:8000/view/<stream_id>/
Make sure to also run the frontend alongside this backend. The frontend handles the WebRTC media stream, UI, and player logic.
- Broadcaster creates a stream with a unique ID
- Viewers connect to the stream using that ID
- WebSocket connections established through
/ws/webrtc/<stream_id>/
- WebRTC signaling messages (offers, answers, ICE candidates) exchanged via WebSockets
- Peer-to-peer connection established between broadcaster and viewers
- Replace
InMemoryChannelLayer
with Redis for Channels - Set
DEBUG=False
insettings.py
- Use secure secret key management
- Enable HTTPS (required for WebRTC in production)
- Add authentication and rate limiting for broadcasters/viewers
The included Dockerfile
:
- Uses Alpine Linux for minimal image size
- Implements multi-stage build
- Runs as a non-root user
- Exposes port
8000
for the Daphne ASGI server
🔗 Frontend (React-based): WebCamBroadcast_Frontend