Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

@cuerbot elcuervo

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

The Past

Slide 9

Slide 9 text

Browsers

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Communication

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

-AJAX

Slide 14

Slide 14 text

-AJAX -WebSockets

Slide 15

Slide 15 text

-AJAX -WebSockets -EventSource

Slide 16

Slide 16 text

and the camera?

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Real Time Communication

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

MediaStreams

Slide 23

Slide 23 text

MediaStreams aka “let’s see that ugly face”

Slide 24

Slide 24 text

MediaStreams PeerConnection aka “let’s see that ugly face”

Slide 25

Slide 25 text

MediaStreams PeerConnection aka “let’s see that ugly face” aka “let them see that ugly face”

Slide 26

Slide 26 text

MediaStreams PeerConnection DataChannels aka “let’s see that ugly face” aka “let them see that ugly face”

Slide 27

Slide 27 text

MediaStreams PeerConnection DataChannels aka “let’s see that ugly face” aka “let them see that ugly face” aka “let’s share Game of Thrones”

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

What is it?

Slide 30

Slide 30 text

What is it? - Camera and/or mic access

Slide 31

Slide 31 text

What is it? - Camera and/or mic access - MediaStreams are synchronized between MediaStreamTracks

Slide 32

Slide 32 text

What is it? - Camera and/or mic access - MediaStreams are synchronized between MediaStreamTracks - Can be played in or elements as objectURL

Slide 33

Slide 33 text

... navigator.getUserMedia({ video: true, audio: true }, function(stream) { });

Slide 34

Slide 34 text

// Shim navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;

Slide 35

Slide 35 text

... navigator.getUserMedia({ video: true, audio: true }, function(stream) { });

Slide 36

Slide 36 text

... function(stream) { window.URL = URL || webkitURL; var blob = URL.createObjectURL(stream); }

Slide 37

Slide 37 text

... var video = document.createElement("video"); video.autoplay = true; video.src = blob; ...

Slide 38

Slide 38 text

DEMO TIME

Slide 39

Slide 39 text

DEMO TIME aka The power of 10:15 gin and tonic

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Available out of the box in:

Slide 42

Slide 42 text

Open Source to the rescue!

Slide 43

Slide 43 text

https://github.com/addyosmani/getUserMedia.js/

Slide 44

Slide 44 text

Available out of the box in: all modern browsers and IE8+.

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Everything based on LATEST implementation of WEBRTC from Google’s repo.

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Available out of the box in:

Slide 49

Slide 49 text

What do we need?

Slide 50

Slide 50 text

-Signaling server XMPP, SIP, HTTP, etc What do we need?

Slide 51

Slide 51 text

-Signaling server XMPP, SIP, HTTP, etc -STUN server (optional) Find route to IP What do we need?

Slide 52

Slide 52 text

// Peer connection shim var PeerConnection = webkitRTCPeerConnection;

Slide 53

Slide 53 text

var out = new PeerConnection(null); out.addStream(stream);

Slide 54

Slide 54 text

client 1 app app client 2

Slide 55

Slide 55 text

client 1 app app HTTP HTTP client 2

Slide 56

Slide 56 text

client 1 app app HTTP Signaling (HTTP, SIP, XMPP, etc) HTTP Signaling (HTTP, SIP, XMPP, etc) client 2

Slide 57

Slide 57 text

client 1 app app HTTP Signaling (HTTP, SIP, XMPP, etc) HTTP Signaling (HTTP, SIP, XMPP, etc) P2P client 2

Slide 58

Slide 58 text

client 2 client 1 app

Slide 59

Slide 59 text

client 2 client 1 app

Slide 60

Slide 60 text

client 2 client 1 app

Slide 61

Slide 61 text

client 2 client 1 app websockets

Slide 62

Slide 62 text

client 2 client 1 app

Slide 63

Slide 63 text

client 2 client 1 navigator.getUserMedia({ video: true, audio: true }, function(stream) { }); app

Slide 64

Slide 64 text

client 2 client 1 out.addStream(stream); out.createOffer( function(session) { out.setLocalDescription( session ); sendOffer(); } ); app

Slide 65

Slide 65 text

client 2 client 1 O app

Slide 66

Slide 66 text

client 2 client 1 O app

Slide 67

Slide 67 text

client 2 client 1 app in.setRemoteDescription(offer); in.createAnswer( function(session) { in.setLocalDescription( session ); sendAnswer(); } );

Slide 68

Slide 68 text

client 2 client 1 A app

Slide 69

Slide 69 text

client 2 client 1 A app

Slide 70

Slide 70 text

client 2 client 1 C1 app

Slide 71

Slide 71 text

client 2 client 1 C1 app

Slide 72

Slide 72 text

client 2 client 1 Cn app

Slide 73

Slide 73 text

client 2 client 1 Cn app

Slide 74

Slide 74 text

client 2 client 1 app P2P

Slide 75

Slide 75 text

client 1 P2P app client 2

Slide 76

Slide 76 text

client 1 P2P app client 2 ✔

Slide 77

Slide 77 text

DEMO TIME

Slide 78

Slide 78 text

DEMO TIME aka The power of beer and friends

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

Recap

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

Local Session Description

Slide 83

Slide 83 text

Local Session Description what is the local configuration?

Slide 84

Slide 84 text

Local Session Description what is the local configuration? Remote Session Description

Slide 85

Slide 85 text

Local Session Description what is the local configuration? Remote Session Description what is the remote configuration?

Slide 86

Slide 86 text

Local Session Description what is the local configuration? Remote Session Description what is the remote configuration? Remote Transport Candidates

Slide 87

Slide 87 text

Local Session Description what is the local configuration? Remote Session Description what is the remote configuration? Remote Transport Candidates how to connect to the remote peer?

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

Low Latency

Slide 92

Slide 92 text

Low Latency aka Fast and Furious

Slide 93

Slide 93 text

Low Latency aka Fast and Furious High Throughput

Slide 94

Slide 94 text

Low Latency aka Fast and Furious High Throughput aka send ALL the messages

Slide 95

Slide 95 text

Low Latency aka Fast and Furious High Throughput aka send ALL the messages Unreliable send

Slide 96

Slide 96 text

Low Latency aka Fast and Furious High Throughput aka send ALL the messages Unreliable send aka possible loss (“Call me maybe”)

Slide 97

Slide 97 text

var channel = out.createDataChannel("chat"); channel.send({...});

Slide 98

Slide 98 text

var fn = function(event) { var message = event.data; ... } in.addEventListener("datachannel", fn);

Slide 99

Slide 99 text

Practical uses

Slide 100

Slide 100 text

No content

Slide 101

Slide 101 text

How can it be done? app client 1 client 2

Slide 102

Slide 102 text

How can it be done? app client 1 client 2

Slide 103

Slide 103 text

How can it be done? app client 1 client 2 P2P + DataChannel

Slide 104

Slide 104 text

No content

Slide 105

Slide 105 text

How can it be done? app client 3 client 4 client 1 client 2

Slide 106

Slide 106 text

How can it be done? app client 3 client 4 client 1 client 2

Slide 107

Slide 107 text

How can it be done? app client 3 client 4 client 1 client 2

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

How can it be done?

Slide 110

Slide 110 text

app How can it be done?

Slide 111

Slide 111 text

app How can it be done?

Slide 112

Slide 112 text

app 40ms How can it be done?

Slide 113

Slide 113 text

app 40ms How can it be done?

Slide 114

Slide 114 text

app 40ms 200ms How can it be done?

Slide 115

Slide 115 text

app 40ms 200ms 30ms How can it be done?

Slide 116

Slide 116 text

app 40ms 200ms 30ms How can it be done?

Slide 117

Slide 117 text

app 40ms 200ms 30ms How can it be done? 50ms

Slide 118

Slide 118 text

How about Ruby?

Slide 119

Slide 119 text

How about Ruby? - No WebRTC implementation available (yet)

Slide 120

Slide 120 text

How about Ruby? - No WebRTC implementation available (yet) - Native C++ API (libjingle)

Slide 121

Slide 121 text

How about Ruby? - No WebRTC implementation available (yet) - Native C++ API (libjingle) - Multiple signaling options (goliath, websocket-rack, rack-stream)

Slide 122

Slide 122 text

How about Ruby? - No WebRTC implementation available (yet) - Native C++ API (libjingle) - Multiple signaling options (goliath, websocket-rack, rack-stream) interested? ping me

Slide 123

Slide 123 text

One more thing

Slide 124

Slide 124 text

No content

Slide 125

Slide 125 text

No content

Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

No content

Slide 128

Slide 128 text

Not Free 28% Partially Free 43% Free 30% Woldwide Internet Freedom http://www.freedomhouse.org/sites/default/files/inline_images/FOTN%202012%20FINAL.pdf

Slide 129

Slide 129 text

How can it be done?

Slide 130

Slide 130 text

No content

Slide 131

Slide 131 text

non-free

Slide 132

Slide 132 text

non-free

Slide 133

Slide 133 text

non-free

Slide 134

Slide 134 text

non-free

Slide 135

Slide 135 text

free non-free

Slide 136

Slide 136 text

free non-free ✔

Slide 137

Slide 137 text

free non-free ✔

Slide 138

Slide 138 text

free non-free non-free ✔

Slide 139

Slide 139 text

free non-free non-free non-free non-free non-free non-free ✔

Slide 140

Slide 140 text

No content

Slide 141

Slide 141 text

You choose the future of the web

Slide 142

Slide 142 text

The storm is coming… are you ready?

Slide 143

Slide 143 text

Thank you

Slide 144

Slide 144 text

Questions?

Slide 145

Slide 145 text

@cuerbot elcuervo