How do i handle PeerJS web RTC with live video stream server? - node.js

Good day fellow developers,
Recently i just developed web RTC using PeerJS, it works correctly no problem, until i handle 5+ clients, the internet on the devices are just giving up, they can't. And this one is what i just discovered on the documentation page:
Data sent between the two peers do not touch any other servers, so the connection speed is limited only by the upload and download rates of the two peers. This also means you don't have the additional latency of an intermediary server.
Which is why the client devices are giving up, how do i make livestream server that handle peerjs? i've googled and i only found the live stream server for OBS, i want the server to handle PeerJS WebRTC like BigBlueButton.
Thanks in advance

Related

How to use `getUserMedia()` api to simulate WebRTC like behaviour?

My primary intention is to setup a VoIP session between 2 users A & B; Here the raw audio / video media bytes are fetched from A's browser are played in B's browser and vice versa.
The reason is that, when the user C & D are added into this call, we need not have to create a P2P mesh network which limits the performance.
Tried recording media with getUserMedia() and playback, but it is not real time. It also gives a bad user experience. (However, haven't experimented yet with videos of small chunks as 200 ms)
Is there any approach where I can get the raw bytes of the media and play it on other browser? Currently I have a server in between which can connect to both peers if required.
Any online examples or libraries are welcome.
Have already asked 2 questions in this regard with 100-100 bounties, but not much of use:
How to use libsrtp or similar library to decrypt/encrypt the WebRTC data stream?
How to integrate part of WebRTC as a static / dynamic library with the existing C++ code?
Related: How to stream, live video playing on my browser to browser of another user?
If i understand you well is you're looking on how to have more than two users on the session right? without using mesh topology
thats possible and configurable as well by means that some maybe active speaker or everyone is active speaker not only receiver whatever configuration you choose but to me it seems that you're asking for video conferencing
there are couple of tools for this the best one i might recommend is mediasoup its a SFU as selective fowarding unit mediasoup
I don't know if I understand correctly, but it is not likely that you will get raw video data and play it on the browser, it will just kill your bandwith and performance because the raw data is huge.
You need to use the compressed data ( media codec ex.H264 ) and you need a protocol to send and receive it. If you are looking for sub-second latency than webrtc is your best choice in here already. If you have a server in between, distribute your media through that server instead of Mesh. Check this out for webrtc network topologies:
https://antmedia.io/webrtc-servers/

Node.JS Voice over IP Electron

I am fairly new to Node.JS, but I want to code a Voice Chat Program which uses the Electron Framework for the Client.
The Server shall be hosted on a Linux Computer. I want to connect with multiple Clients to this Server and talk and recieve audio from others connected. I want this as a Project so me and my buddies can talk over a piece of software I made.
As I pretty much don't know much about Streams in NodeJS. Which protocolls can I use, for best quality and low network bandwith.

Raspberry Pi video streaming with lowest latency possible via a server to multiple clients

I want to build a video security infrastructure with raspberry pis.
Please take a look at the rough layout I've in mind:
What the system should be capable of:
The RPis need to stream a low latency video to the
webserver, which displays it to all clients visiting the website.
If a client authenticates he can control one RPi sending commands that gets translated into GPIO commands.
All RPis should be controllable simultaneously by different clients in realtime.
Some kind of scaleability (Clients + RPis)
My Questions:
I wanted to program everything in node.js. Good idea?
Could WebRTC and Sockets.io help me in this project - if not is
there another library that would help me out?
How many clients could a VPS Server (8GB RAM, 4 vCores) handel in this setup?
Is it possible to bring the latency down to < 2 seconds or more?
Anything helps! Thanks!

WebRTC NodeJS Server Architecture

I'm interested in building a web application similar to TinyChat where multiple users can be in a room and broadcast their audio/video feeds to everyone else in the room. I've been looking at WebRTC and it looks pretty easy to get started with a P2P setup, but I'm having trouble finding out how to do WebRTC with a client/server architecure.
I've watched Google's presentation video on WebRTC and the different network topologies common in working with WebRTC. The one I'm most interested in is that in working with an MCU where the MCU is responsible for broadcasting the data to everyone else in the room, thus eliminating P2P.
My question is, how would I go about this? Are there any working examples? Prefferably, I'd like to work with NodeJS on the server-side but haven't found any libraries for handling it. The only two things I have found are Kurento and Licode, but they both appear to be more than I'm interested in at this point in time. I'm basically just wanting something that takes the WebRTC connection and then broadcasts it out to the appropriate users in the same room. I'm not worried about transcoding, muxing, or recording right now.

Live media streaming involving different kinds of devices

I am working on a project which will involve http live media streaming from a variety of devices like android phones/tablets, iphone, ipad, browser,etc. It will be a 2 way communication for all the devices with multiple devices connected to a conversation. I have implemented it partially i.e. one way by capturing audio from android phone(native app) and streaming to a web browser(HTML5 app) with a PHP server using ffmpeg and cvlc. I wanted to know of the best way to go ahead about it. Like, if there are any standards to be followed. Also what kind of a server should I be using? I don't want to use any streaming servers like Red5. I would like to implement the streaming logic similar to Http LiveStreaming by apple. I have come across MPEG-DASH that seems to be a standard for http streaming. I still have to look deeper into it. I was also thinking of using NodeJS for its popularity with streaming. Another worry was how do I go about capturing of media from devices? As in, should I use the native capability of the devices to convert media into an mp4 or any container that it supports and then stream it to the server or capture audio and images for a particular period of time and then send it to server and create a common output(I am not really sure of this idea). The separate capture is basically for simplifying the process of video streaming from the server end to any device. I was also thinking if I could completely bypass the server in any cases like a phone to phone or phone to tablet connection.
I just wanted to be sure of the things I will be using/implementing so that I wouldn't have to make drastic changes later on. Any help is deeply appreciated. Thank you.

Resources