Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
mediasoup
Powerful WebRTC SFU for Node.js
IÑAKI BAZ CASTIL
SOMETHING ABOUT IT
WHAT IS MEDIASOUP?
A WebRTC SFU “Selective Forwarding Unit”
▸Handles the media layer
▸Doesn’t mix audio...
TOPOLOGIE
MULTI-PARTY VIDEO CONFERENCING
TOPOLOGIES
FULL MESH
▸ Each participant sends his audio and
video to all other participants
▸ Each participant receives al...
TOPOLOGIES
MCU: MULTIPOINT
CONTROL UNIT▸ Each participant sends his streams to a media server
▸ The server mixes all the s...
TOPOLOGIES
SFU: SELECTIVE
FORWARDING UNIT▸ Participant sends his streams to a media server
▸ The media server routes the s...
THE MAN IN THE
MOUNTAINS
SIMULCAST / SVC
A MULTI-PARTY FAMILY VIDEOCONFERENCE
Manu
▸At parents’ house
▸Antisystem
▸…but owns an iPhone 6
▸Excellent Wi-Fi connectio...
A MULTI-PARTY FAMILY VIDEOCONFERENCE
THE PROBLEM
▸Roberto has not a good
bandwidth
▸Roberto can not receive HD
video from ...
A MULTI-PARTY FAMILY VIDEOCONFERENCE
POSSIBLE SOLUTIONS
1. Drop Roberto from the conference
2. Limit the video quality of ...
A MULTI-PARTY FAMILY VIDEOCONFERENCE
SOLUTION: SIMULCAST / SVC
▸Manu and Beatriz send
different “quality” video
layers
▸Th...
TOPOLOGIES
FULL MESH MCU SFU
Client uplink Very high Low Low
Client downlink Very high Low High
Client CPU usage Very high...
MEDIASOUP
IS AN SFU
YES!
MEDIASOU
P IS
MINIMALIS
T
MEDIASOUP IS MINIMALIST
WHAT IS *NOT* MEDIASOUP?
▸It is NOT a standalone server
▸It does NOT have “init” scripts for Debia...
MEDIASOUP IS A
NODE.JS MODULE
Yours truly
REMEMBER
SO
WHAT
OK…
$ npm install —save mediasoup
MEDIASOUP & NODE.JS
A NODE.JS MODULE
▸A Node.js module is a dependency/library within a proj...
MEDIASOUP & NODE.JS
A PACKAGE.JSON EXAMPLE
{
"name": "my-amazing-multiconference-server-app",
"version": "1.0.0",
"descrip...
WHY NODE.JS?
ASK THEM
MEDIASOUP
EXPOSES A
JAVASCRIPT
// Load mediasoup module
const mediasoup = require('mediasoup');
// Create a mediasoup Serv...
MEDIASOUP API
LOW LEVEL API
mediasoup exposes a low level API similar to ORTC
// Create a Peer
let peer = room.Peer('alice...
MEDIASOUP API
HIGH LEVEL API
mediasoup also exposes a high level API similar to WebRTC 1.0
// Create a PeerConnection
let ...
MEDIASOUP JUST
FORWARDS MEDIA
REMEMBER
Sincerely yours
MEDIASOUP API
JUST MEDIA
▸mediasoup does NOT talk the SIP protocol
▸…nor it talks ANY signaling protocol
▸You can use sock...
ROADM
AP
MEDIASOUP ROADMAP
WORKING ON IT…
1.0.0
▸RTCP: process RTCP reports to allow mediasoup diagnose
per peer uplink/downlink is...
YOUR TURN
THE
THE APPLICATION
ASK YOURSELF
▸ Want to build yet another boring enterprise
conferencing app?
▸ May be a funny social app?
...
GOING
FORWARD
WEBRTC STATUS IN
BROWSERS
LET’S DEMO !!!
DEMO APPLICATION
FIRSTSIGHT
“See many people, only talk to one”
Backend
▸Node.js server running mediasoup and websocket mo...
MUCHAS GRACIAS
Iñaki Baz Castillo
THE END
http://mediasoup.org
Upcoming SlideShare
Loading in …5
×

voip2day 2016: mediasoup, powerful WebRTC SFU for Node.js

875 views

Published on

My talk at voip2day 2016 (Madrid) about mediasoup.

Published in: Software
  • Be the first to comment

voip2day 2016: mediasoup, powerful WebRTC SFU for Node.js

  1. 1. mediasoup Powerful WebRTC SFU for Node.js IÑAKI BAZ CASTIL
  2. 2. SOMETHING ABOUT IT WHAT IS MEDIASOUP? A WebRTC SFU “Selective Forwarding Unit” ▸Handles the media layer ▸Doesn’t mix audio/video streams A multi-party video solution for Node.js ▸Not a standalone media server ▸A server-side Node.js module ▸JavaScript ES6 API (core written in C++)
  3. 3. TOPOLOGIE MULTI-PARTY VIDEO CONFERENCING
  4. 4. TOPOLOGIES FULL MESH ▸ Each participant sends his audio and video to all other participants ▸ Each participant receives all the streams from all other participants No media server needed Low latency Lot of encodings in each participant High uplink bandwidth required
  5. 5. TOPOLOGIES MCU: MULTIPOINT CONTROL UNIT▸ Each participant sends his streams to a media server ▸ The server mixes all the streams and composes a single one ▸ Example: Asterisk meetme Simple at client side: single audio/video mixed stream from the server Interoperability: the server can transcode Low bandwidth required CPU expensive decoding/encoding in server side (high latency) Non flexible client side applications
  6. 6. TOPOLOGIES SFU: SELECTIVE FORWARDING UNIT▸ Participant sends his streams to a media server ▸ The media server routes the streams to all other participants ▸ Each participant receives many streams High throughput, low latency Low CPU at server side (no decoding/encoding) Good uplink bandwidth usage The client side application can render each remote video stream as desired Simulcast/SVC required for real scenarios
  7. 7. THE MAN IN THE MOUNTAINS SIMULCAST / SVC
  8. 8. A MULTI-PARTY FAMILY VIDEOCONFERENCE Manu ▸At parents’ house ▸Antisystem ▸…but owns an iPhone 6 ▸Excellent Wi-Fi connection Beatriz ▸At home ▸Conservative ▸MacBook Air ▸Excellent Wi-Fi connection Roberto ▸In the mountains ▸Unknown ideology ▸HTC Desire (2010) ▸Poor 3G connection
  9. 9. A MULTI-PARTY FAMILY VIDEOCONFERENCE THE PROBLEM ▸Roberto has not a good bandwidth ▸Roberto can not receive HD video from Manu and Beatriz OUGH !
  10. 10. A MULTI-PARTY FAMILY VIDEOCONFERENCE POSSIBLE SOLUTIONS 1. Drop Roberto from the conference 2. Limit the video quality of Manu and Beatriz 3. …
  11. 11. A MULTI-PARTY FAMILY VIDEOCONFERENCE SOLUTION: SIMULCAST / SVC ▸Manu and Beatriz send different “quality” video layers ▸The SFU chooses the appropriate ones for Roberto
  12. 12. TOPOLOGIES FULL MESH MCU SFU Client uplink Very high Low Low Client downlink Very high Low High Client CPU usage Very high Low Medium Server CPU usage - Very high Very low Latency None High Low Can transcode - Yes No Requires simulcast/SVC - - Yes Flexible video layout Yes No Yes
  13. 13. MEDIASOUP IS AN SFU YES!
  14. 14. MEDIASOU P IS MINIMALIS T
  15. 15. MEDIASOUP IS MINIMALIST WHAT IS *NOT* MEDIASOUP? ▸It is NOT a standalone server ▸It does NOT have “init” scripts for Debian or CentOS ▸It does NOT have a “config” file ▸It does NOT implement the SIP protocol ▸It does NOT implement ANY signaling protocol ▸It does NOT provide an “admin” web interface ▸It does NOT provide a client SDK
  16. 16. MEDIASOUP IS A NODE.JS MODULE Yours truly REMEMBER
  17. 17. SO WHAT OK…
  18. 18. $ npm install —save mediasoup MEDIASOUP & NODE.JS A NODE.JS MODULE ▸A Node.js module is a dependency/library within a project ▸You create your Node.js based project/application ▸You add mediasoup as a module into it
  19. 19. MEDIASOUP & NODE.JS A PACKAGE.JSON EXAMPLE { "name": "my-amazing-multiconference-server-app", "version": "1.0.0", "description": "Enterprise conferencing application", "main": "index.js", "author": "My Great Company", "license": "UNLICENSED", "dependencies": { "express": "^4.14.0", "mediasoup": "^1.0.0", "socket.io": "^1.5.0" } }
  20. 20. WHY NODE.JS? ASK THEM
  21. 21. MEDIASOUP EXPOSES A JAVASCRIPT // Load mediasoup module const mediasoup = require('mediasoup'); // Create a mediasoup Server let server = mediasoup.Server(); // Options for the mediasoup Room const roomOptions = { mediaCodecs: [ { kind : 'audio', name : 'audio/opus', clockRate : 48000 }, { kind : 'video', name : 'video/vp8', clockRate : 90000 } ] }; // Create a mediasoup Room server.createRoom(roomOptions) .then((room) => { // Got the Room instance handleRoom(room); });
  22. 22. MEDIASOUP API LOW LEVEL API mediasoup exposes a low level API similar to ORTC // Create a Peer let peer = room.Peer('alice'); // Create a ICE+DTLS Transport peer.createTransport(options) .then((transport) => { transport.setRemoteDtlsParameters(data); }); // Create a RtpReceiver to handle audio from the browser let audioReceiver = peer.RtpReceiver('audio', transport); // Create a RtpReceiver to handle video from the browser let videoReceiver = peer.RtpReceiver('video', transport);
  23. 23. MEDIASOUP API HIGH LEVEL API mediasoup also exposes a high level API similar to WebRTC 1.0 // Create a PeerConnection let peerconnection = new mediasoup.webrtc.RTCPeerConnection(room, 'alice'); // Set the remote SDP offer peerconnection.setRemoteDescription(desc) .then(() => { return peerconnection.createAnswer(); }) .then((desc) => { return peerconnection.setLocalDescription(desc); }) .then(() => { // Answer the participant request with the SDP answer request.accept({ sdp: peerconnection.localDescription.sdp }); });
  24. 24. MEDIASOUP JUST FORWARDS MEDIA REMEMBER Sincerely yours
  25. 25. MEDIASOUP API JUST MEDIA ▸mediasoup does NOT talk the SIP protocol ▸…nor it talks ANY signaling protocol ▸You can use socket.io (for example) to communicate with browsers/endpoints via WebSocket ▸…or build your own protocol
  26. 26. ROADM AP
  27. 27. MEDIASOUP ROADMAP WORKING ON IT… 1.0.0 ▸RTCP: process RTCP reports to allow mediasoup diagnose per peer uplink/downlink issues ▸WebRTC 1.0: more API needed 2.0.0 ▸Simulcast & SVC: handle multiple streams/layers from clients and select which one to route to others
  28. 28. YOUR TURN THE
  29. 29. THE APPLICATION ASK YOURSELF ▸ Want to build yet another boring enterprise conferencing app? ▸ May be a funny social app? ▸ Will you build the app on Node.js? ▸ Browser app? mobile app? native Android/iOS SDKs? ▸ Do you need interoperability with PSTN? Really?
  30. 30. GOING FORWARD WEBRTC STATUS IN BROWSERS
  31. 31. LET’S DEMO !!!
  32. 32. DEMO APPLICATION FIRSTSIGHT “See many people, only talk to one” Backend ▸Node.js server running mediasoup and websocket modules ▸JS logic to handle media rooms and manage participants Frontend ▸HTML5 application made with React.js ▸JS logic to handle MediaStream from room participants
  33. 33. MUCHAS GRACIAS Iñaki Baz Castillo THE END http://mediasoup.org

×