SlideShare una empresa de Scribd logo
1 de 35
Introduction to WebRTC
ART MATSAK, GRUVEO
JANUARY 2016
Imagine If…
• You could add HD video calling to your web app using simple
JavaScript APIs
• Your users could make calls right in the browser, no plugins
• Peer-to-peer
• Industry-standard end-to-end encryption for all calls
• Sending arbitrary data, too
Too good to be true?
© 2016 GRUVEO 2
Try It Right Now
1. Go to www.gruveo.com
2. Enter “test123” for the code
3. Hit “Video call”
4. Go to Gruveo on another
device or browser tab, and
do the same
5. Enjoy your conversation 
© 2016 GRUVEO 3
What Is WebRTC?
• Real-Time Communications for the Web
• A free, open project hosted at webrtc.org
• Provides RTC capabilities for browsers and
apps via simple APIs
• Idea born in the Google Chrome team in 2009
• Acquired On2 in 2010 and Global IP Solutions
(Gips) in 2011
• Gips technology open-sourced in mid-2011 to
give start to WebRTC
© 2016 GRUVEO 4
How Simple Is It?
Initialization of a WebRTC call in a nutshell:
var pc = new RTCPeerConnection();
navigator.getUserMedia({video: true}, function(stream) {
pc.addStream(stream);
pc.createOffer(function(offer) {
pc.setLocalDescription(new RTCSessionDescription(offer),
function() {
// Send the offer to a signaling server to be forwarded to the peer.
}, errorCb);
}, errorCb);
});
© 2016 GRUVEO 5
WebRTC Connection Diagram
signaling server
audio / video
STUN/TURN server
WebRTC signaling
NAT traversal
audio / video
(if relayed)
© 2016 GRUVEO 6
A Tale of Two APIs
• navigator.getUserMedia() (gUM)
• Prompts the user to use a video and/or audio device (camera,
screensharing, microphone…)
• Produces a MediaStream with one or more MediaStreamTrack’s
• RTCPeerConnection
• Represents a WebRTC peer-to-peer connection
• Handles bi-directional streaming of media as well as data
• Usually has one or more MediaStream’s attached
© 2016 GRUVEO 7
navigator.getUserMedia(): Accessing
User’s Media Devices
Example - prompt to use the camera and show its feed in a <video> element:
navigator.getUserMedia({ audio: true, video: { width: 1280, height: 720 } },
function(stream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(stream);
video.onloadedmetadata = function(e) {
video.play();
};
},
function(err) {
console.log("The following error occurred: " + err.name);
}
);
© 2016 GRUVEO 8
getUserMedia(): User Experience
• UX is different browser to browser
• HTTPS now required for cross-browser
compatibility!
Requires
HTTPS
Device selection
in dialog
Remembers
permissions
Chrome Yes No Yes
Firefox No Yes No
Opera No Yes HTTPS only
© 2016 GRUVEO 9
getUserMedia(): Constraints
• A MediaStreamConstraints object
• Specifies the types of media to request + any requirements for each type
• Examples:
{ audio: true, video: { width: 1280, height: 720 } }
{
audio: true,
video: { width: { min: 1024, ideal: 1280, max: 1920 },
height: { min: 776, ideal: 720, max: 1080 } }
}
{ audio: true, video: { facingMode: "user" } }
{ audio: true, video: false }
navigator.getUserMedia(constraints, successCb, errorCb)
© 2016 GRUVEO 10
getUserMedia(): Constraints – Screen
Sharing
• To enable screen sharing, user has to:
• Install an add-on for your service / domain (Chrome)
• White-list your domain in browser preferences (Firefox)
• Installation of a Chrome add-on only serves as an explicit
confirmation that the user allows screen sharing on your domain
• Then, screen sharing is as easy as passing this video constraint:
• { video: { mandatory: { chromeMediaSource: "screen" } } } // Chrome
• { video: { mediaSource: "screen" } } // Firefox
navigator.getUserMedia(constraints, successCb, errorCb)
© 2016 GRUVEO 11
getUserMedia(): Success Callback
• Called if user grants access to media device(s)
• Gets passed a MediaStream object containing one or more
MediaStreamTrack’s (audio / video)
• A MediaStream can be attached to a <video> or <audio>
element…
• ...or to an RTCPeerConnection object to be sent to the other
peer
navigator.getUserMedia(constraints, successCb, errorCb)
© 2016 GRUVEO 12
getUserMedia(): Error Callback
• Called if something went wrong, for example:
• User denied access to media devices
• Device (e.g. video camera) not found
• Attempting to call navigator.getUserMedia() on an HTTP page
(Chrome)
• Gets passed an object / string with more information about the
error
navigator.getUserMedia(constraints, successCb, errorCb)
© 2016 GRUVEO 13
RTCPeerConnection: P2P Connection
Between Clients
signaling server
audio / video
STUN/TURN server
WebRTC signaling
NAT traversal
audio / video
(if relayed)
© 2016 GRUVEO 14
RTCPeerConnection: Connection
Establishment, or “Offer-Answer Dance”
Create offer
Set description as local
Send description to callee Set description as remote
Create answer
Set description as local
Send description to callerSet description as remote
A’s session description
B’s session description
Peer A (caller) Peer B (callee)
A’s description
B’s description
© 2016 GRUVEO 15
RTCPeerConnection: Key Methods
• RTCPeerConnection(configuration, constraints) – constructor, returns a
new RTCPeerConnection object
• .addStream(mediaStream) – attaches a MediaStream as a local audio /
video source
• .createOffer(successCb, errorCb, constraints) – creates offer session
description that gets passed to successCb
• .createAnswer(successCb, errorCb, constraints) – creates answer
session description, passed to successCb
• .setLocalDescription(description, successCb, errorCb) – sets description
as local session description
• .setRemoteDescription(description, successCb, errorCb) – sets
description as remote session description
© 2016 GRUVEO 16
RTCPeerConnection: Session Description
Protocol (SDP)
• Used for negotiating session capabilities between peers
• Session description includes information about media streams,
media codecs and their parameters, and more
• Example of audio lines in a session description:
...
m=audio 54278 RTP/SAVPF 111 103 104 0 8 106 105 13 126
c=IN IP4 180.6.6.6
a=rtcp:54278 IN IP4 180.6.6.6
...
• Multi-line text format allows for mangling when necessary, e.g. to
prioritize one codec over another
© 2016 GRUVEO 17
RTCPeerConnection: Signaling
• How do peers exchange session descriptions etc. before the
P2P connection is established? – Via a signaling server!
• Signaling is intentionally left to implementation by WebRTC
• Any of these would work:
• Long polling
• WebSockets + Socket.IO
• Pigeon post, telegraph, UPS...
• Gruveo uses WebSockets + custom Node.js backend
© 2016 GRUVEO 18
Connection Diagram: Signaling
signaling server
audio / video
STUN/TURN server
WebRTC signaling
NAT traversal
audio / video
(if relayed)
© 2016 GRUVEO 19
RTCPeerConnection: ICE
• Your localhost IP is 127.0.0.1, internal IP may be 192.168.1.100 and
external IP may be 147.232.159.135
• ICE (Interactive Connectivity Establishment) allows for discovering
all those IPs to find a way for the remote peer to reach your host
• Requires STUN (Session Traversal Utilities for NAT) servers
• Think of it as WhatIsMyIP.com for WebRTC
• Good news: There are a lot of free public ones
• A list of STUN servers is passed to the RTCPeerConnection
constructor
© 2016 GRUVEO 20
RTCPeerConnection: ICE Contd.
• Applying local session description initiates ICE candidate gathering
• Think of ICE candidates as IP-port pairs whereby your host is reachable
• An ICE candidate line from a session description:
a=candidate:1853887674 1 udp 1845501695 46.2.2.2 36768 typ srflx raddr
192.168.0.197 rport 36768 generation 0
• Peers exchange ICE candidates via signaling:
pc.onicecandidate() fires
Send candidate to peer pc.addIceCandidate(candidate)
A’s ICE candidate
Peer A Peer B
ICE candidate
© 2016 GRUVEO 21
RTCPeerConnection: TURN
• What if a peer-to-peer connection cannot be established due to
blocked ports etc.?
• You’ll need a relay – WebRTC supports TURN (Traversal Using Relays
around NAT) protocol
• Things to consider when deploying TURN servers:
• Bandwidth charges (AWS is expensive! Azure is, too!)
• Minimizing latency – automatic choosing of a TURN server based on
latency or geographic distance from peers
• A list of TURN servers is also passed to the RTCPeerConnection
constructor
• TURN servers often serve as STUN, too, hence STUN/TURN server
© 2016 GRUVEO 22
Connection Diagram: STUN/TURN
signaling server
audio / video
STUN/TURN server
WebRTC signaling
NAT traversal
audio / video
(if relayed)
© 2016 GRUVEO 23
Not Only Media – WebRTC Data
Channels
• Enable exchange of arbitrary application data between peers
• Think WebSockets, but peer-to-peer
• Customizable delivery properties:
• Reliable or partially reliable delivery of sent messages
• In-order or out-of-order delivery of sent messages
• RTCDataChannel objects, created using
RTCPeerConnection.createDataChannel()
• Some exciting ideas and use cases out there – e.g. Peer5
© 2016 GRUVEO 24
The WebRTC Protocol Stack
• Peer-to-peer connection is established over UDP using ICE, STUN
and TURN
• We can live without a few lost frames; low latency is more important
• DTLS (Datagram Transport Layer Security) is used to secure all data
transfers between peers
• Unlike TLS, DTLS can be used over UDP
• Encryption is WebRTC’s mandatory feature
• SRTP (Secure Real-Time Protocol) is used to transport audio and
video streams
• SCTP (Stream Control Transport Protocol) is used to transport
application data
© 2016 GRUVEO 25
The WebRTC Protocol Stack Contd.
Network (IP)
ICE, STUN, TURN
Transport (UDP)
SRTP SCTP
Session (DTLS) – mandatory
RTCDataChannelRTCPeerConnection
© 2016 GRUVEO 26
Adapted from High Performance Browser Networking by Ilya Grigorik (O’Reilly, 2013)
WebRTC Media Codecs
• A WebRTC implementation can support any codecs for audio and video, but some
are Mandatory to Implement (MTI)
• For audio, those are Opus and G.711
• Opus is free, provides excellent quality at majority of bitrates
• G.711 is a “granddaddy” included for compatibility with legacy systems
• For video, VP8 and H.264 are MTI
• H.264 is the industry standard, hardware encoding and decoding well-supported on
mobile
• VP8 is free but with fewer hardware implementations
• Firefox supports both VP8 and H.264
• Chrome and Opera only support VP8 and now VP9, H.264 is underway
• Why does it matter?
• Software video encoding and decoding on mobile is a performance + battery life hit
© 2016 GRUVEO 27
Where Is WebRTC Supported Today?
• Chrome, Firefox and Opera on desktop
(Windows, Mac OS and Linux) + Android
• That’s right – video calling right from your
mobile browser!
• IE10, IE11 and Safari on desktop through a
plugin – Gruveo supports the Temasys one
• Microsoft Edge supports ORTC
• A standard related to WebRTC
• Interoperability with WebRTC is currently
limited (no video, other issues)
• No browser on iOS currently supports
WebRTC…
• …But you can bake WebRTC into a native app
on desktop, Android and iOS
Desktop Android iOS
Chrome ✔ ✔ ✘
Firefox ✔ ✔ ✘
Opera ✔ ✔ ✘
IE10/IE11 ✔* – –
Safari ✔* – ✘
Microsoft
Edge
✔** – –
Native apps ✔ ✔ ✔
* With a plugin
** ORTC
© 2016 GRUVEO 28
A Closer Look at Mobile
• A WebRTC web application will work in major
Android browsers out of the box
• Native is the only way on iOS. A few choices:
• Build webrtc.org code for iOS
• Not for the faint of heart but doable
• Support for h/w H.264 coding is still in the works
• OpenWebRTC from Ericsson Research
• Supports h/w H.264 coding
• Not as production ready?
• Third-party SDKs like EasyRTC, OpenTok etc.
• On Android, you can also go fully native or leverage
WebRTC in a WebView (v36+)
© 2016 GRUVEO 29
WebRTC – Real-Life Challenges
• Things change and break quickly. Some recent stuff:
• Chrome 47 broke getUserMedia() on HTTP pages in December 2015
• That same month, Firefox 43 stopped supporting an old format of
RTCPeerConnection constraints
• Things like this are everyday business in WebRTC Land
• Using a polyfill is a very good idea
• Gruveo uses a variation of adapter.js from Google
• testRTC is a promising service for monitoring your WebRTC
application for problems
© 2016 GRUVEO 30
How to Stay in the Loop
• webrtc.org – The Mothership
• www.w3.org/TR/webrtc/ – The RTCPeerConnection spec
• Google Chrome Developers channel on YouTube – Chrome’s
WebRTC team chimes in with updates here
• BlogGeek.me – All things WebRTC; trends and analysis
• webrtcHacks.com – Technical discussion around WebRTC
• www.webrtc-experiment.com – More WebRTC hacks and code
samples
© 2016 GRUVEO 31
What Will You Do with WebRTC?
The limit is only your imagination:
• Peer5 leverages data channels to provide a serverless P2P CDN
• Tellybean allows TV video calling with WebRTC
• Ziggeo does asynchronous video recording
• Talko powers powered group voice communications for teams
• Acquired by Microsoft / Skype in December 2015
• CrankWheel is one-click screen sharing for enterprises
• …And, of course, Gruveo – the world’s easiest video calls
© 2016 GRUVEO 32
Gruveo
• Agree on a code and talk
• No installs, no registration
• Works on all major platforms
• Launched in 2013, Flash-based
• Switched to WebRTC in 2014
• Got VC backing in 2015
• Exciting use cases in telehealth,
customer support, online tutoring…
© 2016 GRUVEO 33
We Are Hiring!
www.gruveo.com/jobs
Currently looking for:
• Web Developer (Frontend + Backend) – JavaScript, Node.js…
• Mobile Developer – iOS & Android
• Customer Development Specialist – Sales, Product Management
and/or Product Marketing background
© 2016 GRUVEO 34
Thank You
Questions?
Art Matsak
art@gruveo.com
© 2016 GRUVEO 35

Más contenido relacionado

La actualidad más candente

An SFU/MCU integration for heterogeneous environments
An SFU/MCU integration for heterogeneous environmentsAn SFU/MCU integration for heterogeneous environments
An SFU/MCU integration for heterogeneous environmentsGiacomo Vacca
 
BGP on RouterOS7 -Part 1
BGP on RouterOS7 -Part 1BGP on RouterOS7 -Part 1
BGP on RouterOS7 -Part 1GLC Networks
 
Zabbix for Monitoring
Zabbix for MonitoringZabbix for Monitoring
Zabbix for MonitoringGLC Networks
 
Modern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensModern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensJonathan LeBlanc
 
MikroTik Security
MikroTik SecurityMikroTik Security
MikroTik SecurityRofiq Fauzi
 
FreeSWITCH on Docker
FreeSWITCH on DockerFreeSWITCH on Docker
FreeSWITCH on Docker建澄 吳
 
Session initiation-protocol
Session initiation-protocolSession initiation-protocol
Session initiation-protocolSanthosh Somu
 
session initiation protocol - SIP
session initiation protocol - SIPsession initiation protocol - SIP
session initiation protocol - SIPMahmoud Abudaqa
 
Tunnel vs VPN on Mikrotik
Tunnel vs VPN on MikrotikTunnel vs VPN on Mikrotik
Tunnel vs VPN on MikrotikGLC Networks
 
FTP - File Transfer Protocol
FTP - File Transfer ProtocolFTP - File Transfer Protocol
FTP - File Transfer ProtocolPeter R. Egli
 
Telnet & SSH Configuration
Telnet & SSH ConfigurationTelnet & SSH Configuration
Telnet & SSH ConfigurationVinod Gour
 

La actualidad más candente (20)

Intro to WebSockets
Intro to WebSocketsIntro to WebSockets
Intro to WebSockets
 
An SFU/MCU integration for heterogeneous environments
An SFU/MCU integration for heterogeneous environmentsAn SFU/MCU integration for heterogeneous environments
An SFU/MCU integration for heterogeneous environments
 
WebRTC presentation
WebRTC presentationWebRTC presentation
WebRTC presentation
 
Web-Socket
Web-SocketWeb-Socket
Web-Socket
 
Mikrotik firewall filter
Mikrotik firewall filterMikrotik firewall filter
Mikrotik firewall filter
 
BGP on RouterOS7 -Part 1
BGP on RouterOS7 -Part 1BGP on RouterOS7 -Part 1
BGP on RouterOS7 -Part 1
 
Zabbix for Monitoring
Zabbix for MonitoringZabbix for Monitoring
Zabbix for Monitoring
 
Modern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensModern API Security with JSON Web Tokens
Modern API Security with JSON Web Tokens
 
MikroTik Security
MikroTik SecurityMikroTik Security
MikroTik Security
 
Json web token
Json web tokenJson web token
Json web token
 
FreeSWITCH on Docker
FreeSWITCH on DockerFreeSWITCH on Docker
FreeSWITCH on Docker
 
Session initiation-protocol
Session initiation-protocolSession initiation-protocol
Session initiation-protocol
 
session initiation protocol - SIP
session initiation protocol - SIPsession initiation protocol - SIP
session initiation protocol - SIP
 
Tunnel vs VPN on Mikrotik
Tunnel vs VPN on MikrotikTunnel vs VPN on Mikrotik
Tunnel vs VPN on Mikrotik
 
FTP - File Transfer Protocol
FTP - File Transfer ProtocolFTP - File Transfer Protocol
FTP - File Transfer Protocol
 
Introduction to gRPC
Introduction to gRPCIntroduction to gRPC
Introduction to gRPC
 
HTTP Presentation
HTTP Presentation HTTP Presentation
HTTP Presentation
 
gRPC Overview
gRPC OverviewgRPC Overview
gRPC Overview
 
Http Protocol
Http ProtocolHttp Protocol
Http Protocol
 
Telnet & SSH Configuration
Telnet & SSH ConfigurationTelnet & SSH Configuration
Telnet & SSH Configuration
 

Destacado

Server-side WebRTC Infrastructure
Server-side WebRTC InfrastructureServer-side WebRTC Infrastructure
Server-side WebRTC InfrastructureDialogic Inc.
 
Baby Steps: A WebRTC Tutorial
Baby Steps: A WebRTC TutorialBaby Steps: A WebRTC Tutorial
Baby Steps: A WebRTC TutorialTsahi Levent-levi
 
WebRTC Hacks: Lessons Learned
WebRTC Hacks: Lessons LearnedWebRTC Hacks: Lessons Learned
WebRTC Hacks: Lessons LearnedChad Hart
 
WebRTC Paris Meetup @ Google France
WebRTC Paris Meetup @ Google FranceWebRTC Paris Meetup @ Google France
WebRTC Paris Meetup @ Google FranceArnaud BUDKIEWICZ
 
WebRTC for Mobile - Challenges and Solutions
WebRTC for Mobile - Challenges and SolutionsWebRTC for Mobile - Challenges and Solutions
WebRTC for Mobile - Challenges and SolutionsAmir Zmora
 
Software Agents for Internet of Things - at AINL 2014
Software Agents for Internet of Things - at AINL 2014Software Agents for Internet of Things - at AINL 2014
Software Agents for Internet of Things - at AINL 2014Anton Kolonin
 
An Introduction to WebRTC
An Introduction to WebRTCAn Introduction to WebRTC
An Introduction to WebRTCMinJae Kang
 
Conception et développement d’un système d’alerte et notification d’une tou...
Conception et développement  d’un système d’alerte et notification  d’une tou...Conception et développement  d’un système d’alerte et notification  d’une tou...
Conception et développement d’un système d’alerte et notification d’une tou...Bilel Khaled ☁
 
modèle de scoring pour la clientèle
modèle de scoring pour la clientèle modèle de scoring pour la clientèle
modèle de scoring pour la clientèle Oulaya CHOUAY
 
Credit scoring, l'octroi des cartes bancaires
Credit scoring, l'octroi des cartes bancairesCredit scoring, l'octroi des cartes bancaires
Credit scoring, l'octroi des cartes bancairesMarwen Allaguy
 
WebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascriptWebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascriptMichele Di Salvatore
 
A Practical Guide to WebRTC
A Practical Guide to WebRTCA Practical Guide to WebRTC
A Practical Guide to WebRTCvline
 
WebRTC Session Establishment
WebRTC Session EstablishmentWebRTC Session Establishment
WebRTC Session Establishmentjdbaran
 
WebRTC and Telehealth
WebRTC and TelehealthWebRTC and Telehealth
WebRTC and TelehealthArin Sime
 

Destacado (19)

WebRTC in the Real World
WebRTC in the Real WorldWebRTC in the Real World
WebRTC in the Real World
 
Server-side WebRTC Infrastructure
Server-side WebRTC InfrastructureServer-side WebRTC Infrastructure
Server-side WebRTC Infrastructure
 
Python, WebRTC and You
Python, WebRTC and YouPython, WebRTC and You
Python, WebRTC and You
 
Baby Steps: A WebRTC Tutorial
Baby Steps: A WebRTC TutorialBaby Steps: A WebRTC Tutorial
Baby Steps: A WebRTC Tutorial
 
WebRTC Hacks: Lessons Learned
WebRTC Hacks: Lessons LearnedWebRTC Hacks: Lessons Learned
WebRTC Hacks: Lessons Learned
 
WebRTC Paris Meetup @ Google France
WebRTC Paris Meetup @ Google FranceWebRTC Paris Meetup @ Google France
WebRTC Paris Meetup @ Google France
 
WebRTC standards update (Jul 2014)
WebRTC standards update (Jul 2014)WebRTC standards update (Jul 2014)
WebRTC standards update (Jul 2014)
 
WebRTC for Mobile - Challenges and Solutions
WebRTC for Mobile - Challenges and SolutionsWebRTC for Mobile - Challenges and Solutions
WebRTC for Mobile - Challenges and Solutions
 
Software Agents for Internet of Things - at AINL 2014
Software Agents for Internet of Things - at AINL 2014Software Agents for Internet of Things - at AINL 2014
Software Agents for Internet of Things - at AINL 2014
 
An Introduction to WebRTC
An Introduction to WebRTCAn Introduction to WebRTC
An Introduction to WebRTC
 
Software agents
Software agentsSoftware agents
Software agents
 
Conception et développement d’un système d’alerte et notification d’une tou...
Conception et développement  d’un système d’alerte et notification  d’une tou...Conception et développement  d’un système d’alerte et notification  d’une tou...
Conception et développement d’un système d’alerte et notification d’une tou...
 
modèle de scoring pour la clientèle
modèle de scoring pour la clientèle modèle de scoring pour la clientèle
modèle de scoring pour la clientèle
 
Credit scoring, l'octroi des cartes bancaires
Credit scoring, l'octroi des cartes bancairesCredit scoring, l'octroi des cartes bancaires
Credit scoring, l'octroi des cartes bancaires
 
WebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascriptWebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascript
 
A Practical Guide to WebRTC
A Practical Guide to WebRTCA Practical Guide to WebRTC
A Practical Guide to WebRTC
 
WebRTC Session Establishment
WebRTC Session EstablishmentWebRTC Session Establishment
WebRTC Session Establishment
 
WebRTC and Telehealth
WebRTC and TelehealthWebRTC and Telehealth
WebRTC and Telehealth
 
Software agents
Software agentsSoftware agents
Software agents
 

Similar a Introduction to WebRTC

Getting Started with WebRTC
Getting Started with WebRTCGetting Started with WebRTC
Getting Started with WebRTCChad Hart
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTCGiacomo Vacca
 
WebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebWebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebVũ Nguyễn
 
SkyViewer: An in-browser solution to fast video calling
SkyViewer: An in-browser solution to fast video callingSkyViewer: An in-browser solution to fast video calling
SkyViewer: An in-browser solution to fast video callingKaivalya Shah
 
WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationJooinK
 
WebRTC: Bring real-time to the web - Barcamp Saigon 2012
WebRTC: Bring real-time to the web - Barcamp Saigon 2012WebRTC: Bring real-time to the web - Barcamp Saigon 2012
WebRTC: Bring real-time to the web - Barcamp Saigon 2012Oliver N
 
Real Time Communication with WebRTC
Real Time Communication with WebRTCReal Time Communication with WebRTC
Real Time Communication with WebRTCSuresh Balla
 
WebRTC - Is it ready? 2013
WebRTC - Is it ready? 2013WebRTC - Is it ready? 2013
WebRTC - Is it ready? 2013Hank Huang
 
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...Amir Zmora
 
Implementation Lessons using WebRTC in Asterisk
Implementation Lessons using WebRTC in AsteriskImplementation Lessons using WebRTC in Asterisk
Implementation Lessons using WebRTC in AsteriskMoises Silva
 
JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK
 
Using Groovy to empower WebRTC Network Systems
Using Groovy to empower WebRTC Network SystemsUsing Groovy to empower WebRTC Network Systems
Using Groovy to empower WebRTC Network Systemsantonry
 
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0Amir Zmora
 
minor-project-1.ppt
minor-project-1.pptminor-project-1.ppt
minor-project-1.pptthinkonce1
 

Similar a Introduction to WebRTC (20)

Getting Started with WebRTC
Getting Started with WebRTCGetting Started with WebRTC
Getting Started with WebRTC
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC
 
WebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the WebWebRTC - Brings Real-Time to the Web
WebRTC - Brings Real-Time to the Web
 
WebRCT
WebRCTWebRCT
WebRCT
 
SkyViewer: An in-browser solution to fast video calling
SkyViewer: An in-browser solution to fast video callingSkyViewer: An in-browser solution to fast video calling
SkyViewer: An in-browser solution to fast video calling
 
WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computation
 
WebRTC: Bring real-time to the web - Barcamp Saigon 2012
WebRTC: Bring real-time to the web - Barcamp Saigon 2012WebRTC: Bring real-time to the web - Barcamp Saigon 2012
WebRTC: Bring real-time to the web - Barcamp Saigon 2012
 
Real Time Communication with WebRTC
Real Time Communication with WebRTCReal Time Communication with WebRTC
Real Time Communication with WebRTC
 
WebRTC - Is it ready? 2013
WebRTC - Is it ready? 2013WebRTC - Is it ready? 2013
WebRTC - Is it ready? 2013
 
DevCon 5 (December 2013) - WebRTC & WebSockets
DevCon 5 (December 2013) - WebRTC & WebSocketsDevCon 5 (December 2013) - WebRTC & WebSockets
DevCon 5 (December 2013) - WebRTC & WebSockets
 
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
 
Implementation Lessons using WebRTC in Asterisk
Implementation Lessons using WebRTC in AsteriskImplementation Lessons using WebRTC in Asterisk
Implementation Lessons using WebRTC in Asterisk
 
JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013
 
DevCon5 (July 2014) - Acision SDK
DevCon5 (July 2014) - Acision SDKDevCon5 (July 2014) - Acision SDK
DevCon5 (July 2014) - Acision SDK
 
Using Groovy to empower WebRTC Network Systems
Using Groovy to empower WebRTC Network SystemsUsing Groovy to empower WebRTC Network Systems
Using Groovy to empower WebRTC Network Systems
 
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTCKamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
 
Asterisk World (January 2014) - Taking Enterprise Telephony into the Web World
Asterisk World (January 2014) - Taking Enterprise Telephony into the Web WorldAsterisk World (January 2014) - Taking Enterprise Telephony into the Web World
Asterisk World (January 2014) - Taking Enterprise Telephony into the Web World
 
WebRTC
WebRTCWebRTC
WebRTC
 
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
 
minor-project-1.ppt
minor-project-1.pptminor-project-1.ppt
minor-project-1.ppt
 

Último

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Último (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Introduction to WebRTC

  • 1. Introduction to WebRTC ART MATSAK, GRUVEO JANUARY 2016
  • 2. Imagine If… • You could add HD video calling to your web app using simple JavaScript APIs • Your users could make calls right in the browser, no plugins • Peer-to-peer • Industry-standard end-to-end encryption for all calls • Sending arbitrary data, too Too good to be true? © 2016 GRUVEO 2
  • 3. Try It Right Now 1. Go to www.gruveo.com 2. Enter “test123” for the code 3. Hit “Video call” 4. Go to Gruveo on another device or browser tab, and do the same 5. Enjoy your conversation  © 2016 GRUVEO 3
  • 4. What Is WebRTC? • Real-Time Communications for the Web • A free, open project hosted at webrtc.org • Provides RTC capabilities for browsers and apps via simple APIs • Idea born in the Google Chrome team in 2009 • Acquired On2 in 2010 and Global IP Solutions (Gips) in 2011 • Gips technology open-sourced in mid-2011 to give start to WebRTC © 2016 GRUVEO 4
  • 5. How Simple Is It? Initialization of a WebRTC call in a nutshell: var pc = new RTCPeerConnection(); navigator.getUserMedia({video: true}, function(stream) { pc.addStream(stream); pc.createOffer(function(offer) { pc.setLocalDescription(new RTCSessionDescription(offer), function() { // Send the offer to a signaling server to be forwarded to the peer. }, errorCb); }, errorCb); }); © 2016 GRUVEO 5
  • 6. WebRTC Connection Diagram signaling server audio / video STUN/TURN server WebRTC signaling NAT traversal audio / video (if relayed) © 2016 GRUVEO 6
  • 7. A Tale of Two APIs • navigator.getUserMedia() (gUM) • Prompts the user to use a video and/or audio device (camera, screensharing, microphone…) • Produces a MediaStream with one or more MediaStreamTrack’s • RTCPeerConnection • Represents a WebRTC peer-to-peer connection • Handles bi-directional streaming of media as well as data • Usually has one or more MediaStream’s attached © 2016 GRUVEO 7
  • 8. navigator.getUserMedia(): Accessing User’s Media Devices Example - prompt to use the camera and show its feed in a <video> element: navigator.getUserMedia({ audio: true, video: { width: 1280, height: 720 } }, function(stream) { var video = document.querySelector('video'); video.src = window.URL.createObjectURL(stream); video.onloadedmetadata = function(e) { video.play(); }; }, function(err) { console.log("The following error occurred: " + err.name); } ); © 2016 GRUVEO 8
  • 9. getUserMedia(): User Experience • UX is different browser to browser • HTTPS now required for cross-browser compatibility! Requires HTTPS Device selection in dialog Remembers permissions Chrome Yes No Yes Firefox No Yes No Opera No Yes HTTPS only © 2016 GRUVEO 9
  • 10. getUserMedia(): Constraints • A MediaStreamConstraints object • Specifies the types of media to request + any requirements for each type • Examples: { audio: true, video: { width: 1280, height: 720 } } { audio: true, video: { width: { min: 1024, ideal: 1280, max: 1920 }, height: { min: 776, ideal: 720, max: 1080 } } } { audio: true, video: { facingMode: "user" } } { audio: true, video: false } navigator.getUserMedia(constraints, successCb, errorCb) © 2016 GRUVEO 10
  • 11. getUserMedia(): Constraints – Screen Sharing • To enable screen sharing, user has to: • Install an add-on for your service / domain (Chrome) • White-list your domain in browser preferences (Firefox) • Installation of a Chrome add-on only serves as an explicit confirmation that the user allows screen sharing on your domain • Then, screen sharing is as easy as passing this video constraint: • { video: { mandatory: { chromeMediaSource: "screen" } } } // Chrome • { video: { mediaSource: "screen" } } // Firefox navigator.getUserMedia(constraints, successCb, errorCb) © 2016 GRUVEO 11
  • 12. getUserMedia(): Success Callback • Called if user grants access to media device(s) • Gets passed a MediaStream object containing one or more MediaStreamTrack’s (audio / video) • A MediaStream can be attached to a <video> or <audio> element… • ...or to an RTCPeerConnection object to be sent to the other peer navigator.getUserMedia(constraints, successCb, errorCb) © 2016 GRUVEO 12
  • 13. getUserMedia(): Error Callback • Called if something went wrong, for example: • User denied access to media devices • Device (e.g. video camera) not found • Attempting to call navigator.getUserMedia() on an HTTP page (Chrome) • Gets passed an object / string with more information about the error navigator.getUserMedia(constraints, successCb, errorCb) © 2016 GRUVEO 13
  • 14. RTCPeerConnection: P2P Connection Between Clients signaling server audio / video STUN/TURN server WebRTC signaling NAT traversal audio / video (if relayed) © 2016 GRUVEO 14
  • 15. RTCPeerConnection: Connection Establishment, or “Offer-Answer Dance” Create offer Set description as local Send description to callee Set description as remote Create answer Set description as local Send description to callerSet description as remote A’s session description B’s session description Peer A (caller) Peer B (callee) A’s description B’s description © 2016 GRUVEO 15
  • 16. RTCPeerConnection: Key Methods • RTCPeerConnection(configuration, constraints) – constructor, returns a new RTCPeerConnection object • .addStream(mediaStream) – attaches a MediaStream as a local audio / video source • .createOffer(successCb, errorCb, constraints) – creates offer session description that gets passed to successCb • .createAnswer(successCb, errorCb, constraints) – creates answer session description, passed to successCb • .setLocalDescription(description, successCb, errorCb) – sets description as local session description • .setRemoteDescription(description, successCb, errorCb) – sets description as remote session description © 2016 GRUVEO 16
  • 17. RTCPeerConnection: Session Description Protocol (SDP) • Used for negotiating session capabilities between peers • Session description includes information about media streams, media codecs and their parameters, and more • Example of audio lines in a session description: ... m=audio 54278 RTP/SAVPF 111 103 104 0 8 106 105 13 126 c=IN IP4 180.6.6.6 a=rtcp:54278 IN IP4 180.6.6.6 ... • Multi-line text format allows for mangling when necessary, e.g. to prioritize one codec over another © 2016 GRUVEO 17
  • 18. RTCPeerConnection: Signaling • How do peers exchange session descriptions etc. before the P2P connection is established? – Via a signaling server! • Signaling is intentionally left to implementation by WebRTC • Any of these would work: • Long polling • WebSockets + Socket.IO • Pigeon post, telegraph, UPS... • Gruveo uses WebSockets + custom Node.js backend © 2016 GRUVEO 18
  • 19. Connection Diagram: Signaling signaling server audio / video STUN/TURN server WebRTC signaling NAT traversal audio / video (if relayed) © 2016 GRUVEO 19
  • 20. RTCPeerConnection: ICE • Your localhost IP is 127.0.0.1, internal IP may be 192.168.1.100 and external IP may be 147.232.159.135 • ICE (Interactive Connectivity Establishment) allows for discovering all those IPs to find a way for the remote peer to reach your host • Requires STUN (Session Traversal Utilities for NAT) servers • Think of it as WhatIsMyIP.com for WebRTC • Good news: There are a lot of free public ones • A list of STUN servers is passed to the RTCPeerConnection constructor © 2016 GRUVEO 20
  • 21. RTCPeerConnection: ICE Contd. • Applying local session description initiates ICE candidate gathering • Think of ICE candidates as IP-port pairs whereby your host is reachable • An ICE candidate line from a session description: a=candidate:1853887674 1 udp 1845501695 46.2.2.2 36768 typ srflx raddr 192.168.0.197 rport 36768 generation 0 • Peers exchange ICE candidates via signaling: pc.onicecandidate() fires Send candidate to peer pc.addIceCandidate(candidate) A’s ICE candidate Peer A Peer B ICE candidate © 2016 GRUVEO 21
  • 22. RTCPeerConnection: TURN • What if a peer-to-peer connection cannot be established due to blocked ports etc.? • You’ll need a relay – WebRTC supports TURN (Traversal Using Relays around NAT) protocol • Things to consider when deploying TURN servers: • Bandwidth charges (AWS is expensive! Azure is, too!) • Minimizing latency – automatic choosing of a TURN server based on latency or geographic distance from peers • A list of TURN servers is also passed to the RTCPeerConnection constructor • TURN servers often serve as STUN, too, hence STUN/TURN server © 2016 GRUVEO 22
  • 23. Connection Diagram: STUN/TURN signaling server audio / video STUN/TURN server WebRTC signaling NAT traversal audio / video (if relayed) © 2016 GRUVEO 23
  • 24. Not Only Media – WebRTC Data Channels • Enable exchange of arbitrary application data between peers • Think WebSockets, but peer-to-peer • Customizable delivery properties: • Reliable or partially reliable delivery of sent messages • In-order or out-of-order delivery of sent messages • RTCDataChannel objects, created using RTCPeerConnection.createDataChannel() • Some exciting ideas and use cases out there – e.g. Peer5 © 2016 GRUVEO 24
  • 25. The WebRTC Protocol Stack • Peer-to-peer connection is established over UDP using ICE, STUN and TURN • We can live without a few lost frames; low latency is more important • DTLS (Datagram Transport Layer Security) is used to secure all data transfers between peers • Unlike TLS, DTLS can be used over UDP • Encryption is WebRTC’s mandatory feature • SRTP (Secure Real-Time Protocol) is used to transport audio and video streams • SCTP (Stream Control Transport Protocol) is used to transport application data © 2016 GRUVEO 25
  • 26. The WebRTC Protocol Stack Contd. Network (IP) ICE, STUN, TURN Transport (UDP) SRTP SCTP Session (DTLS) – mandatory RTCDataChannelRTCPeerConnection © 2016 GRUVEO 26 Adapted from High Performance Browser Networking by Ilya Grigorik (O’Reilly, 2013)
  • 27. WebRTC Media Codecs • A WebRTC implementation can support any codecs for audio and video, but some are Mandatory to Implement (MTI) • For audio, those are Opus and G.711 • Opus is free, provides excellent quality at majority of bitrates • G.711 is a “granddaddy” included for compatibility with legacy systems • For video, VP8 and H.264 are MTI • H.264 is the industry standard, hardware encoding and decoding well-supported on mobile • VP8 is free but with fewer hardware implementations • Firefox supports both VP8 and H.264 • Chrome and Opera only support VP8 and now VP9, H.264 is underway • Why does it matter? • Software video encoding and decoding on mobile is a performance + battery life hit © 2016 GRUVEO 27
  • 28. Where Is WebRTC Supported Today? • Chrome, Firefox and Opera on desktop (Windows, Mac OS and Linux) + Android • That’s right – video calling right from your mobile browser! • IE10, IE11 and Safari on desktop through a plugin – Gruveo supports the Temasys one • Microsoft Edge supports ORTC • A standard related to WebRTC • Interoperability with WebRTC is currently limited (no video, other issues) • No browser on iOS currently supports WebRTC… • …But you can bake WebRTC into a native app on desktop, Android and iOS Desktop Android iOS Chrome ✔ ✔ ✘ Firefox ✔ ✔ ✘ Opera ✔ ✔ ✘ IE10/IE11 ✔* – – Safari ✔* – ✘ Microsoft Edge ✔** – – Native apps ✔ ✔ ✔ * With a plugin ** ORTC © 2016 GRUVEO 28
  • 29. A Closer Look at Mobile • A WebRTC web application will work in major Android browsers out of the box • Native is the only way on iOS. A few choices: • Build webrtc.org code for iOS • Not for the faint of heart but doable • Support for h/w H.264 coding is still in the works • OpenWebRTC from Ericsson Research • Supports h/w H.264 coding • Not as production ready? • Third-party SDKs like EasyRTC, OpenTok etc. • On Android, you can also go fully native or leverage WebRTC in a WebView (v36+) © 2016 GRUVEO 29
  • 30. WebRTC – Real-Life Challenges • Things change and break quickly. Some recent stuff: • Chrome 47 broke getUserMedia() on HTTP pages in December 2015 • That same month, Firefox 43 stopped supporting an old format of RTCPeerConnection constraints • Things like this are everyday business in WebRTC Land • Using a polyfill is a very good idea • Gruveo uses a variation of adapter.js from Google • testRTC is a promising service for monitoring your WebRTC application for problems © 2016 GRUVEO 30
  • 31. How to Stay in the Loop • webrtc.org – The Mothership • www.w3.org/TR/webrtc/ – The RTCPeerConnection spec • Google Chrome Developers channel on YouTube – Chrome’s WebRTC team chimes in with updates here • BlogGeek.me – All things WebRTC; trends and analysis • webrtcHacks.com – Technical discussion around WebRTC • www.webrtc-experiment.com – More WebRTC hacks and code samples © 2016 GRUVEO 31
  • 32. What Will You Do with WebRTC? The limit is only your imagination: • Peer5 leverages data channels to provide a serverless P2P CDN • Tellybean allows TV video calling with WebRTC • Ziggeo does asynchronous video recording • Talko powers powered group voice communications for teams • Acquired by Microsoft / Skype in December 2015 • CrankWheel is one-click screen sharing for enterprises • …And, of course, Gruveo – the world’s easiest video calls © 2016 GRUVEO 32
  • 33. Gruveo • Agree on a code and talk • No installs, no registration • Works on all major platforms • Launched in 2013, Flash-based • Switched to WebRTC in 2014 • Got VC backing in 2015 • Exciting use cases in telehealth, customer support, online tutoring… © 2016 GRUVEO 33
  • 34. We Are Hiring! www.gruveo.com/jobs Currently looking for: • Web Developer (Frontend + Backend) – JavaScript, Node.js… • Mobile Developer – iOS & Android • Customer Development Specialist – Sales, Product Management and/or Product Marketing background © 2016 GRUVEO 34