Mediasoup – WebRTC Video Conferencing
mediasoup.org
mediasoup.org
In my very humble opinion, I would suggest to reserve some address space in IPv6 for rtc, so that a peer is able to adopt a new special ip reserved for rtc. Nothing new under the sun, in 2014 someone comment along this line of thought (2) and (3).
So what are we waiting for?
(1) https://webrtcglossary.com/ (2) https://www.quora.com/Will-the-IPv6-result-in-the-death-of-S...
(3) 2014, AshleysBrain, https://news.ycombinator.com/item?id=7496986 I think the solution is IPv6. Once every device on the Internet is uniquely addressable again, we can do away with these NAT hacks and two endpoints should be able to reliably connect to each other again, no matter where they are. Of course, that's assuming we don't get more short-sighted engineering that breaks things again...
IPv6 will certainly REDUCE the need for STUN, but there are still (many) cases where you don't want to be "reachable by default", in which case you need a stable reference for negotiating routing and reachability (e.g. STUN).
It might not be obvious but I am not using WebRTC for video conferencing. My use case is basically regular live streaming but with latencies in the 100ms range.
Edit: I just compared the docs https://raw.githubusercontent.com/versatica/mediasoup/v3/art... vs https://doc-kurento.readthedocs.io/en/6.13.0/features/kurent... This is exactly what I need!
* How good is this compared to other alternatives? (Or why choose this instead of something else?)
* Where are the client apps for this, more importantly on mobile?
And it is very actively developed, which is arguably the most important metric in the current webRTC environment. Since the spec and browser implementations are a fast moving target right now and for the years to come.
Comparing Jitsi with mediasoup is like comparing Netflix (backend + apps) with Express.js + libcurl.
Jitsi developers may replace their RTC core internals (including the SFU) with mediasoup + mediasoup-client and you wouldn't even realize of it. Hope this helps.
And here's the source code for the demo: https://github.com/versatica/mediasoup-demo/
Libs for native apps: https://github.com/haiyangwu/mediasoup-client-android
Those libs for native apps are not official mediasoup components. We deliver libmediasoupclient[1] which is a native C++ implementation of the JS mediadiasoup-client[2] and uses libwebrtc[3] C++ native code directly.
Those two libs for native apps make use of libmediasoupclient, but they are not written nor maintained by us. Having said that, to the moment there is no official Android or IOS native client but there is libmediasoupclient which will be the core for both.
[1]: https://github.com/versatica/libmediasoupclient [2]: https://github.com/versatica/mediasoup-client [3]: http://webrtc.github.io/webrtc-org/native-code/
In general, i recommend it. Only media server that i saw working (slightly) better is Jitsi, but it is 10x more cumbersome and time-consuming to learn.
TL'DR': Pornhub uses mediasoup.
I've read many comments here asking about "how mediasoup is different than XXX" or about "mobile apps". I think the Overview in the website should be self explanatory, I'll just paste a fragment here:
https://mediasoup.org/documentation/overview/
--------------------- Design goals of mediasoup and its client side libraries:
- Be a SFU (Selective Forwarding Unit). - Support both WebRTC and plain RTP input and output. - Be a Node.js module in server side. - Be a tiny JavaScript and C++ libraries in client side. - Be minimalist: just handle the media layer. - Be signaling agnostic: do not mandate any signaling protocol. - Be super low level API. - Support all existing WebRTC endpoints. - Enable integration with well known multimedia libraries/tools.
Use cases:
- Group video chat applications. - One-to-many (or few-to-many) broadcasting applications in real-time. - RTP streaming.
Without considerable hacks (patent-encumbered unaccelerated wasm ffmpeg encoding of pixel data, rolling your own SRTP-like encrypted stream over datachannels and full mesh distribution of keys) this is not currently possible for anything other than a full mesh. Whenever an SFU (effectively a MITM) is involved (needed for more than a small number of participants) e2e encryption is lost.
If/when Insertable Streams are commonplace, this will be possible without so many hacks.
Edit: I see I was downvoted for correcting you, but there was an article on this very subject yesterday: https://webrtchacks.com/you-dont-have-end-to-end-encryption-...
This platform - and jitsi/janus/zoom/whatever - all use an SFU for more than a handful of participants.
The product I work on signals this to the user, and asks for confirmation before "upgrading" to an SFU.
I don't know what Mediasoup does, was just commenting on what webrtc can do re the "the current state of webrtc" subject.
Im just saying that this library (and similar platforms) ARE the cutting edge of webrtc. At small number of participants, they use full mesh (which is e2ee), but at larger scale, they need to use an SFU (which is not e2ee without jumping through some crazy hoops - but this is being worked on)
> You don't even need servers if you go full p2p
If you have N participants into the same "room", and do not have a central SFU that relays streams to others, then you have a full mesh network with all participants sending audio and video to all the others. Is that the "go full p2p" you meant?. Well, try it, and you'll see how your CPU burns when the browser/app tries to encode your webcam video source N times. And of course, you'd need N x uplink.
You would still need some form of STUN server (but there are a number of 'freely accessible' ones, even configured as defaults in some browsers) to get your reachable address/port/proto. You cant, AFAIK, handle this manually - it is handled internally as part of ICE. Then you would need to manually handle the signalling of these as well.
Thats the bare minimum you have to do to peer over webrtc under ideal circumstances, but its certainly doable.
So you do that for each peer. If you (or a peer) change streams you will do the same thing all over again
edit: cant reply to your comment fulafel, but on that project you posted: https://github.com/cjb/serverless-webrtc/blob/master/serverl... Also, note that even if this wasnt defined, some browsers contain defaults. You 100% need STUN, but you can handle the signalling manually - as I stated.
edit2: cant reply to your comment ibc, but I was explaining the bare minimum 'serverless' webrtc case still required a STUN server. I appreciate that mediasoup SFU uses ice-lite instead.
If you say it's different with media channels, I'll believe you.
WebRTC can tell you your ip address without any external server, that only breaks if you are dealing with NAT.
edit: to clarify the NAT-less use case, i'm thinking of apps that can rely on/require p2p supporting IPv6 connectivity.
So you don't know what mediasoup does but you assure that "no need to use a SFU". Too much free time to comment maybe?
e2ee makes sense in one-to-one and N-to-N scenarios. It's just more complex in N-to-N scenarios because you DO need a centralized server so each participant just sends its audio/video once (to the server) and the server distributes it to others given whichever application policy/logic. That's a SFU, and that's what mediasoup does.
jitsi has been production tested far longer i suppose, through its freely available videoconferencing service https://meet.jit.si/
Mediasoup has a c++ core with node api. Jitsi is java.
If you're experienced with webRTC, you will probably like mediasoup better. Otherwise I'd stick with jitsi.
Comparing Jitsi with mediasoup is like comparing Netflix (backend + apps) with Express.js + libcurl.
Jitsi developers may replace their RTC core internals (including the SFU) with mediasoup + mediasoup-client and you wouldn't even realize of it. Hope this helps.
https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtc...
> TCP candidate so a TURN server isn't needed at all?
This is not true. A router may still block TCP traffic different than TLS or traffic that does not have destinatiuon port 80 or 443. So ICE TCP candidates do not avoid the need for a TURN server in certain cases.
For example, I could supply the generated udp and tcp candidates in addition to a tcp:443?
What are your thoughts?
https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtc...
YouIf you want to listen in TLS 443 for all clients, add a TURN server into your backend. Just that.
Not doubting you - but I never experienced this limitation with other client/server applications. I have an http server serving over 200k concurrent websockets on port 443, for example.
I'm happy to help out with this if I can.
I’m replacing a web socket server with a data channel server. If I use mediasoup then I will need to listen over 4 ip4 addresses to support the 200k clients I can currently support on 1 ip address with web sockets. Not a huge deal right now, but if I want to support millions of user it means managing 40 or so ip addresses instead of 1 or 2.
Not knocking mediasoup at all, just now aware of a limitation that sounds like it doesn’t need to exist so seeing if we can do something about it.
Anyway, WebRTC is not just about RTP. In fact, before RTP happens, ICE and DTLS must de done.
It works fine on the same wifi network, but won't connect if one of the devices is using 4G network - is this because the TURN server is not setup? Is it easy to implement that?