WebRTC - P2P - Server Side Video Recording - react-native

I’m planning to build a video conference app. (NodeJS + React Native)
Requirements
One to One Video Conference ( 2 Speakers )
Video / Audio Recording of both the participants.
Store the recorded stream in an S3 bucket and watch the videos directly from it.
Live Streaming (Future Goals, but not at the moment)
Strategies tried so far:
Tried Twilio and Agora, but it wasn’t feasible due to pricing.
Mediasoup (SFU - inspired from dogehouse) was another option, but it’s relatively new and the development time takes much longer.
So I have come to a conclusion to start with Peer to Peer using WebRTC with React Native and record videos on a virtual server by connecting as a ghost participant. ( 2 Speakers + 1 Ghost Participant)
Need some strategies to implement WebRTC recording at the server. (Recordings are a bit crucial, so I don’t want to depend on the client)
Should I go with Puppeteer on server, join as ghost participant and record whenever a room is created, If yes - Is it possible to run multiple instances of puppeteer? Because at times, multiple room recordings might happen, so it needs to record concurrently. Need to confirm the scalability.
Look into Kurento / Jitsi
Any other options?
Great, if you could help me out! Cheers!!

As a developer evangelist for Agora, I want to say thanks for considering Agora. With regard to the pricing, while Agora offers a generous free-tier (10k min/ month) this is meant for development usage and once your project is deployed into production, costs will scale similar to hosting infrastructure (like AWS/GCP).
As with any project, to cover costs you will need to have some monetization strategy or have some free credits to grow the business. Similar to other platforms Agora has a start-ups program for qualified startups.
All that being said to answer your question about approach, I can tell you that the ghost client approach should work, Agora's cloud recording uses similar logic. With regard to scalability you could run multiple puppeteer instances.

You can take a look at html5 videocall web application on GitHub for inspiration.
As it uses Wowza SE as relay for scaling and reliability, streams can be recorded server side with FFmpeg. FFmpeg can input one or multiple streams, mix/transcoded and output to a local or external destination.
More advanced setups like PaidVideochat - Turnkey Videochat Site on WordPress support mixing multiple streams from conferencing/calls in same video file.
Using a relay streaming server is also great for scaling to multiple viewers.

The Galene SFU has native support for server-side recording (disclosure, I'm the main author). However, it is a fairly young project, which might be a problem for you.

Related

WebRTC Video & PSTN integration

This is a broad question - are there any solutions to WebRTC Video & PSTN integration ? The requirements are:
Multi-party WebRTC video conference (SFU or MCU, not peer to peer)
Ability to join the conference via PSTN end points (telephones) - obviously with audio fallback
Prefer paid service (like Tokbox or Twilio) rather than roll-your-own solution
We are currently using TokBox, however, it does not provide a PSTN integration. Since the call signalling is entirely hidden under the TokBox API, it seems unlikely that we could add (some kind of) WebRTC to PSTN gateway and make it work. Twilio has a video offering but it's actually in a very infant stage right now (peer to peer only, it seems with a limit of 4 participants).
Since we a Web App company and not a infrastructure company, I'd prefer a solution that handles the infrastructure part (like TokBox and Twilio do), but am open to other solutions as well, if that's what it'll take.
Thank you.
Avinash,
Twilio Video does not currently support PSTN integration. And there is currently that 4 participant limit regarding video chat.
This product is still a beta and constantly evolving so I'd suggest this group to you for keeping up with the updates.

How to measure the performance of my site's video streaming and playback?

I have developed a site that hosts user videos. I store the video files in AWS S3, I deliver them through AWS Cloudfront and I use video.js as the site's player with HTML5 as default and flash as fallback.
Generally the video streaming seems to work fine but in some cases I receive complaints from users for slow or choppy video playback. I want to create some tests to measure the performance of streaming in order to be able to distinguish user problems (e.g. slow connection at the user side) or with my service.
Are there any best practices or tools to collect video delivery metrics? I'm interested in open source solutions or something that I can implement myself because it's just a personal project, but I don't want to rediscover the wheel.
Testing progressive download implies checking the transmission bandwidth and its continuity. For example for a high transmission rate the initial client buffer will be filled faster and the playback will start sooner. However, losing that transmission capacity at some later time can cause re-buffering. The total transmission time of your file must be lower than the video duration.
To identify potential issues you can start with the S3 bucket logs and the CloudFront cache statistics and access logs.
There's a load testing tool written in Java called Apache JMeter. It cannot use JavaScript so it must be configured to request the files directly.
The disadvantage of using a load test tool in a single location is pretty evident. Different geographical areas and carriers have different characteristics and test results will be different.
There are online, non open-source tools that can load test from multiple locations but they are generally paid though some offer free trials.
Here's another way to look at this.
but in some cases I receive complaints from users for slow or choppy video playback.
If you're using an Adaptive HLS stream, and you're CloudFront, and the video is still choppy to some users, that's probably because of their own internet connection speeds.
In that case, you can encode your video in multiple resolutions (using just one AWS MediaConvert job, btw) - like 1080p, 720p, 360p, 240p, 144p etc.
And then Videojs has a stream switcher plugin that will 1) automatically start playing the highest possible resolution - and no higher - that's right for the viewer's connection and 2) give the user the option via a "Settings" (gear) icon in the control bar that they can use to switch resolutions manually.
That way, even those with really poor internet connections should be able to watch your video.
Of course, the other alternative is to use progressive download videos that the viewer can simply click play, then immediately click pause, and wait for the video to buffer, and then play it after it's fully downloaded.
Check out the Videojs Resolution Switcher demo here.
-- Ravi Jayagopal

What would be the reasons to choose RMTP over WebRTC?

I want to develop a video chat application, between Web browser and an Android device. As far as I know I have two prominent options, WebRTC and RMTP. I have tested out WebRTC and for Web app it was quite convenient to use, so I am inclined to use it. However, I should consider all my options, since I know little about Android development.
Do I have any reason to choose RMTP over WebRTC in the following use case:
Simple 1 to 1 video chat
Between Android application and Web browser ( just Chrome and Firefox is fine)
Recording and storing the call
Or neither has a clear advantage over the other in this simple case? For peer discovery I have a separate application server.
For a 1:1 video chat, there is no reason whatsoever to use RMTP.
RMTP is good (and even that is debatable in 2015) for streaming - a case where one end is producing the content and many on the other end are consuming it.
For something bidirectional, you should just pick WebRTC - its codecs are better, its availability is better and its technology is better.

Can WebRTC help me create a virtual classroom?

I'm trying to create a virtual classroom. Since I'm not familiar with the web conferencing (or conferencing) terminology, I'm not sure if I'm understanding WebRTC's capabilities as I should.
I've looked in the examples for WebRTC, and all that I've found seem to be peer-to-peer connections. As I understand it, peer-to-peer connections are between two entities. However, virtual classrooms are different as far as I know; they require all parties to be connected to each other, so that when one user speaks/types, all users hear her.
Is such a thing possible with WebRTC? If so, what is it called and how can I read more about it?
Check out the open source Big Blue Button project (http://bigbluebutton.org/). They're currently Flash based but are actively moving towards webRTC. Rumor has it they'll be using Kurento as their MCU. They also have open source mobile (Android/iOS) application code.
According to http://www.html5rocks.com/en/tutorials/webrtc/infrastructure/, such a thing is possible:
Beyond one-to-one: multi-party WebRTC
You may also want to take a look at Justin Uberti's proposed IETF standard for
a REST API for access to TURN Services.
It's easy to imagine use cases for media streaming that go beyond a simple
one-to-one call: for example, video conferencing between a group of colleagues,
or a public event with one speaker and hundreds (or millions) of viewers.
A WebRTC app can use multiple RTCPeerConnections so to that every endpoint
connects to every other endpoint in a mesh configuration. This is the approach
taken by apps such as talky.io, and works remarkably well for a small handful
of peers. Beyond that, processing and bandwidth consumption becomes excessive,
especially for mobile clients.
Maybe you can try searching in the webrtc google group
hope this helps

One to many video Audio conferencing - webrtc - openTok

I searched about this on google but could not find any suitable answer so posting here for help.
I want to implement video streaming with multiple participants connected. While google this topic I found that WebRTC provide similar functionality but I want to make sure whether WebRTC can support all my requirements.
I want to build an application that should support large number of participants in conference (around 10000).
I want to implement facility like one participant is broadcasting its video and audio streams and other are just listening to their stream.
Also when prompted only one participant will be able to communicate with broadcaster which will be managed by one participant (a administrator). Administrator will decide who can communicate with broadcaster.
Is same can be possible with any other WebAPI ?? I found OpenTok, but not confident if it provide any feature of moderation in conference (i.e. feature of having an Administrator who manages stuff)
Did anybody worked on similar concept or having any information related to this.
Let me know if I am not clear of any further details are required.
Any help would be useful,
Thanks in anticipation
Hardik - I am Product Manager at TokBox, the makers of the OpenTok platform. Good news: TokBox can fulfill virtually all of your requirements, but with a few caveats.
TokBox has been building a video chat/conferencing platform for years, long before WebRTC even existed in fact. In that time we have supported many customers with almost your exact requirements on OpenTok, a platform that is based on Flash (Major League Baseball is one such customer). Building applications on this architecture has the added advantage of solving virtually all of the interop issues that exist when connecting people using different devices and browsers. It is based on Flash however, which technically doesn't meet your WebRTC requirement. So you know, there's that.
WebRTC is where it's at though, which is why we created OpenTok for WebRTC in 2012. It was a complete rewrite of the platform that not only provides higher quality video, but also gives developers more hooks and far more control over how exactly they integrate video and audio chat into their primary customer experience.
Currently in beta (as of this writing in June 2013) are two new components in our WebRTC infrastructure. The first we refer to as Mantis, which solves many of the challenges associated with hosting large multi-party calls. The other is Cloud Raptor, which gives developers access to a stream of events stemming from a WebRTC session, and through which developers can issue events and commands of their own. Raptor is what enables you for example to moderate calls, boot participants, and control whose audio and video streams are broadcast to all the other participants.
So, TokBox has what you need. In the short term we can help you get up and running using OpenTok pretty quickly. Then we can discuss with you how to get you onto OpenTok for WebRTC and into our Mantis and Raptor beta program.