All Projects → muaz-khan → Webrtc Scalable Broadcast

muaz-khan / Webrtc Scalable Broadcast

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!

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Webrtc Scalable Broadcast

Flutter Webrtc Server
A simple WebRTC signaling server for flutter-webrtc.
Stars: ✭ 384 (-21.31%)
Mutual labels:  webrtc
Rpi Webrtc Streamer
This repo's objective is providing something like Web Cam server on the most popular Raspberry PI hardware. By integrating [WebRTC](https://webrtc.org/native-code/) and Raspberry PI, we can stream the Raspberry camera feed to browser or native client which talks WebRTC.
Stars: ✭ 428 (-12.3%)
Mutual labels:  webrtc
Sipsorcery
A WebRTC, SIP and VoIP library for C# and .NET Core. Designed for real-time communications apps.
Stars: ✭ 449 (-7.99%)
Mutual labels:  webrtc
Awesome Webrtc
A curated list of awesome WebRTC modules and resources.
Stars: ✭ 395 (-19.06%)
Mutual labels:  webrtc
Go Stun
A go implementation of the STUN client (RFC 3489 and RFC 5389)
Stars: ✭ 420 (-13.93%)
Mutual labels:  webrtc
Go Webrtc
WebRTC for Go
Stars: ✭ 432 (-11.48%)
Mutual labels:  webrtc
Filedrop Web
📲 WebRTC file transfer - React/TypeScript front end.
Stars: ✭ 375 (-23.16%)
Mutual labels:  webrtc
Libwebrtc
📦 Google's WebRTC implementation in a single static library.
Stars: ✭ 472 (-3.28%)
Mutual labels:  webrtc
Webtorrent Hybrid
WebTorrent (with WebRTC support in Node.js)
Stars: ✭ 422 (-13.52%)
Mutual labels:  webrtc
Stun
Fast RFC 5389 STUN implementation in go
Stars: ✭ 451 (-7.58%)
Mutual labels:  webrtc
P
Peer-to-peer networking with browsers
Stars: ✭ 400 (-18.03%)
Mutual labels:  webrtc
Twilio Video.js
Twilio’s Programmable Video JavaScript SDK
Stars: ✭ 408 (-16.39%)
Mutual labels:  webrtc
Geckos.io
🦎 Real-time client/server communication over UDP using WebRTC and Node.js http://geckos.io
Stars: ✭ 439 (-10.04%)
Mutual labels:  webrtc
Echoplexus
Socket.io powered chat, JavaScript REPL, whiteboard, and WebRTC calls
Stars: ✭ 392 (-19.67%)
Mutual labels:  webrtc
Momo
WebRTC Native Client Momo
Stars: ✭ 454 (-6.97%)
Mutual labels:  webrtc
Anyrtc Rtmp Opensource
RTMP 推流器,RTMP(HLS)秒开播放器,跨平台(Win,IOS,Android)开源代码
Stars: ✭ 3,871 (+693.24%)
Mutual labels:  webrtc
React Native Callkeep
iOS CallKit framework and Android ConnectionService for React Native
Stars: ✭ 430 (-11.89%)
Mutual labels:  webrtc
Planktos
Serving websites over bittorrent
Stars: ✭ 481 (-1.43%)
Mutual labels:  webrtc
Recordrtc
RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
Stars: ✭ 5,008 (+926.23%)
Mutual labels:  webrtc
Re
Generic library for real-time communications with async IO support
Stars: ✭ 444 (-9.02%)
Mutual labels:  webrtc

WebRTC Scalable Broadcast

Scalable WebRTC peer-to-peer broadcasting demo.

npm downloads

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!

RTCMultiConnection v3 and Scalable Broadcast

RTCMultiConnection v3 now naively supports scalable-broadcast:

DemoTitle TestLive ViewSource
Scalable Audio/Video Broadcast Demo Source
Scalable Screen Broadcast Demo Source
Scalable Video Broadcast Demo Source
Scalable File Sharing Demo Source

Demos

Note: These (below) are old demos. Above (RTCMultiConnection-v3) demos are preferred (and up-to-dated).

  1. index.html - share video or screen or audio over unlimited users using p2p methods.
  2. share-files.html - share files with unlimited users using p2p methods!

Browsers Support:

Browser Support
Firefox Stable / Aurora / Nightly
Google Chrome Stable / Canary / Beta / Dev

Browsers Comparison

host means the browser that is used to forward remote-stream.

Host Streams Receivers Issues
Chrome Audio+Video Chrome,Firefox Remote audio tracks are skipped.
Chrome Audio None Chrome can NOT forward remote-audio
Chrome Video Chrome,Firefox No issues
Chrome Screen Chrome,Firefox No issues
Firefox Audio+Video Chrome,Firefox No issues
Firefox Audio+Screen Chrome,Firefox No issues
Firefox Audio Chrome,Firefox No issues
Firefox Video Chrome,Firefox No issues
Firefox Screen Chrome,Firefox No issues
  1. First column shows browser name
  2. Second column shows type of remote-stream forwarded
  3. Third column shows browsers that can receive the remote forwarded stream
  4. Fourth column shows sender's i.e. host's issues

Chrome-to-Firefox interoperability also works!

Android devices are NOT tested yet. Opera is also NOT tested yet (though Opera uses same chromium code-base).

Currently you can't share audio in Chrome out of this big. In case of audio+video stream, chrome will skip remote-audio tracks forwarding. However chrome will keep receiving remote-audio from Firefox!

Firefox

Firefox additionally allows remote-stream-forwarding for:

  1. Streams captured from <canvas>
  2. Streams captured from <video>
  3. Streams captured or generated by AudioContext i.e. WebAudio API

Is stream keeps quality?

Obviously "nope". It will have minor side-effects (e.g. latency in milliseconds/etc.).

If you'll be testing across tabs on the same system, then you'll obviously notice quality lost; however it will NOT happen if you test across different systems.

WebRTC Scalable Broadcast

In the image, you can see that each NEW-peer is getting stream from most-recent peer instead of getting stream directly from the moderator.

npm install webrtc-scalable-broadcast

Now, goto node_modules>webrtc-scalable-broadcast:

cd node_modules
cd webrtc-scalable-broadcast

# and run the server.js file
node server.js

Or:

cd ./node_modules/webrtc-scalable-broadcast/
node ./server.js

Or install using WGet:

mkdir webrtc-scalable-broadcast && cd webrtc-scalable-broadcast
wget http://dl.webrtc-experiment.com/webrtc-scalable-broadcast.tar.gz
tar -zxvf webrtc-scalable-broadcast.tar.gz
ls -a
node server.js

Or directly download the TAR/archive on windows:

And now open: http://localhost:8888 or 127.0.0.1:8888.

If server.js fails to run:

# if fails,
lsof -n -i4TCP:8888 | grep LISTEN
kill process-ID

# and try again
node server.js

How it works?

Above image showing terminal logs explains it better.

For more details, to understand how this broadcasting technique works:

WebRTC Scalable Broadcast

Assuming peers 1-to-10:

First Peer:

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

Second Peer:

peer2 joins the room
peer2 gets remote stream from peer1
peer2 opens a "parallel" broadcasting peer named as "peer2-broadcaster"

Third Peer:

peer3 joins the room
peer3 gets remote stream from peer2
peer3 opens a "parallel" broadcasting peer named as "peer3-broadcaster"

Fourth Peer:

peer4 joins the room
peer4 gets remote stream from peer3
peer4 opens a "parallel" broadcasting peer named as "peer4-broadcaster"

Fifth Peer:

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"

Conclusion

  1. Peer9 gets remote stream from peer8
  2. Peer15 gets remote stream from peer14
  3. Peer50 gets remote stream from peer49

and so on.

License

Scalable WebRTC Broadcasting Demo is released under MIT licence . Copyright (c) Muaz Khan.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].