
WebRTC Samples - simonpure
https://webrtc.github.io/samples/
======
Sean-Der
The term 'WebRTC' is overloaded, it can mean the protocol or the API. These
samples only cover in the browser. This repo is also kind of dead
[https://github.com/webrtc/samples/issues/1350](https://github.com/webrtc/samples/issues/1350)

If you are interested in WebRTC out of the browser there are lots of
implementations and servers! I am also working on a book 'WebRTC for the
Curious'[0] that tries to explain the protocol and the history behind it.

[0] [https://webrtcforthecurious.com/](https://webrtcforthecurious.com/)

~~~
gxqoz
This blog post from 2018 from Discord indicated that the browser
implementation of WebRTC wasn't as good: [https://blog.discordapp.com/how-
discord-handles-two-and-half...](https://blog.discordapp.com/how-discord-
handles-two-and-half-million-concurrent-voice-users-using-webrtc-
ce01c3187429?gi=70398163d427)

Is this still the case? Would you still hypothetically see better audio
performance of something like Discord in a standalone app?

~~~
de_watcher
Still pretty bad. Firefox can't freely select audio devices per stream. Chrome
has some kind of unbeatable adaptation that makes latency fluctuate.

~~~
mooss
Do you have more details on the Firefox problem? I have a WebRTC project that
is currently in standby (priorities changed) and one issue that I have not
been able to troubleshoot was an inability to send audio from Firefox while it
somehow worked on Chrome.

~~~
de_watcher
It works fine in Firefox (send and receive) as long as you don't need to play
on multiple output devices. Currently you can enable a feature flag, use
enumerateDevices() and play audio files on specific devices, but you can't
hook up WebRTC streams to the devices.

enumerateDevices() should enumerate audio output devices (feature behind
pref):
[https://bugzilla.mozilla.org/show_bug.cgi?id=1152401](https://bugzilla.mozilla.org/show_bug.cgi?id=1152401)

Enable by default setSinkId pref:
[https://bugzilla.mozilla.org/show_bug.cgi?id=1498512](https://bugzilla.mozilla.org/show_bug.cgi?id=1498512)

Alex Chronopoulos: "We keep it off because it does not work for everything. It
works when we playback a file but not for webaudio or WebRTC. We want to add
those too and we keep it off till then."

~~~
mooss
Thanks for your answer, I only have two devices connected so my problem must
be caused by an unrelated mistake. I'll find out eventually :).

------
ChicagoBoy11
For those in the know, if I'm running something on my own that may only at any
given moment see in the few hundreds of people using it, what's the best
approach in terms of server-side infrastructure to support WebRTC apps? Is
there any SaaS offering that has a meaningful product?

~~~
cpncrunch
We use Janus Gateway, and it works really well:

[https://github.com/meetecho/janus-gateway](https://github.com/meetecho/janus-
gateway)

We have upwards of 100 simultaneous users on it every day, and at the moment
it seems to be 100% reliable.

~~~
fenesiistvan
Mizu gateway also does the job:

[https://www.mizu-voip.com/Software/WebRTCtoSIP.aspx](https://www.mizu-
voip.com/Software/WebRTCtoSIP.aspx)

It has a nice config wizard and built-in STUN and TURN server.

------
kristianpaul
There is also
[https://janus.conf.meetecho.com/screensharingtest.html](https://janus.conf.meetecho.com/screensharingtest.html)
just to have more resources to check

------
suyash
If you want to build a multiple session (multiple people) connecting to a
website with their camera and audio on, would you use WebRTC or WebSocket +
getUserMedia ? Why ?

~~~
Sean-Der
WebRTC is going to be better for most users (IMO). WebRTC provides congestion
control so video stays real-time. It works pretty well with very little
effort.

Some companies have decided to roll their own, [https://webrtchacks.com/zoom-
avoids-using-webrtc/](https://webrtchacks.com/zoom-avoids-using-webrtc/) is a
cool read.

~~~
suyash
how about if you want to integrate real time chat, can webRTC data channel
accomplish that or one needs WebSockets for that?

~~~
moron4hire
Go do your own homework

~~~
rizpanjwani
suggest you read this (on the frontpage today):
[https://nedbatchelder.com//blog/202009/how_to_be_helpful_onl...](https://nedbatchelder.com//blog/202009/how_to_be_helpful_online.html)

------
paulirish
My favorite sample by far:
[https://webrtc.github.io/samples/src/content/devices/input-o...](https://webrtc.github.io/samples/src/content/devices/input-
output/)

I routinely hit it to validate my camera/audio options and confirm the audio
is sounding good.

~~~
laser
That was extremely loud from feedback amplifying. Are you doing this with
headphones on?

~~~
paulirish
Yup. Sorry probably shoulda noted that. :D

------
echeese
If I want to add WebRTC capabilities to an existing server, what's the
simplest way of doing that? This is for a game, all I need is an unreliable
RTCDataChannel

~~~
okay1000
I used simple-peer [1] for sending coordinates between clients in a canvas
painting game [2].

[1] [https://github.com/feross/simple-peer](https://github.com/feross/simple-
peer)

[2] [https://github.com/justo-rivera/dibujio-client](https://github.com/justo-
rivera/dibujio-client)

Ps. Be sure to use a turn server besides a stun one, that was a big headache
to get it working on mobile data

------
amelius
Any reason why this requires both Python _and_ Nodejs?

