SlideShare a Scribd company logo
1 of 41
Download to read offline
WEBRTC IN JAVASCRIPT
REAL-TIME COMMUNICATION IN JAVASCRIPT
Introduction to WebRTC
1
WEBRTC IN JAVASCRIPT
IETF (RTCWEB SPECIFICATION)
WebRTC consists of a protocol specification and
a Javascript API specification that, if all are
implemented, will allow communication using
audio, video, and data sent along the most
direct possible path between participants.
2
WEBRTC IN JAVASCRIPT
History and Overview
• Been around since 2011, still in draft status, but it’s used
in production
• Google acquired two companies (On2… video codecs
and GIPS… VoIP calling)
• Wrote a Javascript API for submission to W3C and
called it WebRTC (“Web Real-time Communication”)
3
WEBRTC IN JAVASCRIPT
Why we chose WebRTC…
• The web is moving towards real-time functionality
• People want something native to their browser
• Video and audio calls on the web !== Flash or ActiveX
4
(AND WHY YOU SHOULD TOO)
WEBRTC IN JAVASCRIPT
1. Have media to send (webcam, microphone, etc.)
2. Figure out best way for peers to communicate
3. Determine your media’s format (SDP)
4. Send communication and media information
5. Repeat steps 1 - 4 for other peers
5
WEBRTC IN JAVASCRIPT
1. Have media to send (webcam, microphone, etc.)
2. Figure out best way for peers to communicate
3. Determine your media’s format (SDP)
4. Send communication and media information
5. Repeat steps 1 - 4 for other peers
6
WEBRTC IN JAVASCRIPT
getUserMedia()
• Handles all transport of
video and audio
information from the
hardware to the web
• Each MediaStream
contains multiple
“tracks”
7
navigator.getUserMedia()
WEBRTC IN JAVASCRIPT
getUserMedia()
var constraints = { video: true };
function successCallback(stream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(stream);
}
function errorCallback(error) {
console.log('navigator.getUserMedia error: ', error);
}
navigator.getUserMedia(constraints, successCallback, errorCallback);
8
WEBRTC IN JAVASCRIPT
getUserMedia() constraints
• Intended to control the media stream via a
configuration object
• Controls media type, resolution, frame rate, etc.
• Able to specify specs as either “mandatory” or
“optional”
• Constraints only affect local view of your stream
9
WEBRTC IN JAVASCRIPT
getUserMedia() audio analysis
• Only works for Chrome local audio streams, you can’t
currently analyze remote audio streams
10
// Success callback when requesting audio input stream
function gotStream(stream) {
var audioContext = new webkitAudioContext();
// Create an AudioNode from the stream
var mediaStreamSource = audioContext.createMediaStreamSource(stream);
// Connect it to the destination or any other node for processing!
mediaStreamSource.connect(audioContext.destination);
}
navigator.webkitGetUserMedia({ audio: true }, gotStream);
WEBRTC IN JAVASCRIPT
1. Have media to send (webcam, microphone, etc.)
2. Figure out best way for peers to communicate
3. Determine your media’s format (SDP)
4. Send communication and media information
5. Repeat steps 1 - 4 for other peers
11
WEBRTC IN JAVASCRIPT
TCP & UDP
• UDP (User Datagram Protocol)

Unreliable… fast, and with a low overhead
• TCP (Transmission Control Protocol)

Reliable… slow, and with a high overhead
• HTTP uses TCP for connections, vast majority of web
services use TCP
12
WEBRTC IN JAVASCRIPT
All about dat UDP
• UDP is a better choice for streaming media…
• It’s fast
• You don’t usually need every single packet
• Caveat? You need to know where to send packets.
13
WEBRTC IN JAVASCRIPT
Expectations
14
WEBRTC IN JAVASCRIPT
Reality
15
WEBRTC IN JAVASCRIPT
… ICE BABY? TOO COLD?
But then there’s ICE
16
WEBRTC IN JAVASCRIPT
ICE, ICE Connections…
• ICE is a priority-based protocol for testing connections
between two computers
• ICE calls these possible connection points “candidates”
• Computers send them to each other, test them out, and
choose the best fit
17
WEBRTC IN JAVASCRIPT
STUN
18
WEBRTC IN JAVASCRIPT
TURN
19
WEBRTC IN JAVASCRIPT
ICE Connections
var pc;
pc = new RTCPeerConnection({
'iceServers': [
{ 'url': 'stun:stun.services.mozilla.com' },
{ 'url': 'stun:stun.l.google.com:19302' }
]
});
pc.onicecandidate = function(event) {
if(event.candidate !== null) {
mySocket.send(JSON.stringify({
'ice': event.candidate
}));
}
}
20
WEBRTC IN JAVASCRIPT
Gotchas
• In addition to your signaling system server, you’ll also
need to run your own STUN/TURN server
• ICE checks for local network connections first, so it will
almost always work over a local network
• This doesn’t mean it works over the Internet
• Particularly embarrassing when demoing for a
client…
21
WEBRTC IN JAVASCRIPT 22
WAT.
WEBRTC IN JAVASCRIPT
1. Have media to send (webcam, microphone, etc.)
2. Figure out best way for peers to communicate
3. Determine your media’s format (SDP)
4. Send communication and media information
5. Repeat steps 1 - 4 for other peers
23
WEBRTC IN JAVASCRIPT
SDP
• Two peers on ICE communicate via a spec called SDP
(“Session Description Protocol”) which tell what each
peer is interested in
• Do you want audio? Sure.
• Do you want video? Definitely.
• Breakfast in bed? Every Sunday.
24
WEBRTC IN JAVASCRIPT
SDP (continued)
• SDP also handles codec specifications
• Generally no need to modify an SDP string
• First peer sends an offer, second peer sends an answer
• Both ICE and SDP require a signaling server to set up
the direct connection between peers
25
WEBRTC IN JAVASCRIPT
Let’s analyze an SDP string…
type: offer, sdp: v=0
o=- 581856173060444966 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS 5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901
m=audio 9 RTP/SAVPF 111 103 104 9 0 8 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:JI6Xwt9wq/v5HuY7
a=ice-pwd:eNXo/5Sx1JtHCAciusSzmZzO
a=fingerprint:sha-256 A0:DE:
39:65:10:33:02:44:C8:14:57:62:28:89:D9:45:69:DA:B6:58:44:A8:D8:2A:BC:
46:D3:E0:2B:D1:0D:E4
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10; useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:126 telephone-event/8000
a=maxptime:60
a=ssrc:2786781455 cname:Raffm+GJz1SzeA5+
a=ssrc:2786781455 msid:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901
2c9da2ce-219e-4e89-9ad5-1eaada3d79c8
a=ssrc:2786781455 mslabel:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901
a=ssrc:2786781455 label:2c9da2ce-219e-4e89-9ad5-1eaada3d79c8
m=video 9 RTP/SAVPF 100 116 117 96
26
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:JI6Xwt9wq/v5HuY7
a=ice-pwd:eNXo/5Sx1JtHCAciusSzmZzO
a=fingerprint:sha-256 A0:DE:
39:65:10:33:02:44:C8:14:57:62:28:89:D9:45:69:DA:B6:58:44:A8:D8:2A:BC:
46:D3:E0:2B:D1:0D:E4
a=setup:actpass
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 urn:3gpp:video-orientation
a=sendrecv
a=rtcp-mux
a=rtpmap:100 VP8/90000
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 goog-remb
a=rtpmap:116 red/90000
a=rtpmap:117 ulpfec/90000
a=rtpmap:96 rtx/90000
a=fmtp:96 apt=100
a=ssrc-group:FID 1802804178 3581727714
a=ssrc:1802804178 cname:Raffm+GJz1SzeA5+
a=ssrc:1802804178 msid:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 168833a1-b0f1-439a-
be29-5687f1d8072e
a=ssrc:1802804178 mslabel:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901
a=ssrc:1802804178 label:168833a1-b0f1-439a-be29-5687f1d8072e
a=ssrc:3581727714 cname:Raffm+GJz1SzeA5+
a=ssrc:3581727714 msid:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 168833a1-b0f1-439a-
be29-5687f1d8072e
a=ssrc:3581727714 mslabel:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901
a=ssrc:3581727714 label:168833a1-b0f1-439a-be29-5687f1d8072e
WEBRTC IN JAVASCRIPT 27
WAT.
WEBRTC IN JAVASCRIPT
RTCPeerConnection
pc = new RTCPeerConnection(null);
pc.addStream(localStream);
pc.createOffer(sendingOffer);
function sendingOffer(desc) {
pc.setLocalDescription(desc);
sendAnswer(desc);
}
// When answer received over signaling
function gotAnswer(desc) {
pc.setRemoteDescription(desc);
}
28
WEBRTC IN JAVASCRIPT
Security on WebRTC
29
WEBRTC IN JAVASCRIPT
1. Have media to send (webcam, microphone, etc.)
2. Figure out best way for peers to communicate
3. Determine your media’s format (SDP)
4. Send communication and media information
5. Repeat steps 1 - 4 for other peers
30
WEBRTC IN JAVASCRIPT
HTTP://PASTEBIN.COM/RK9IZITX
Walkthrough
31
WEBRTC IN JAVASCRIPT
Platform Support
• Google Chrome (mostly)
• Chrome for Android (mostly)
• Firefox (kinda)
• Opera (not really)
• Safari & IE (srsly bro?)
• Native Java and Objective-C bindings (about the same as
Chrome)
32
WEBRTC IN JAVASCRIPT
Nerdy Details
• Video codec support: VP8, H264
• Audio codec support: G.711, iLBC, iSAC, OPUS
• Media transport protocol: RTP/RTCP
• Security protocol: SRTP
• NAT traversal: STUN/TURN/ICE
• Signaling: Peer-to-peer, but requires a signaling component
(agnostic) to notify peers of status changes and new messages
33
WEBRTC IN JAVASCRIPT
adapter.js & Temasys
• adapter.js (maintained by Google) is a Javascript shim
made to normalize browser differences
• Minimizes the effects of spec churn from subtleties
• Temasys also makes their own version of adapter.js
which adds a Flash fallback for a poor man’s browsers
34
WEBRTC IN JAVASCRIPT
WebRTC Internals
• God’s gift to WebRTC
developers
• Available at:

chrome://webrtc-internals
• Or programmatically:

myPeerConnection.getStats()
35
WEBRTC IN JAVASCRIPT
Resources
• Getting Started with WebRTC
• Capturing Audio & Video in HTML5
• WebRTC in the Real World
• Google I/O Presentation Video
• HTML5 WebRTC Explained Video
• WebRTC @ MDN
• WebRTC Book
36
WEBRTC IN JAVASCRIPT
TELEMEDICINE PLATFORM USING WEBRTC
About Octovis
37
WEBRTC IN JAVASCRIPT
IOS? API’S? WEARABLES?
We’re Hiring!
38
WEBRTC IN JAVASCRIPT
OCTOTALK.IO
Check out a working demo!
39
WEBRTC IN JAVASCRIPT
CONTACT@OCTOVIS.COM
Interested in getting Octotalk technology
in your company?
40
WEBRTC IN JAVASCRIPT
Thanks.
41
PATRICK CASON
Front-end Engineer & Designer
KENNY HOUSE
Software Engineer

More Related Content

What's hot

WebRTC: A front-end perspective
WebRTC: A front-end perspectiveWebRTC: A front-end perspective
WebRTC: A front-end perspectiveshwetank
 
Implementation Lessons using WebRTC in Asterisk
Implementation Lessons using WebRTC in AsteriskImplementation Lessons using WebRTC in Asterisk
Implementation Lessons using WebRTC in AsteriskMoises Silva
 
WebRTC - a quick introduction
WebRTC - a quick introductionWebRTC - a quick introduction
WebRTC - a quick introductionOlle E Johansson
 
WebRTC overview
WebRTC overviewWebRTC overview
WebRTC overviewRouyun Pan
 
WebRTC Workshop - What is (and isn't WebRTC)
WebRTC Workshop - What is (and isn't WebRTC)WebRTC Workshop - What is (and isn't WebRTC)
WebRTC Workshop - What is (and isn't WebRTC)Oracle
 
Baby Steps: A WebRTC Tutorial
Baby Steps: A WebRTC TutorialBaby Steps: A WebRTC Tutorial
Baby Steps: A WebRTC TutorialTsahi Levent-levi
 
Upperside WebRTC conference - WebRTC intro
Upperside WebRTC conference - WebRTC introUpperside WebRTC conference - WebRTC intro
Upperside WebRTC conference - WebRTC introVictor Pascual Ávila
 
Security and identity management on WebRTC
Security and identity management on WebRTCSecurity and identity management on WebRTC
Security and identity management on WebRTCQuobis
 
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)Victor Pascual Ávila
 
New technical architectures and deployment models for radio production
New technical architectures and deployment models for radio productionNew technical architectures and deployment models for radio production
New technical architectures and deployment models for radio productionRyan Jespersen
 
Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek WebRTC 2015 - What's next for WebRTC?Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek WebRTC 2015 - What's next for WebRTC?Kranky Geek
 
HTM5/CENC par Romain Bouqueau de Gpac Licensing
HTM5/CENC par Romain Bouqueau de Gpac LicensingHTM5/CENC par Romain Bouqueau de Gpac Licensing
HTM5/CENC par Romain Bouqueau de Gpac LicensingJustindwah
 
WebRTC and Janus intro for FOSS Stockholm January 2019
WebRTC and Janus intro for FOSS Stockholm January 2019WebRTC and Janus intro for FOSS Stockholm January 2019
WebRTC and Janus intro for FOSS Stockholm January 2019Olle E Johansson
 
Janus RTP forwarders @ FOSDEM 2020
Janus RTP forwarders @ FOSDEM 2020Janus RTP forwarders @ FOSDEM 2020
Janus RTP forwarders @ FOSDEM 2020Lorenzo Miniero
 
ORTC Library - Introduction
ORTC Library - IntroductionORTC Library - Introduction
ORTC Library - IntroductionErik Lagerway
 

What's hot (20)

WebRTC: A front-end perspective
WebRTC: A front-end perspectiveWebRTC: A front-end perspective
WebRTC: A front-end perspective
 
Implementation Lessons using WebRTC in Asterisk
Implementation Lessons using WebRTC in AsteriskImplementation Lessons using WebRTC in Asterisk
Implementation Lessons using WebRTC in Asterisk
 
WebRTC - a quick introduction
WebRTC - a quick introductionWebRTC - a quick introduction
WebRTC - a quick introduction
 
WebRTC overview
WebRTC overviewWebRTC overview
WebRTC overview
 
WebRTC Workshop - What is (and isn't WebRTC)
WebRTC Workshop - What is (and isn't WebRTC)WebRTC Workshop - What is (and isn't WebRTC)
WebRTC Workshop - What is (and isn't WebRTC)
 
Baby Steps: A WebRTC Tutorial
Baby Steps: A WebRTC TutorialBaby Steps: A WebRTC Tutorial
Baby Steps: A WebRTC Tutorial
 
Upperside WebRTC conference - WebRTC intro
Upperside WebRTC conference - WebRTC introUpperside WebRTC conference - WebRTC intro
Upperside WebRTC conference - WebRTC intro
 
DevCon 5 (December 2013) - WebRTC & WebSockets
DevCon 5 (December 2013) - WebRTC & WebSocketsDevCon 5 (December 2013) - WebRTC & WebSockets
DevCon 5 (December 2013) - WebRTC & WebSockets
 
Security and identity management on WebRTC
Security and identity management on WebRTCSecurity and identity management on WebRTC
Security and identity management on WebRTC
 
WebRTC in the Real World
WebRTC in the Real WorldWebRTC in the Real World
WebRTC in the Real World
 
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
WebRTC and VoIP: bridging the gap (Kamailio world conference 2013)
 
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on KamailioAstricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
 
New technical architectures and deployment models for radio production
New technical architectures and deployment models for radio productionNew technical architectures and deployment models for radio production
New technical architectures and deployment models for radio production
 
Stun turn poc_pilot
Stun turn poc_pilotStun turn poc_pilot
Stun turn poc_pilot
 
Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek WebRTC 2015 - What's next for WebRTC?Kranky Geek WebRTC 2015 - What's next for WebRTC?
Kranky Geek WebRTC 2015 - What's next for WebRTC?
 
HTM5/CENC par Romain Bouqueau de Gpac Licensing
HTM5/CENC par Romain Bouqueau de Gpac LicensingHTM5/CENC par Romain Bouqueau de Gpac Licensing
HTM5/CENC par Romain Bouqueau de Gpac Licensing
 
WebRTC and Janus intro for FOSS Stockholm January 2019
WebRTC and Janus intro for FOSS Stockholm January 2019WebRTC and Janus intro for FOSS Stockholm January 2019
WebRTC and Janus intro for FOSS Stockholm January 2019
 
Janus RTP forwarders @ FOSDEM 2020
Janus RTP forwarders @ FOSDEM 2020Janus RTP forwarders @ FOSDEM 2020
Janus RTP forwarders @ FOSDEM 2020
 
ORTC Library - Introduction
ORTC Library - IntroductionORTC Library - Introduction
ORTC Library - Introduction
 
Webrtc puzzle
Webrtc puzzleWebrtc puzzle
Webrtc puzzle
 

Viewers also liked

Webrt integration by altanai bisht
Webrt integration by altanai bishtWebrt integration by altanai bisht
Webrt integration by altanai bishtALTANAI BISHT
 
From NAT to NAT Traversal
From NAT to NAT TraversalFrom NAT to NAT Traversal
From NAT to NAT TraversalLi-Wei Yao
 
AnyFirewall Engine & Server by Eyeball Networks
AnyFirewall Engine & Server by Eyeball NetworksAnyFirewall Engine & Server by Eyeball Networks
AnyFirewall Engine & Server by Eyeball NetworksEyeball Networks
 
Web rtc 핵심 기술에 대한 이해
Web rtc 핵심 기술에 대한 이해Web rtc 핵심 기술에 대한 이해
Web rtc 핵심 기술에 대한 이해Dahyun Kim
 
Web Real-time Communications
Web Real-time CommunicationsWeb Real-time Communications
Web Real-time CommunicationsAlexei Skachykhin
 
ICE: The ultimate way of beating NAT in SIP
ICE: The ultimate way of beating NAT in SIPICE: The ultimate way of beating NAT in SIP
ICE: The ultimate way of beating NAT in SIPSaúl Ibarra Corretgé
 

Viewers also liked (8)

Webrt integration by altanai bisht
Webrt integration by altanai bishtWebrt integration by altanai bisht
Webrt integration by altanai bisht
 
From NAT to NAT Traversal
From NAT to NAT TraversalFrom NAT to NAT Traversal
From NAT to NAT Traversal
 
2016-09-17 03 Василий Полозов. WebRTC
2016-09-17 03 Василий Полозов. WebRTC2016-09-17 03 Василий Полозов. WebRTC
2016-09-17 03 Василий Полозов. WebRTC
 
Ice
IceIce
Ice
 
AnyFirewall Engine & Server by Eyeball Networks
AnyFirewall Engine & Server by Eyeball NetworksAnyFirewall Engine & Server by Eyeball Networks
AnyFirewall Engine & Server by Eyeball Networks
 
Web rtc 핵심 기술에 대한 이해
Web rtc 핵심 기술에 대한 이해Web rtc 핵심 기술에 대한 이해
Web rtc 핵심 기술에 대한 이해
 
Web Real-time Communications
Web Real-time CommunicationsWeb Real-time Communications
Web Real-time Communications
 
ICE: The ultimate way of beating NAT in SIP
ICE: The ultimate way of beating NAT in SIPICE: The ultimate way of beating NAT in SIP
ICE: The ultimate way of beating NAT in SIP
 

Similar to Introduction to WebRTC

WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationJooinK
 
[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래NAVER D2
 
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationWebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationAmir Zmora
 
Analysis of video quality and end-to-end latency in WebRTC
Analysis of video quality and end-to-end latency in WebRTCAnalysis of video quality and end-to-end latency in WebRTC
Analysis of video quality and end-to-end latency in WebRTCBoni García
 
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...Amir Zmora
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTCGiacomo Vacca
 
.NET Core Today and Tomorrow
.NET Core Today and Tomorrow.NET Core Today and Tomorrow
.NET Core Today and TomorrowJon Galloway
 
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
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE
 
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
 
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...Wojciech Kwiatek
 
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
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE
 
ASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveJon Galloway
 
[Wroclaw #4] WebRTC & security: 101
[Wroclaw #4] WebRTC & security: 101[Wroclaw #4] WebRTC & security: 101
[Wroclaw #4] WebRTC & security: 101OWASP
 

Similar to Introduction to WebRTC (20)

WebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computationWebRTC ... GWT & in-browser computation
WebRTC ... GWT & in-browser computation
 
[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래[1C2]webrtc 개발, 현재와 미래
[1C2]webrtc 개발, 현재와 미래
 
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & ImplementationWebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
 
Web rtc 入門
Web rtc 入門Web rtc 入門
Web rtc 入門
 
Analysis of video quality and end-to-end latency in WebRTC
Analysis of video quality and end-to-end latency in WebRTCAnalysis of video quality and end-to-end latency in WebRTC
Analysis of video quality and end-to-end latency in WebRTC
 
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...
 
DevCon 5 (July 2013) - WebSockets
DevCon 5 (July 2013) - WebSocketsDevCon 5 (July 2013) - WebSockets
DevCon 5 (July 2013) - WebSockets
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC
 
.NET Core Today and Tomorrow
.NET Core Today and Tomorrow.NET Core Today and Tomorrow
.NET Core Today and Tomorrow
 
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...
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
 
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
 
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...
 
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
 
Webrtc in Real world
Webrtc in Real world Webrtc in Real world
Webrtc in Real world
 
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using KurentoFIWARE Global Summit - Real-time Media Stream Processing Using Kurento
FIWARE Global Summit - Real-time Media Stream Processing Using Kurento
 
WebRTC in action
WebRTC in actionWebRTC in action
WebRTC in action
 
WebRTC
WebRTCWebRTC
WebRTC
 
ASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep Dive
 
[Wroclaw #4] WebRTC & security: 101
[Wroclaw #4] WebRTC & security: 101[Wroclaw #4] WebRTC & security: 101
[Wroclaw #4] WebRTC & security: 101
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Recently uploaded (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

Introduction to WebRTC

  • 1. WEBRTC IN JAVASCRIPT REAL-TIME COMMUNICATION IN JAVASCRIPT Introduction to WebRTC 1
  • 2. WEBRTC IN JAVASCRIPT IETF (RTCWEB SPECIFICATION) WebRTC consists of a protocol specification and a Javascript API specification that, if all are implemented, will allow communication using audio, video, and data sent along the most direct possible path between participants. 2
  • 3. WEBRTC IN JAVASCRIPT History and Overview • Been around since 2011, still in draft status, but it’s used in production • Google acquired two companies (On2… video codecs and GIPS… VoIP calling) • Wrote a Javascript API for submission to W3C and called it WebRTC (“Web Real-time Communication”) 3
  • 4. WEBRTC IN JAVASCRIPT Why we chose WebRTC… • The web is moving towards real-time functionality • People want something native to their browser • Video and audio calls on the web !== Flash or ActiveX 4 (AND WHY YOU SHOULD TOO)
  • 5. WEBRTC IN JAVASCRIPT 1. Have media to send (webcam, microphone, etc.) 2. Figure out best way for peers to communicate 3. Determine your media’s format (SDP) 4. Send communication and media information 5. Repeat steps 1 - 4 for other peers 5
  • 6. WEBRTC IN JAVASCRIPT 1. Have media to send (webcam, microphone, etc.) 2. Figure out best way for peers to communicate 3. Determine your media’s format (SDP) 4. Send communication and media information 5. Repeat steps 1 - 4 for other peers 6
  • 7. WEBRTC IN JAVASCRIPT getUserMedia() • Handles all transport of video and audio information from the hardware to the web • Each MediaStream contains multiple “tracks” 7 navigator.getUserMedia()
  • 8. WEBRTC IN JAVASCRIPT getUserMedia() var constraints = { video: true }; function successCallback(stream) { var video = document.querySelector('video'); video.src = window.URL.createObjectURL(stream); } function errorCallback(error) { console.log('navigator.getUserMedia error: ', error); } navigator.getUserMedia(constraints, successCallback, errorCallback); 8
  • 9. WEBRTC IN JAVASCRIPT getUserMedia() constraints • Intended to control the media stream via a configuration object • Controls media type, resolution, frame rate, etc. • Able to specify specs as either “mandatory” or “optional” • Constraints only affect local view of your stream 9
  • 10. WEBRTC IN JAVASCRIPT getUserMedia() audio analysis • Only works for Chrome local audio streams, you can’t currently analyze remote audio streams 10 // Success callback when requesting audio input stream function gotStream(stream) { var audioContext = new webkitAudioContext(); // Create an AudioNode from the stream var mediaStreamSource = audioContext.createMediaStreamSource(stream); // Connect it to the destination or any other node for processing! mediaStreamSource.connect(audioContext.destination); } navigator.webkitGetUserMedia({ audio: true }, gotStream);
  • 11. WEBRTC IN JAVASCRIPT 1. Have media to send (webcam, microphone, etc.) 2. Figure out best way for peers to communicate 3. Determine your media’s format (SDP) 4. Send communication and media information 5. Repeat steps 1 - 4 for other peers 11
  • 12. WEBRTC IN JAVASCRIPT TCP & UDP • UDP (User Datagram Protocol)
 Unreliable… fast, and with a low overhead • TCP (Transmission Control Protocol)
 Reliable… slow, and with a high overhead • HTTP uses TCP for connections, vast majority of web services use TCP 12
  • 13. WEBRTC IN JAVASCRIPT All about dat UDP • UDP is a better choice for streaming media… • It’s fast • You don’t usually need every single packet • Caveat? You need to know where to send packets. 13
  • 16. WEBRTC IN JAVASCRIPT … ICE BABY? TOO COLD? But then there’s ICE 16
  • 17. WEBRTC IN JAVASCRIPT ICE, ICE Connections… • ICE is a priority-based protocol for testing connections between two computers • ICE calls these possible connection points “candidates” • Computers send them to each other, test them out, and choose the best fit 17
  • 20. WEBRTC IN JAVASCRIPT ICE Connections var pc; pc = new RTCPeerConnection({ 'iceServers': [ { 'url': 'stun:stun.services.mozilla.com' }, { 'url': 'stun:stun.l.google.com:19302' } ] }); pc.onicecandidate = function(event) { if(event.candidate !== null) { mySocket.send(JSON.stringify({ 'ice': event.candidate })); } } 20
  • 21. WEBRTC IN JAVASCRIPT Gotchas • In addition to your signaling system server, you’ll also need to run your own STUN/TURN server • ICE checks for local network connections first, so it will almost always work over a local network • This doesn’t mean it works over the Internet • Particularly embarrassing when demoing for a client… 21
  • 23. WEBRTC IN JAVASCRIPT 1. Have media to send (webcam, microphone, etc.) 2. Figure out best way for peers to communicate 3. Determine your media’s format (SDP) 4. Send communication and media information 5. Repeat steps 1 - 4 for other peers 23
  • 24. WEBRTC IN JAVASCRIPT SDP • Two peers on ICE communicate via a spec called SDP (“Session Description Protocol”) which tell what each peer is interested in • Do you want audio? Sure. • Do you want video? Definitely. • Breakfast in bed? Every Sunday. 24
  • 25. WEBRTC IN JAVASCRIPT SDP (continued) • SDP also handles codec specifications • Generally no need to modify an SDP string • First peer sends an offer, second peer sends an answer • Both ICE and SDP require a signaling server to set up the direct connection between peers 25
  • 26. WEBRTC IN JAVASCRIPT Let’s analyze an SDP string… type: offer, sdp: v=0 o=- 581856173060444966 2 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE audio video a=msid-semantic: WMS 5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 m=audio 9 RTP/SAVPF 111 103 104 9 0 8 126 c=IN IP4 0.0.0.0 a=rtcp:9 IN IP4 0.0.0.0 a=ice-ufrag:JI6Xwt9wq/v5HuY7 a=ice-pwd:eNXo/5Sx1JtHCAciusSzmZzO a=fingerprint:sha-256 A0:DE: 39:65:10:33:02:44:C8:14:57:62:28:89:D9:45:69:DA:B6:58:44:A8:D8:2A:BC: 46:D3:E0:2B:D1:0D:E4 a=setup:actpass a=mid:audio a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=sendrecv a=rtcp-mux a=rtpmap:111 opus/48000/2 a=fmtp:111 minptime=10; useinbandfec=1 a=rtpmap:103 ISAC/16000 a=rtpmap:104 ISAC/32000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:126 telephone-event/8000 a=maxptime:60 a=ssrc:2786781455 cname:Raffm+GJz1SzeA5+ a=ssrc:2786781455 msid:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 2c9da2ce-219e-4e89-9ad5-1eaada3d79c8 a=ssrc:2786781455 mslabel:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 a=ssrc:2786781455 label:2c9da2ce-219e-4e89-9ad5-1eaada3d79c8 m=video 9 RTP/SAVPF 100 116 117 96 26 c=IN IP4 0.0.0.0 a=rtcp:9 IN IP4 0.0.0.0 a=ice-ufrag:JI6Xwt9wq/v5HuY7 a=ice-pwd:eNXo/5Sx1JtHCAciusSzmZzO a=fingerprint:sha-256 A0:DE: 39:65:10:33:02:44:C8:14:57:62:28:89:D9:45:69:DA:B6:58:44:A8:D8:2A:BC: 46:D3:E0:2B:D1:0D:E4 a=setup:actpass a=mid:video a=extmap:2 urn:ietf:params:rtp-hdrext:toffset a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=extmap:4 urn:3gpp:video-orientation a=sendrecv a=rtcp-mux a=rtpmap:100 VP8/90000 a=rtcp-fb:100 ccm fir a=rtcp-fb:100 nack a=rtcp-fb:100 nack pli a=rtcp-fb:100 goog-remb a=rtpmap:116 red/90000 a=rtpmap:117 ulpfec/90000 a=rtpmap:96 rtx/90000 a=fmtp:96 apt=100 a=ssrc-group:FID 1802804178 3581727714 a=ssrc:1802804178 cname:Raffm+GJz1SzeA5+ a=ssrc:1802804178 msid:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 168833a1-b0f1-439a- be29-5687f1d8072e a=ssrc:1802804178 mslabel:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 a=ssrc:1802804178 label:168833a1-b0f1-439a-be29-5687f1d8072e a=ssrc:3581727714 cname:Raffm+GJz1SzeA5+ a=ssrc:3581727714 msid:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 168833a1-b0f1-439a- be29-5687f1d8072e a=ssrc:3581727714 mslabel:5BgnHND1rh5IsIJXBGN0EnzD0xoGWD8Hd901 a=ssrc:3581727714 label:168833a1-b0f1-439a-be29-5687f1d8072e
  • 28. WEBRTC IN JAVASCRIPT RTCPeerConnection pc = new RTCPeerConnection(null); pc.addStream(localStream); pc.createOffer(sendingOffer); function sendingOffer(desc) { pc.setLocalDescription(desc); sendAnswer(desc); } // When answer received over signaling function gotAnswer(desc) { pc.setRemoteDescription(desc); } 28
  • 30. WEBRTC IN JAVASCRIPT 1. Have media to send (webcam, microphone, etc.) 2. Figure out best way for peers to communicate 3. Determine your media’s format (SDP) 4. Send communication and media information 5. Repeat steps 1 - 4 for other peers 30
  • 32. WEBRTC IN JAVASCRIPT Platform Support • Google Chrome (mostly) • Chrome for Android (mostly) • Firefox (kinda) • Opera (not really) • Safari & IE (srsly bro?) • Native Java and Objective-C bindings (about the same as Chrome) 32
  • 33. WEBRTC IN JAVASCRIPT Nerdy Details • Video codec support: VP8, H264 • Audio codec support: G.711, iLBC, iSAC, OPUS • Media transport protocol: RTP/RTCP • Security protocol: SRTP • NAT traversal: STUN/TURN/ICE • Signaling: Peer-to-peer, but requires a signaling component (agnostic) to notify peers of status changes and new messages 33
  • 34. WEBRTC IN JAVASCRIPT adapter.js & Temasys • adapter.js (maintained by Google) is a Javascript shim made to normalize browser differences • Minimizes the effects of spec churn from subtleties • Temasys also makes their own version of adapter.js which adds a Flash fallback for a poor man’s browsers 34
  • 35. WEBRTC IN JAVASCRIPT WebRTC Internals • God’s gift to WebRTC developers • Available at:
 chrome://webrtc-internals • Or programmatically:
 myPeerConnection.getStats() 35
  • 36. WEBRTC IN JAVASCRIPT Resources • Getting Started with WebRTC • Capturing Audio & Video in HTML5 • WebRTC in the Real World • Google I/O Presentation Video • HTML5 WebRTC Explained Video • WebRTC @ MDN • WebRTC Book 36
  • 37. WEBRTC IN JAVASCRIPT TELEMEDICINE PLATFORM USING WEBRTC About Octovis 37
  • 38. WEBRTC IN JAVASCRIPT IOS? API’S? WEARABLES? We’re Hiring! 38
  • 39. WEBRTC IN JAVASCRIPT OCTOTALK.IO Check out a working demo! 39
  • 40. WEBRTC IN JAVASCRIPT CONTACT@OCTOVIS.COM Interested in getting Octotalk technology in your company? 40
  • 41. WEBRTC IN JAVASCRIPT Thanks. 41 PATRICK CASON Front-end Engineer & Designer KENNY HOUSE Software Engineer