the physical world meets the web

121
Maximiliano Firtman @firt the Physical World meets the Web

Upload: maximiliano-firtman

Post on 12-Apr-2017

415 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: The Physical World meets the Web

Maximiliano Firtman @firt

the Physical World meets the Web

Page 2: The Physical World meets the Web

mobile+web developer & trainer

Page 3: The Physical World meets the Web
Page 4: The Physical World meets the Web
Page 5: The Physical World meets the Web
Page 6: The Physical World meets the Web
Page 7: The Physical World meets the Web

Slides, links and tests firt.mobi/talks/physical

Page 8: The Physical World meets the Web

questions

yes, please

QA at the end

Page 9: The Physical World meets the Web

Let’s Start!

Page 10: The Physical World meets the Web

Agenda

1- Mobile and IoT 2- The Physical Web 3- Progressive Web Apps 4- Connecting through Web APIs 5- VR|MR Worlds and the Web

Page 11: The Physical World meets the Web

1- Mobile and IoT

Page 12: The Physical World meets the Web
Page 13: The Physical World meets the Web
Page 14: The Physical World meets the Web
Page 15: The Physical World meets the Web
Page 16: The Physical World meets the Web
Page 17: The Physical World meets the Web
Page 18: The Physical World meets the Web
Page 19: The Physical World meets the Web
Page 20: The Physical World meets the Web
Page 21: The Physical World meets the Web

The web comes to save us

Page 22: The Physical World meets the Web

1- Mobile and IoT

- Every gadget, sensor, device will have mobile support - We don’t want to install apps - We don’t want to make everything public

Page 23: The Physical World meets the Web

2- The Physical Web

Page 24: The Physical World meets the Web

The Physical Web is an open approach to enable quick and seamless interactions with physical objects and locations.

Page 25: The Physical World meets the Web

1- Open Spec 2- Beacons BLE 3- Also mDNS over WiFi

Goal: broadcast URLs

Page 26: The Physical World meets the Web

image from physical web website

Eddystone protocol

Page 27: The Physical World meets the Web

1- Buy beacons 2- Install “Beacon Toy” for Android 3- Also mDNS over WiFi

Start broadcasting URLs!

Page 28: The Physical World meets the Web
Page 29: The Physical World meets the Web
Page 30: The Physical World meets the Web

Chrome on Android (49+) Chrome on iOS

Current support

Page 31: The Physical World meets the Web
Page 32: The Physical World meets the Web

Live demo

Page 33: The Physical World meets the Web

2- The Physical Web

- Broadcast URL in physical places - Open standard - Anything can broadcast a URL

Page 34: The Physical World meets the Web

3- Progressive Web Apps

Page 35: The Physical World meets the Web

Progressive Web Apps

1- Open Definition 2- Embraced by Google 3- Followed by Firefox, Opera, Samsung and Microsoft

Page 36: The Physical World meets the Web

A Progressive Web App is a model for creating app-like experiences using latest Web technologies progressively

Page 37: The Physical World meets the Web

Features

1- Instant Loading 2- Discoverable 3- Network independent 4- Responsive 5- Installable

6- Secure 7- Linkable 8- Re-engageable 9- Works everywhere 10- Fast

Page 38: The Physical World meets the Web

progressive enhancement

progressive enhancement

Page 39: The Physical World meets the Web

Progressive Web Apps

1- It’s a website! 2- Adds native installation 3- Adds Web Push Notifications 4- Adds hardware & platform access

Page 40: The Physical World meets the Web

Progressive Web Apps

FUTUREPARTIAL

But they work anyway, anywhere!

Page 41: The Physical World meets the Web

Live demo

Page 42: The Physical World meets the Web

Progressive Web Apps

1- HTML5 2- Service Workers 3- Web App Manifest 4- Web Push Notifications 5- (optionally) Hardware APIs

Page 43: The Physical World meets the Web

3- Progressive Web Apps

- Best of native and web worlds - We can serve app-like experiences - The user can use it from the browser, or install it - Push messages for re-engagement

Page 44: The Physical World meets the Web

4- Web APIs

Page 45: The Physical World meets the Web

Device Sensors Web Audio Web Bluetooth

web apis

Page 46: The Physical World meets the Web

DEVICE SENSORS

1- Mostly useful on mobile devices 2- Use device’s hardware & sensors 3- Different Levels

a- Mature APIs b- Experimental APIs c- Future APIs

Page 47: The Physical World meets the Web

a- Mature APIs

Geolocation (GPS & WiFi) Accelerometer and Magnetometer Compass Camera (still picture)

Page 48: The Physical World meets the Web

Know more about these APIs…

Thursday 14.30 Breaking the Limits of the Web

Page 49: The Physical World meets the Web

b- Experimental APIs

Get User Media Ambient Light Speech Recognition and Synthesis WebMIDI

Page 50: The Physical World meets the Web

Get User Media

Get the stream video from the camera Recognize objects, faces, QR codes Augmented reality

Page 51: The Physical World meets the Web

<code>

navigator.getUserMedia( {video:true,audio:true}, function(stream){ var videoSource = URL.createObjectURL(stream); }, function(){ alert("Error getting video feed"); } );

JAVASCRIPT

Page 52: The Physical World meets the Web

<code>

navigator.getUserMedia( {video:true,audio:true}, function(stream){ var source = URL.createObjectURL(stream); }, function(){ alert("Error getting video feed"); } );

JAVASCRIPT

Page 53: The Physical World meets the Web

Get User Media

Page 54: The Physical World meets the Web

Live demo

Page 55: The Physical World meets the Web

Web Midi

Connect to music devices: synthesizers, keyboards, guitars, drum machines, lightning systems

Send and receive MIDI messages

Page 56: The Physical World meets the Web

<code>

navigator.requestMIDIAccess({sysex: false}) .then(onMIDISuccess, onMIDIFailure);

function onMIDISuccess(midi) { var inputs = midi.inputs.values(); for (var input=…) { input.value.addEventListener(“midimessage”, function(event) { // event.data has the bytes }); } }

JAVASCRIPT

Page 57: The Physical World meets the Web

<code>

navigator.requestMIDIAccess({sysex: false}) .then(onMIDISuccess, onMIDIFailure);

function onMIDISuccess(midi) { var inputs = midi.inputs.values(); for (var input=…) { input.value.addEventListener(“midimessage”, function(event) { // event.data has the bytes }); } }

JAVASCRIPT

Page 58: The Physical World meets the Web

<code>

navigator.requestMIDIAccess({sysex: false}) .then(onMIDISuccess, onMIDIFailure);

function onMIDISuccess(midi) { var inputs = midi.inputs.values(); for (var input=…) { input.value.addEventListener(“midimessage”, function(event) { // event.data has the bytes }); } }

JAVASCRIPT

Page 59: The Physical World meets the Web

<code>

navigator.requestMIDIAccess({sysex: false}) .then(onMIDISuccess, onMIDIFailure);

function onMIDISuccess(midi) { var inputs = midi.inputs.values(); for (var input=…) { input.value.addEventListener(“midimessage”, function(event) { // event.data has the bytes }); } }

JAVASCRIPT

Page 60: The Physical World meets the Web

Web Midi

Page 61: The Physical World meets the Web

Ambient Light

Get info about current light conditions Measures in lux

Page 62: The Physical World meets the Web

<code>

window.addEventListener('devicelight', function(event) { var lux = event.value; });

JAVASCRIPT

Page 63: The Physical World meets the Web

<code>

window.addEventListener('devicelight', function(event) { var lux = event.value; });

JAVASCRIPT

Page 64: The Physical World meets the Web

Live demo

Page 65: The Physical World meets the Web

Ambient Light

FLAG FUTURE

Page 66: The Physical World meets the Web

Speech Synthesis and Recognition

Let us interact with the user with voice Synthesis: let the Web speak Recognition: let the Web listen to user

Page 67: The Physical World meets the Web

<code>var u = new SpeechSynthesisUtterance(); u.rate = 1; u.volume = 1; u.pitch = 1; u.text = “Hello World”; u.lang = “en-GB”;

speechSynthesis.speak(u);

JAVASCRIPT

Page 68: The Physical World meets the Web

<code>var u = new SpeechSynthesisUtterance(); u.rate = 1; u.volume = 1; u.pitch = 1; u.text = “Hello World”; u.lang = “en-GB”;

speechSynthesis.speak(u);

JAVASCRIPT

Page 69: The Physical World meets the Web

<code>var u = new SpeechSynthesisUtterance(); u.rate = 1; u.volume = 1; u.pitch = 1; u.text = “Hello World”; u.lang = “en-GB”;

speechSynthesis.speak(u);

JAVASCRIPT

Page 70: The Physical World meets the Web

<code>recognition = new SpeechRecognition(); recognition.continuous = true; recognition.interimResults = true; recognition.addEventListener(“result”, function(e) { if (e.type==“result") { for (…) { var result = e.results[i][0]; var confidence = result.confidence*100); var text = result.transcript; } } };

JAVASCRIPT

Page 71: The Physical World meets the Web

<code>recognition = new SpeechRecognition(); recognition.continuous = true; recognition.interimResults = true; recognition.addEventListener(“result”, function(e) { if (e.type==“result") { for (…) { var result = e.results[i][0]; var confidence = result.confidence*100); var text = result.transcript; } } };

JAVASCRIPT

Page 72: The Physical World meets the Web

<code>recognition = new SpeechRecognition() recognition.continuous = true; recognition.interimResults = true; recognition.addEventListener(“result”, function(e) { if (e.type==“result") { for (…) { var result = e.results[i][0]; var confidence = result.confidence*100); var text = result.transcript; } } };

JAVASCRIPT

Page 73: The Physical World meets the Web

<code>recognition = new SpeechRecognition() recognition.continuous = true; recognition.interimResults = true; recognition.addEventListener(“result”, function(e) { if (e.type==“result") { for (…) { var result = e.results[i][0]; var confidence = result.confidence*100); var text = result.transcript; } } };

JAVASCRIPT

Page 74: The Physical World meets the Web

<code>recognition = new SpeechRecognition() recognition.continuous = true; recognition.interimResults = true; recognition.addEventListener(“result”, function(e) { if (e.type==“result") { for (…) { var result = e.results[i][0]; var confidence = result.confidence*100); var text = result.transcript; } } };

JAVASCRIPT

Page 75: The Physical World meets the Web

Live demo

Page 76: The Physical World meets the Web

Speech Synthesis

FLAG FUTURE

Page 77: The Physical World meets the Web

Speech Recognition

Page 78: The Physical World meets the Web

c- Future APIs

Geofencing WebUSB WebNFC

Page 79: The Physical World meets the Web

Geofencing

Get a web or PWA activation when user enters or leaves a geo area

Page 80: The Physical World meets the Web

WebUSB

Let us connect with any USB hardware connected to the device

Page 81: The Physical World meets the Web

WebNFC

Near Field Communication Access to Tap to Pay, Tap to Share, etc.

Page 82: The Physical World meets the Web

WEB AUDIO

1- Generate dynamic audio 2- Listens to low level audio 3- Useful for ultrasound communication with devices!

Page 83: The Physical World meets the Web

<code>

// Sending ssocket = new SonicSocket({alphabet: '0123456789'}); ssocket.send(‘31415');

// Receiving sserver = new SonicServer({alphabet: '0123456789'}); sserver.on('message', function(message) { // Expect message to be '31415'. console.log(message); }); sserver.start()

JAVASCRIPT

Using Sonicnet.js library

Page 84: The Physical World meets the Web

<code>

// Sending ssocket = new SonicSocket({alphabet: '0123456789'}); ssocket.send(‘31415');

// Receiving sserver = new SonicServer({alphabet: '0123456789'}); sserver.on('message', function(message) { // Expect message to be '31415'. console.log(message); }); sserver.start()

JAVASCRIPT

Using Sonicnet.js library

Page 85: The Physical World meets the Web

<code>

// Sending ssocket = new SonicSocket({alphabet: '0123456789'}); ssocket.send(‘31415');

// Receiving sserver = new SonicServer({alphabet: '0123456789'}); sserver.on('message', function(message) { // Expect message to be '31415'. console.log(message); }); sserver.start()

JAVASCRIPT

Using Sonicnet.js library

Page 86: The Physical World meets the Web

<code>

// Sending ssocket = new SonicSocket({alphabet: '0123456789'}); ssocket.send(‘31415');

// Receiving sserver = new SonicServer({alphabet: '0123456789'}); sserver.on('message', function(message) { // Expect message to be '31415'. console.log(message); }); sserver.start()

JAVASCRIPT

Using Sonicnet.js library

Page 87: The Physical World meets the Web

<code>

// Sending ssocket = new SonicSocket({alphabet: '0123456789'}); ssocket.send(‘31415');

// Receiving sserver = new SonicServer({alphabet: '0123456789'}); sserver.on('message', function(message) { // Expect message to be '31415'. console.log(message); }); sserver.start()

JAVASCRIPT

Using Sonicnet.js library

Page 88: The Physical World meets the Web

Live demo

Page 89: The Physical World meets the Web

WEB AUDIO

Page 90: The Physical World meets the Web

WEB BLUETOOTH

1- Scan BLE devices 2- Scan services available 3- Connect to these services 4- Send and receive data

Page 91: The Physical World meets the Web

WEB BLUETOOTH

Huge access for IoT Mixed with the Physical Web Better with Bluetooth 5.0

Page 92: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 93: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 94: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 95: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 96: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 97: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 98: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 99: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 100: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }).then(function (device) { return device.gatt.connect(); }).then(function (server) { return server.getPrimaryService(“heart_rate”); }).then(function (service) { return service.getCharacteristic( “heart_rate_control_measurement”); }).then(function (ch) { return ch.startNotifications().then(function() { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });;

JAVASCRIPT

Page 101: The Physical World meets the Web

<code>navigator.bluetooth.requestDevice({ filters: [‘services’: ‘heart_rate’] }) .then(device => { device.gatt.connect() }) .then(server => server.getPrimaryService(“heart_rate”); }) .then(service => service.getCharacteristic( “heart_rate_control_measurement”);}) .then(ch => return ch.startNotifications().then(() => { ch.addEventListener('characteristicvaluechanged', function() { event.target.value }); }); });

JAVASCRIPT

Page 102: The Physical World meets the Web

Heart Rate Sensor Demo

Page 103: The Physical World meets the Web

BB8 Controller

Page 104: The Physical World meets the Web

Drone controller

Page 105: The Physical World meets the Web

Live demo

Page 106: The Physical World meets the Web

WEB BLUETOOTH

FLAG

Page 107: The Physical World meets the Web

4- Web APIs

- Device Sensor APIs: mature, experimental, future - Web Audio - Web Bluetooth - TV Streaming

Page 108: The Physical World meets the Web

5- VR|MR World and the Web

Page 109: The Physical World meets the Web

Virtual Reality Mixed Reality

new worlds

Page 110: The Physical World meets the Web

VR and the Web

Samsung Internet Browser for Gear VR Oculus Web Browser Third party browsers

Page 111: The Physical World meets the Web

Live demo

Page 112: The Physical World meets the Web
Page 113: The Physical World meets the Web

WebVR

Access to VR devices in your browser (Oculus, Cardboard, Vive)

Experimental support Available as a polypill

Page 114: The Physical World meets the Web

WebVR

BUILD DEV FLAG

Page 115: The Physical World meets the Web

WebVR

DEVPOLYFILL POLYFILL

Page 116: The Physical World meets the Web

MR and the Web

Mixed Reality with Windows Holographic Hololens

Page 117: The Physical World meets the Web

Live demo

Page 118: The Physical World meets the Web

MR and the WebWe are in very early stages We need content to get out of the flat hologram

Page 119: The Physical World meets the Web

- We are in early stages - We will need new APIs and concepts - VR and MR mixed with Physical Web and Web Bluetooth

5- VR|MR World and the Web

Page 120: The Physical World meets the Web

the physical world meets the web

1- Mobile and IoT 2- The Physical Web 3- Progressive Web Apps 4- Connecting through Web APIs 5- VR|MR World and the Web

Page 121: The Physical World meets the Web

Foto de freefoto.com

[email protected]@firt

firt.mobi/hpmw firt.mobi/mh5