SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices ArchitectureIdan Fridman
 
OAuth and STUN, TURN in WebRTC context RFC7635
OAuth and STUN, TURN  in WebRTC context RFC7635OAuth and STUN, TURN  in WebRTC context RFC7635
OAuth and STUN, TURN in WebRTC context RFC7635Mihály Mészáros
 
Understanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage EngineUnderstanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage EngineInfluxData
 
FreeSWITCH on Docker
FreeSWITCH on DockerFreeSWITCH on Docker
FreeSWITCH on Docker建澄 吳
 
Open vSwitch - Stateful Connection Tracking & Stateful NAT
Open vSwitch - Stateful Connection Tracking & Stateful NATOpen vSwitch - Stateful Connection Tracking & Stateful NAT
Open vSwitch - Stateful Connection Tracking & Stateful NATThomas Graf
 
EBPF and Linux Networking
EBPF and Linux NetworkingEBPF and Linux Networking
EBPF and Linux NetworkingPLUMgrid
 
Building your First gRPC Service
Building your First gRPC ServiceBuilding your First gRPC Service
Building your First gRPC ServiceJessie Barnett
 
Introduction to CoAP
Introduction to CoAPIntroduction to CoAP
Introduction to CoAPEMQ
 
Tutorial: Using GoBGP as an IXP connecting router
Tutorial: Using GoBGP as an IXP connecting routerTutorial: Using GoBGP as an IXP connecting router
Tutorial: Using GoBGP as an IXP connecting routerShu Sugimoto
 
SIP transfer with Janus/WebRTC @ OpenSIPS 2022
SIP transfer with Janus/WebRTC @ OpenSIPS 2022SIP transfer with Janus/WebRTC @ OpenSIPS 2022
SIP transfer with Janus/WebRTC @ OpenSIPS 2022Lorenzo Miniero
 
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and KibanaBuilding a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and KibanaMushfekur Rahman
 
Scaling WebRTC applications with Janus
Scaling WebRTC applications with JanusScaling WebRTC applications with Janus
Scaling WebRTC applications with JanusLorenzo Miniero
 
Open stack概要とよくある議論
Open stack概要とよくある議論Open stack概要とよくある議論
Open stack概要とよくある議論shintaro mizuno
 
検証環境をGoBGPで極力仮想化してみた
検証環境をGoBGPで極力仮想化してみた検証環境をGoBGPで極力仮想化してみた
検証環境をGoBGPで極力仮想化してみたToshiya Mabuchi
 
66 pfsense tutorial
66 pfsense tutorial66 pfsense tutorial
66 pfsense tutorialequinonesr
 

Was ist angesagt? (20)

Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
OAuth and STUN, TURN in WebRTC context RFC7635
OAuth and STUN, TURN  in WebRTC context RFC7635OAuth and STUN, TURN  in WebRTC context RFC7635
OAuth and STUN, TURN in WebRTC context RFC7635
 
Understanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage EngineUnderstanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage Engine
 
FreeSWITCH on Docker
FreeSWITCH on DockerFreeSWITCH on Docker
FreeSWITCH on Docker
 
Open vSwitch - Stateful Connection Tracking & Stateful NAT
Open vSwitch - Stateful Connection Tracking & Stateful NATOpen vSwitch - Stateful Connection Tracking & Stateful NAT
Open vSwitch - Stateful Connection Tracking & Stateful NAT
 
EBPF and Linux Networking
EBPF and Linux NetworkingEBPF and Linux Networking
EBPF and Linux Networking
 
Building your First gRPC Service
Building your First gRPC ServiceBuilding your First gRPC Service
Building your First gRPC Service
 
Introduction to CoAP
Introduction to CoAPIntroduction to CoAP
Introduction to CoAP
 
Tutorial: Using GoBGP as an IXP connecting router
Tutorial: Using GoBGP as an IXP connecting routerTutorial: Using GoBGP as an IXP connecting router
Tutorial: Using GoBGP as an IXP connecting router
 
SIP transfer with Janus/WebRTC @ OpenSIPS 2022
SIP transfer with Janus/WebRTC @ OpenSIPS 2022SIP transfer with Janus/WebRTC @ OpenSIPS 2022
SIP transfer with Janus/WebRTC @ OpenSIPS 2022
 
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and KibanaBuilding a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
 
HTTP/3
HTTP/3HTTP/3
HTTP/3
 
AMQP
AMQPAMQP
AMQP
 
HTTP/3 for everyone
HTTP/3 for everyoneHTTP/3 for everyone
HTTP/3 for everyone
 
Scaling WebRTC applications with Janus
Scaling WebRTC applications with JanusScaling WebRTC applications with Janus
Scaling WebRTC applications with Janus
 
Ipfs
IpfsIpfs
Ipfs
 
Open stack概要とよくある議論
Open stack概要とよくある議論Open stack概要とよくある議論
Open stack概要とよくある議論
 
検証環境をGoBGPで極力仮想化してみた
検証環境をGoBGPで極力仮想化してみた検証環境をGoBGPで極力仮想化してみた
検証環境をGoBGPで極力仮想化してみた
 
Amqp Basic
Amqp BasicAmqp Basic
Amqp Basic
 
66 pfsense tutorial
66 pfsense tutorial66 pfsense tutorial
66 pfsense tutorial
 

Andere mochten auch

WebRTC Overview
WebRTC OverviewWebRTC Overview
WebRTC OverviewArin Sime
 
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
 
Introduction To Webrtc
Introduction To WebrtcIntroduction To Webrtc
Introduction To WebrtcKnoldus Inc.
 
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
 

Andere mochten auch (20)

WebRTC Overview
WebRTC OverviewWebRTC Overview
WebRTC Overview
 
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
 
Introduction To Webrtc
Introduction To WebrtcIntroduction To Webrtc
Introduction To Webrtc
 
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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

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