際際滷

際際滷Share a Scribd company logo
Getting Started with WebRTC
Chad Hart, Voxbone
2
ABOUT ME
Head of Strategic Products
https://www.voxbone.com
cwhart@voxbone.com
A blog for WebRTC developers
https://webrtcHacks.com
@webrtcHacks
WebRTC events & videos
https://www.krankygeek.com/
@webrtclive
3
So what is WebRTC?
4
HAVE YOU MADE A CALL WITH ONE OF THESE APPS?
5
IF NO, THEN YOU HAVE DEFINITELY WORKED WITH THESE
6
How did we get here?
7
MEDIA ENGINE
VIDEO CODEC
AUDIO CODEC
WORLD CLASS VOIP ENGINE FOR FREE
8
INTERNET & WEB STANDARD
9
Peer-to-peer
RTC
connectivity
peerConnection
Arbitrary p2p
data
transmission
dataChannel
Stream
Capture
getUserMedia
Camera,
Microphone,
Screen
3(+) WEB-FRIENDLY (/NATIVE) APIS
Statistics
getStats
10
.org
Too many projects to put on a slide
MASSIVE COMMUNITY
11
 2 Billion+ WebRTC Browsers
 1 Billion+ minutes/week
 950+ companies & projects
 5 Billion+ WebRTC app downloads
WEBRTC AFTER 5 YEARS
11
https://groups.google.com/forum/#!topic/discuss-webrtc/I0GqzwfKJfQ
https://docs.google.com/presentation/d/1JwnW6v3OM0RfoDYrPPTJrDNeIpi
dgh7hF_k5E1j2oKM/edit?usp=sharing
GOOGLES 5 YEAR STATS
12
WEBRTC IS WINNING
13
400 million monthly active users
4 years since launch
14
WEBRTC WILL MAKE YOU RICH?
source: http://www.transparencymarketresearch.com/webrtc-market.html
15
THE MATH
source: googlesource: BlogGeek.Me
source: TMR
歎 歎
= =
$901,971 / person $ 11,273,684 / vendor
16
$0Brevenue:
Reality: the largest WebRTC user makes no money from WebRTC. Most
of the largest WebRTC app monetize WebRTC indirectly at best.
17
source: http://www.transparencymarketresearch.com/webrtc-market.html
Reality: Unfortunately WebRTC probably wont make you instantly rich
by itself.
18
YOU NEED TO DO WEBRTC ANYWAY
19
Media negotiation
Firewall/NAT Traversal
Audio codecs
Video codecs
Real-time flow controls
Encryption
WHY WEBRTC?
BETTER TECHNOLOGY
20
WHY WEBRTC?
YOUR USERS DEMAND BETTER EXPERIENCES
21
DONT DEFAULT TO THE SAME OLD USER EXPERIENCE
Source: http://www.publicdomainpictures.net/view-image.php?image=25044&picture=redial
License: CC0 Public Domain
22
Where to start?
23
JavaScript is easy enough to start with
https://webrtc.github.io/samples/
24
MANY GUIDES AND SAMPLES
Blogs Code Videos Forum
webrtcHacks
BlogGeek.Me
blog.mozilla.org/webrtc/
rtcbits.com
codelabs.developers.goo
gle.com/codelabs/webrtc-
web
webrtc.github.io/samples/
webrtc-experiment.com
youtube.com/krankygeek groups.google.com/forum
/#!forum/discuss-webrtc
and so many others
25
Signaling:
WebRTC is not 100% Peer-to-Peer
media
26
Session Description
Protocol (SDP)
WebRTC uses Session
Description Protocol (SDP) to
negotiate media parameters
Source: webrtchacks.com/sdp-anatomy
27
SDP
There is a large continent in the WebRTC
community that thinks SDP is evil. They have
*very slowly* won, so expect more efforts to
move away from SDP.
28
Many ORTC objects are already in WebRTC 1.0
PeerConnection
.getSenders()
.getReceivers()
// Name TBD
.addTransceiver(kind)
.sctp
...
RtpSender
.track
.transport
.getCapabilities()
.getParameters()
.setParameters(params)
.replaceTrack(track)
...
RtpReceiver
.track
.transport
.getCapabilities()
.getContributingSources()
...
DtlsTransport
.transport
.state
.getRemoteCertificates()
.onstatechange
...
IceTransport
.state
.getLocalParameters(),
.getRemoteParameters(),
.getLocalCandidates()
.getRemoteCandidates()
.getSelectedCandidatePair()
.onstatechange
...
SctpTransport
.transport
DataChannel
.transport
RtpParameters
.codecs
.encodings
...
RtpCodecParameters
(read only)
.mimeType
.payloadType
...
RtpEncodingParameters
.active
.maxBandwidth
(read only)
.ssrc
...
IceParameters
(read only)
.usernameFragment
.password
DtlsParameters
...
Source: https://docs.google.com/presentation/d/1oDVgPQtYpQNRkgiP51OQJS1sOW6mjWcGvp129Bovd28
ORTC was originally an alternative WebRTC standard
without SDP but evolved into the future version of
WebRTC. It is already built into mainline WebRTC
standards and more ORTC concepts are coming.
29
SIGNALING
Old-school Way
Often the first and fastest route to
WebRTC for telephony people was to
use SIP over WebSockets. There are
several popular JavaScript SIP stacks
that run in the browser.
30
WHATS BEST FOR YOUR PHONE IS NOT WHATS
BEST FOR YOUR BROWSER
31
WHATS BEST FOR YOUR PHONE IS NOT WHATS
BEST FOR YOUR MOBILE APP

Main concerns: load time, latency,
background behavior, battery
consumption
32
JUST ASK ONE OF THE ORIGINAL SIP AUTHORS
33
SIGNALING
Modern Way
The market has proven that a JSON
signaling approach is both practical
and more effective.
34
Make Your own Server
Simple Socket.IO server:
 Only 32 lines
 No logic, it only forwards
messages
See more of C辿sars talk here: https://youtu.be/HS1eKPL4f1o
In many cases, making your own
signaling server isnt so hard or you
can leverage existing web-oriented
signaling systems.
35
HOW TO GET/USE A SIGNALING SERVER
Ask your
CPaaS provider
Run your own
Use a
messaging
service
All include signaling Write your own in node.js
Matrix.org
EasyRTC
SimpleWebRTC
...
or search github
Firebase
PubNub
Pusher
GCM
36
NAT Traversal
37
A protocol for establishing a peer-to-peer media
connection between peers behind NAT and firewall
devices.
Interactive Connectivity Establishment (ICE)
38
Get A STUN & TURN Server
Run your
own
Use a TURN
service
coturn
restund
Numb
Frozen Mountain
EyeBall Networks
Xirsys
Twilio
Bit6
Video Roaming
39
So WebRTCs perfect?
40
Lets talk about browser support
41
Vendor Google Microsoft Mozilla Microsoft Apple
Browser Chrome Internet Explorer Firefox Edge Safari
Desktop     
Android     
iOS     
WEBRTC BROWSER SUPPORT
42
Apple has been the worst for WebRTC
43
Safari
Other Browser Apps
on iOS
WebView
for iOS
No support for desktop or
mobile
70% of usage on iOS
No support for easy native apps
20% of time share vs. Browser,
Android, Desktop
No one else is allowed to make a
WebRTC Browser on iOS
30% of browser share on iOS
3 WAYS APPLE HURTS WEBRTC
44
Vendor Google Microsoft Mozilla Microsoft Apple
Browser Chrome Internet Explorer Firefox Edge Safari
Desktop 25% 10% 5% 2% 2%
Android 28% 0% 2% 0% 0%
iOS 5% 0% 1% 0% 10%
WEBRTC BROWSER SUPPORT
USAGE SHARE
**Chads rough estimates based on public figures. Others such as Opera and UC browsers excluded (~10%)
Usage patters vary considerably by
application and country. Make sure
you understand what your users are
doing (and can do) before making any
WebRTC decisions.
45
HOW FACEBOOK HANDLES BROWSERS
WITHOUT WEBRTC
This is what happened when I tried to make a Messenger call with Safari when
they first launched the service. Facebook had no issues telling its users to get a
better browser. Do you?
Facebook choose to tell its users to
get a better browser if they tried
calling with Safari.
46
HOW FACEBOOK HANDLES BROWSERS
WITHOUT WEBRTC
They have since hidden the feature on non-WebRTC browsers, but still
recommend using a WebRTC browser.
They have softened a bit and now hide
WebRTC features on non-WebRTC
browsers.
47Image	source:	https://farm3.static.flickr.com/2540/4094662593_5e8e6d917b_b.jpg
So should we give up on Apple?
48
APPLE SUPPORT IS COMING, EVENTUALLY
No one outside of Apple knows
exactly when or how they will
introduce WebRTC, but it is definitely
coming in the not too distant future.
49
CHROME WILL BREAK YOUR IMPLEMENTATION
Chrome likes to move fast and break things. If you dont
move with them they will break you too.
50
Insider Preview
(slow)
Insider Preview
(fast)
TEST EARLY, TEST OFTEN, & FIX THINGS Leverage the Beta, Developer, and initial release versions
that the browser vendors provide to give you 2-6 months
notice on coming browser changes.
51
YEAH, YOU NEED TO BE PREPARED As long as you pay attention and are willing to do
sustaining development, browser change issues are
manageable.
52
DONT IGNORE NATIVE MOBILE APPS
This is a huge topic. No time here, but dont disregard
native mobile. The majority of WebRTC usage is on native
mobile apps  not the web!
53
WEBRTC TO DO LIST
CLIENT
SUPPORT
RTC
Architecture
Front-end Backend-end
Cloud
Environment
Ops
Test &
monitoring
 WebRTC	
Browser	
support
 Non-WebRTC	
Browser	
support
 Native	app	
support
 Peer-peer
 Peer-gateway
 Multi-party
 Mesh
 MCU
 SFU
 Broadcast
 Audio	vs.	video
 Codec	vs.	data
 Screenshare
 Web	vs.	SIP
 UI/UX
 Framework
 Web	servers
 Framework
 DB
 Client	signaling
 Media	
processing
 STUN
 TURN
 Performance
 CPU
 Costs
 Latency
 Bandwidth
 I/O
 VM/Container	
strategy
 Orchestration
 CDN
 DNS/IP	
Addressing
 Infrastructure	
monitoring
 Logging
 Continuous	
Integration
 Call	monitoring
 Load	Test
 Active	Test
 Browser	test
 Device	test
Here is a quick check list of items to consider when
deploying WebRTC.
54
Do you really want to make cheaper phone calls
for the rest of your career?
Me neither!
55
NEW FORMS OF REAL TIME COMMS ARE COMING
Gaming
Virtual Reality
RoboticsReal time streaming
The good news is that WebRTC is a perfect
gateway technology into many new exciting
domains.
Leverage your RTC expertise in new ways!
THANK YOU
@voxbone blog.voxbone.com
www.voxbone.com company/voxbone /voxboneSA/
57
QUIZ TIME
Raspberry Pi 3 Belgian Chocolates
58
1. What is your favorite colour?
2. What are the 2 primary standards bodies for WebRTC?
3. How many RTC subscribers does Facebook have?
4. What are some of the downsides to SIP for client signaling in WebRTC?
5. What is ORTC?
6. What does ICE stand for?
7. What does TURN do?
8. Which Microsoft Browser supports WebRTC?
9. What is the airspeed of an unladen swallow?
10. Do Androids native webview support WebRTC?
QUIZ & QUESTION TIME
THANK YOU
@voxbone blog.voxbone.com
www.voxbone.com company/voxbone /voxboneSA/

More Related Content

Kamailio World 2017: Getting Real with WebRTC

  • 1. Getting Started with WebRTC Chad Hart, Voxbone
  • 2. 2 ABOUT ME Head of Strategic Products https://www.voxbone.com cwhart@voxbone.com A blog for WebRTC developers https://webrtcHacks.com @webrtcHacks WebRTC events & videos https://www.krankygeek.com/ @webrtclive
  • 3. 3 So what is WebRTC?
  • 4. 4 HAVE YOU MADE A CALL WITH ONE OF THESE APPS?
  • 5. 5 IF NO, THEN YOU HAVE DEFINITELY WORKED WITH THESE
  • 6. 6 How did we get here?
  • 7. 7 MEDIA ENGINE VIDEO CODEC AUDIO CODEC WORLD CLASS VOIP ENGINE FOR FREE
  • 8. 8 INTERNET & WEB STANDARD
  • 10. 10 .org Too many projects to put on a slide MASSIVE COMMUNITY
  • 11. 11 2 Billion+ WebRTC Browsers 1 Billion+ minutes/week 950+ companies & projects 5 Billion+ WebRTC app downloads WEBRTC AFTER 5 YEARS 11 https://groups.google.com/forum/#!topic/discuss-webrtc/I0GqzwfKJfQ https://docs.google.com/presentation/d/1JwnW6v3OM0RfoDYrPPTJrDNeIpi dgh7hF_k5E1j2oKM/edit?usp=sharing GOOGLES 5 YEAR STATS
  • 13. 13 400 million monthly active users 4 years since launch
  • 14. 14 WEBRTC WILL MAKE YOU RICH? source: http://www.transparencymarketresearch.com/webrtc-market.html
  • 15. 15 THE MATH source: googlesource: BlogGeek.Me source: TMR 歎 歎 = = $901,971 / person $ 11,273,684 / vendor
  • 16. 16 $0Brevenue: Reality: the largest WebRTC user makes no money from WebRTC. Most of the largest WebRTC app monetize WebRTC indirectly at best.
  • 18. 18 YOU NEED TO DO WEBRTC ANYWAY
  • 19. 19 Media negotiation Firewall/NAT Traversal Audio codecs Video codecs Real-time flow controls Encryption WHY WEBRTC? BETTER TECHNOLOGY
  • 20. 20 WHY WEBRTC? YOUR USERS DEMAND BETTER EXPERIENCES
  • 21. 21 DONT DEFAULT TO THE SAME OLD USER EXPERIENCE Source: http://www.publicdomainpictures.net/view-image.php?image=25044&picture=redial License: CC0 Public Domain
  • 23. 23 JavaScript is easy enough to start with https://webrtc.github.io/samples/
  • 24. 24 MANY GUIDES AND SAMPLES Blogs Code Videos Forum webrtcHacks BlogGeek.Me blog.mozilla.org/webrtc/ rtcbits.com codelabs.developers.goo gle.com/codelabs/webrtc- web webrtc.github.io/samples/ webrtc-experiment.com youtube.com/krankygeek groups.google.com/forum /#!forum/discuss-webrtc and so many others
  • 25. 25 Signaling: WebRTC is not 100% Peer-to-Peer media
  • 26. 26 Session Description Protocol (SDP) WebRTC uses Session Description Protocol (SDP) to negotiate media parameters Source: webrtchacks.com/sdp-anatomy
  • 27. 27 SDP There is a large continent in the WebRTC community that thinks SDP is evil. They have *very slowly* won, so expect more efforts to move away from SDP.
  • 28. 28 Many ORTC objects are already in WebRTC 1.0 PeerConnection .getSenders() .getReceivers() // Name TBD .addTransceiver(kind) .sctp ... RtpSender .track .transport .getCapabilities() .getParameters() .setParameters(params) .replaceTrack(track) ... RtpReceiver .track .transport .getCapabilities() .getContributingSources() ... DtlsTransport .transport .state .getRemoteCertificates() .onstatechange ... IceTransport .state .getLocalParameters(), .getRemoteParameters(), .getLocalCandidates() .getRemoteCandidates() .getSelectedCandidatePair() .onstatechange ... SctpTransport .transport DataChannel .transport RtpParameters .codecs .encodings ... RtpCodecParameters (read only) .mimeType .payloadType ... RtpEncodingParameters .active .maxBandwidth (read only) .ssrc ... IceParameters (read only) .usernameFragment .password DtlsParameters ... Source: https://docs.google.com/presentation/d/1oDVgPQtYpQNRkgiP51OQJS1sOW6mjWcGvp129Bovd28 ORTC was originally an alternative WebRTC standard without SDP but evolved into the future version of WebRTC. It is already built into mainline WebRTC standards and more ORTC concepts are coming.
  • 29. 29 SIGNALING Old-school Way Often the first and fastest route to WebRTC for telephony people was to use SIP over WebSockets. There are several popular JavaScript SIP stacks that run in the browser.
  • 30. 30 WHATS BEST FOR YOUR PHONE IS NOT WHATS BEST FOR YOUR BROWSER
  • 31. 31 WHATS BEST FOR YOUR PHONE IS NOT WHATS BEST FOR YOUR MOBILE APP Main concerns: load time, latency, background behavior, battery consumption
  • 32. 32 JUST ASK ONE OF THE ORIGINAL SIP AUTHORS
  • 33. 33 SIGNALING Modern Way The market has proven that a JSON signaling approach is both practical and more effective.
  • 34. 34 Make Your own Server Simple Socket.IO server: Only 32 lines No logic, it only forwards messages See more of C辿sars talk here: https://youtu.be/HS1eKPL4f1o In many cases, making your own signaling server isnt so hard or you can leverage existing web-oriented signaling systems.
  • 35. 35 HOW TO GET/USE A SIGNALING SERVER Ask your CPaaS provider Run your own Use a messaging service All include signaling Write your own in node.js Matrix.org EasyRTC SimpleWebRTC ... or search github Firebase PubNub Pusher GCM
  • 37. 37 A protocol for establishing a peer-to-peer media connection between peers behind NAT and firewall devices. Interactive Connectivity Establishment (ICE)
  • 38. 38 Get A STUN & TURN Server Run your own Use a TURN service coturn restund Numb Frozen Mountain EyeBall Networks Xirsys Twilio Bit6 Video Roaming
  • 40. 40 Lets talk about browser support
  • 41. 41 Vendor Google Microsoft Mozilla Microsoft Apple Browser Chrome Internet Explorer Firefox Edge Safari Desktop Android iOS WEBRTC BROWSER SUPPORT
  • 42. 42 Apple has been the worst for WebRTC
  • 43. 43 Safari Other Browser Apps on iOS WebView for iOS No support for desktop or mobile 70% of usage on iOS No support for easy native apps 20% of time share vs. Browser, Android, Desktop No one else is allowed to make a WebRTC Browser on iOS 30% of browser share on iOS 3 WAYS APPLE HURTS WEBRTC
  • 44. 44 Vendor Google Microsoft Mozilla Microsoft Apple Browser Chrome Internet Explorer Firefox Edge Safari Desktop 25% 10% 5% 2% 2% Android 28% 0% 2% 0% 0% iOS 5% 0% 1% 0% 10% WEBRTC BROWSER SUPPORT USAGE SHARE **Chads rough estimates based on public figures. Others such as Opera and UC browsers excluded (~10%) Usage patters vary considerably by application and country. Make sure you understand what your users are doing (and can do) before making any WebRTC decisions.
  • 45. 45 HOW FACEBOOK HANDLES BROWSERS WITHOUT WEBRTC This is what happened when I tried to make a Messenger call with Safari when they first launched the service. Facebook had no issues telling its users to get a better browser. Do you? Facebook choose to tell its users to get a better browser if they tried calling with Safari.
  • 46. 46 HOW FACEBOOK HANDLES BROWSERS WITHOUT WEBRTC They have since hidden the feature on non-WebRTC browsers, but still recommend using a WebRTC browser. They have softened a bit and now hide WebRTC features on non-WebRTC browsers.
  • 48. 48 APPLE SUPPORT IS COMING, EVENTUALLY No one outside of Apple knows exactly when or how they will introduce WebRTC, but it is definitely coming in the not too distant future.
  • 49. 49 CHROME WILL BREAK YOUR IMPLEMENTATION Chrome likes to move fast and break things. If you dont move with them they will break you too.
  • 50. 50 Insider Preview (slow) Insider Preview (fast) TEST EARLY, TEST OFTEN, & FIX THINGS Leverage the Beta, Developer, and initial release versions that the browser vendors provide to give you 2-6 months notice on coming browser changes.
  • 51. 51 YEAH, YOU NEED TO BE PREPARED As long as you pay attention and are willing to do sustaining development, browser change issues are manageable.
  • 52. 52 DONT IGNORE NATIVE MOBILE APPS This is a huge topic. No time here, but dont disregard native mobile. The majority of WebRTC usage is on native mobile apps not the web!
  • 53. 53 WEBRTC TO DO LIST CLIENT SUPPORT RTC Architecture Front-end Backend-end Cloud Environment Ops Test & monitoring WebRTC Browser support Non-WebRTC Browser support Native app support Peer-peer Peer-gateway Multi-party Mesh MCU SFU Broadcast Audio vs. video Codec vs. data Screenshare Web vs. SIP UI/UX Framework Web servers Framework DB Client signaling Media processing STUN TURN Performance CPU Costs Latency Bandwidth I/O VM/Container strategy Orchestration CDN DNS/IP Addressing Infrastructure monitoring Logging Continuous Integration Call monitoring Load Test Active Test Browser test Device test Here is a quick check list of items to consider when deploying WebRTC.
  • 54. 54 Do you really want to make cheaper phone calls for the rest of your career? Me neither!
  • 55. 55 NEW FORMS OF REAL TIME COMMS ARE COMING Gaming Virtual Reality RoboticsReal time streaming The good news is that WebRTC is a perfect gateway technology into many new exciting domains. Leverage your RTC expertise in new ways!
  • 57. 57 QUIZ TIME Raspberry Pi 3 Belgian Chocolates
  • 58. 58 1. What is your favorite colour? 2. What are the 2 primary standards bodies for WebRTC? 3. How many RTC subscribers does Facebook have? 4. What are some of the downsides to SIP for client signaling in WebRTC? 5. What is ORTC? 6. What does ICE stand for? 7. What does TURN do? 8. Which Microsoft Browser supports WebRTC? 9. What is the airspeed of an unladen swallow? 10. Do Androids native webview support WebRTC? QUIZ & QUESTION TIME