WebRTC

WebRTC

  • Real Time Communication in the browser
  • Peer to peer (WebRTC is the only P2P technology in web browsers)
  • Intersection of VoIP and Web
  • Released in 2011 by Google as an open-source project
  • It is being worked on by both IETF and W3C (technical standards organizations)

WebRTC

Three main JS APIS

  • MediaStream (Aquiring audio and video)
  • RTCPeerConnection (Does everything.. sets up the connection and sends audio and video, etc)
  • RTCDataChannel (low latency arbitrary data)

Where is it available?

 

 

 

 

 

 

 

 

 

 

  • There are SDK for mobile, PC and embedded systems

History

  • Nov 2011: Chrome releases webRTC
  • Jan 2013: Chrome adds webRTC
  • Feb 2013: Interoperability
  • Sep 2013: Firefox and Chrome add support for the Android versions
  • Mar 2014: Opera and Opera for Android support webRTC
  • Oct 2014: Microsoft announces ORTC (WebRTC 1.1)

MediaStream

RTCPeerConnection does a lot of work

  • Signal Processing
  • Codec Handling
  • Echo cancellation
  • Noise reduction
  • P2P Communication (through firewalls and NATs)
  • Security
  • Bandwidth Management

RTCDataChannel

  • It sends data over an existing PeerConnection
  • The API is similar to webSockets
  • Low latency
  • Unreliable or reliable

General process

Signaling

  • Signaling needs servers
  • Browsers exchange ‘session description’ objects
  • What formats are supported, what to send
  • Network information for peer to peer setup

Signaling

  • Description Protocol format (SDP) looks like this:
v=0
o=- 7614219274584779017 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS
m=audio 1 RTP/SAVPF 111 103 104 0 8 107 106 105 13 126
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=ice-ufrag:W2TGCZw2NZHuwlnf
a=ice-pwd:xdQEccP40E+P0L5qTyzDgfmW
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=mid:audio
a=rtcp-mux
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:9c1AHz27dZ9xPI91YNfSlI67/EMkjHHIHORiClQe
a=rtpmap:111 opus/48000/2
…

Signaling

  • There is no defined protocol to do the signaling on webRTC
  • The decision is left to the developer
  • Options: Ajax, Websockets, DataChannel, SIP or XMPP/Jingle

NAT Traversal

  • NAT devices are used to alleviate IPv4 address exhaustion by allowing the use of private IP addresses on home and corporate networks behind routers with a single public IP address facing the public Internet.
  • The Nat-traversal protocols used by WebRTC are ICE, STUN, and TURN
  • Special servers are needed to set the connection.

NAT Traversal

STUN

  • Tells me what my public IP address is.
  • Simple server, cheap
  • With the information, webRTC can perform NAT hole punching

STUN

 

TURN

  • STUN works around 80% of the time
  • TURN as is used as a fallback media relay
  • Data is sent through the TURN server

TURN

ICE

  • Tries to find the best path for each call
  • It uses STUN if it can
  • ICE uses a technique known as “hole punching”

Resources

  • WebRTC book: http://webrtcbook.com
  • Google demos: https://github.com/googlechrome/webrtc
  • webRTC blog: http://bloggeek.me

DEMO

WebRTC

By elas

WebRTC

This presentation was preceded by the websockets one made by Rodrigo Espinosa Curbelo, here are the slides: https://speakerdeck.com/rec/real-time-web-applications-for-existing-no-nodejs-apps

  • 715