Scalable WebRTC peer-to-peer broadcasting demo.
This module simply initializes socket.io and configures it in a way that single broadcast can be relayed over unlimited users without any bandwidth/CPU usage issues. Everything happens peer-to-peer!
npm install webrtc-scalable-broadcast
node .\node_modules\webrtc-scalable-broadcast\server.js
And now open: http://localhost:8888
.
This demo runs top over RTCMultiConnection.js. Though, you can use it in any other WebRTC Experiment.
It following technique mentioned here:
Assuming peers 1-to-10:
Peer1 is the only peer that invokes getUserMedia
. Rest of the peers will simply forward/relay remote stream.
peer1 captures user-media
peer1 starts the room
peer2 joins the room
peer2 gets remote stream from peer1
peer2 opens a "parallel" broadcasting peer named as "peer2-broadcaster"
peer3 joins the room
peer3 gets remote stream from peer2
peer3 opens a "parallel" broadcasting peer named as "peer3-broadcaster"
peer4 joins the room
peer4 gets remote stream from peer3
peer4 opens a "parallel" broadcasting peer named as "peer4-broadcaster"
peer5 joins the room
peer5 gets remote stream from peer4
peer5 opens a "parallel" broadcasting peer named as "peer5-broadcaster"
and 10th peer:
peer10 joins the room
peer10 gets remote stream from peer9
peer10 opens a "parallel" broadcasting peer named as "peer10-broadcaster"
- Peer9 gets remote stream from peer8
- Peer15 gets remote stream from peer14
- Peer50 gets remote stream from peer49
and so on.
This demo works only with screen and video-only streams. It doesn't works with audio.
Because currently remote audio processing or forwarding isn't supported in chrome.
This demo works only in Chrome; no Firefox support yet. Because Firefox isn't supporting non-APM sources for peer-streaming.
Scalable WebRTC Broadcasting Demo is released under MIT licence . Copyright (c) Muaz Khan.