The current state of web on mobile - Have smartphone browsers gotten smarter?

44
State of Mobile Web Have smartphone browsers gotten smarter? Tomomi Imura @girlie_mac Public domain photo from NASA, modifed with https://flic.kr/p/Ea32T by Andrew b

Transcript of The current state of web on mobile - Have smartphone browsers gotten smarter?

Page 1: The current state of web on mobile - Have smartphone browsers gotten smarter?

State of Mobile WebHave smartphone browsers gotten smarter?

Tomomi Imura @girlie_mac

Public domain photo from NASA, modifed with https://flic.kr/p/Ea32T by Andrew b

Page 2: The current state of web on mobile - Have smartphone browsers gotten smarter?

https://flick.kr/p/3fzVnW by Danny Sullivan b

Page 3: The current state of web on mobile - Have smartphone browsers gotten smarter?
Page 4: The current state of web on mobile - Have smartphone browsers gotten smarter?

Mobile Browser Releases 2013 -

Page 5: The current state of web on mobile - Have smartphone browsers gotten smarter?

Chrome Android Constant Releases

Page 6: The current state of web on mobile - Have smartphone browsers gotten smarter?

Chrome: WebKit -> Blink

Page 7: The current state of web on mobile - Have smartphone browsers gotten smarter?

Opera: Presto -> WebKit -> Blink

Page 8: The current state of web on mobile - Have smartphone browsers gotten smarter?

IndexedDB

Page 9: The current state of web on mobile - Have smartphone browsers gotten smarter?

SPDY

Page 10: The current state of web on mobile - Have smartphone browsers gotten smarter?

CSS Flexbox (New Spec)

Page 11: The current state of web on mobile - Have smartphone browsers gotten smarter?

ES: Promises, Object.observe()

Page 12: The current state of web on mobile - Have smartphone browsers gotten smarter?

Flat Icons

Page 13: The current state of web on mobile - Have smartphone browsers gotten smarter?

Mobile Browser Usage Stats

StatCounter Global Stats - Browser Market Share

Page 14: The current state of web on mobile - Have smartphone browsers gotten smarter?

Disrupt App Store

https://flic.kr/p/5r6RYe by Cristiano Betta b

Page 15: The current state of web on mobile - Have smartphone browsers gotten smarter?

Distributing outside of app stores

flappybird.io • 2048

Page 16: The current state of web on mobile - Have smartphone browsers gotten smarter?

Forking (in Doge style)

Flappy Doge • Doge2048

Page 17: The current state of web on mobile - Have smartphone browsers gotten smarter?

and Flappy 2048

Flappy 2048

Page 18: The current state of web on mobile - Have smartphone browsers gotten smarter?

Hardware Access

https://flic.kr/p/54oAAr by James Cridland b

Page 19: The current state of web on mobile - Have smartphone browsers gotten smarter?

HW Access with Device APIs

•  GPS

•  Camera, Video, & Microphone

•  Audio HW

•  Vibration HW

•  Battery

•  NFC

Page 20: The current state of web on mobile - Have smartphone browsers gotten smarter?

Sensors

•  Accelerometer

•  Magnetometer

•  Gyrometer

•  Light

•  Proximity

•  Barometer (Pressure)

Page 21: The current state of web on mobile - Have smartphone browsers gotten smarter?

Watch the demo video at: https://vimeo.com/92208773

Demo: http://girliemac.github.com/sushi-compass

Page 22: The current state of web on mobile - Have smartphone browsers gotten smarter?

Last Year

"CoremobCamera"

Page 23: The current state of web on mobile - Have smartphone browsers gotten smarter?

Project Goals

1.  Showcase the capabilities of the Web platform

2.  Educate Web developers

3.  Help improve browsers

Page 24: The current state of web on mobile - Have smartphone browsers gotten smarter?

Watch the demo video at: http://sdrv.ms/UF55gM

1:18

Page 25: The current state of web on mobile - Have smartphone browsers gotten smarter?

HTML5 APIs

1.  Take a picture via HTML Media Capture

2.  Use FileReader() to return the picture as a object

3.  drawImage() to draw the image object in canvas

4.  getImageData() to get an ImageData object containing a

copy of the pixel data, then alter the pixels

5.  Store the blob locally with IndexedDB

6.  Upload the final photo with XHR2/CORS

Page 26: The current state of web on mobile - Have smartphone browsers gotten smarter?

HTML Media Capture

Taking a photo with using a native camera

<input type="file" accept="image/*">

18 15bl 3 10 6 10

1110

Page 27: The current state of web on mobile - Have smartphone browsers gotten smarter?

File API

Camera returns the photo as a file object

var input = document.querySelector('input[type=file]');

input.addEventListener('change', function() {

var localFile = input.files[0];

var reader = new FileReader();

reader.readAsDataURL(localFile);

reader.onload = function(e){

preview.src = e.target.result;

}

}, false);

Page 28: The current state of web on mobile - Have smartphone browsers gotten smarter?

Canvas

Applying filters to the photo

var c = document.createElement('canvas');

var ctx = this.c.getContext('2d');

ctx.drawImage(imgObj, 0, 0);

var imgData = ctx.getImageData(x, y, w, h);

//...Pixel manipulation ...

ctx.putImageData(imgData, 0, 0);

Page 29: The current state of web on mobile - Have smartphone browsers gotten smarter?

IndexedDB

Storing the photos locally

if(window.indexedDB) {

var req = indexedDB.open('coremobCamera');

req.onsuccess = function(e) {

// async

}

}

Page 30: The current state of web on mobile - Have smartphone browsers gotten smarter?

IndexedDB Support

New in 2014:

•  Android stock browser support

•  Apple announced support for Safari 8

18* 25 15bl 10* 16 10

4.4 8

Page 31: The current state of web on mobile - Have smartphone browsers gotten smarter?

Inspect IndexedDB in Chrome

Page 32: The current state of web on mobile - Have smartphone browsers gotten smarter?

...and now in Aurora too!

https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector

Page 33: The current state of web on mobile - Have smartphone browsers gotten smarter?

XMLHttpRequest Level 2

Sending a photo

var formData = new FormData();

formData.append('photo', blob);

3 5 10

12 15bl

Page 34: The current state of web on mobile - Have smartphone browsers gotten smarter?

Touch Events v.1

Photo Gallery Carousel

el.addEventListener('touchstart',

startHandler, false);

el.addEventListener('touchmove'...);

el.addEventListener('touchend'...);

You probably want to include mouse events too

(mousedown, mousemove, and mouseup).

Page 35: The current state of web on mobile - Have smartphone browsers gotten smarter?

Pointer Events

For any input devices: touch, mouse, pen...

if (typeof window.PointerEvent != 'undefined') {

el.addEventListener('pointerdown',

startHandler, false);

el.addEventListener('pointermove', ...);

el.addEventListener('pointerup', ...);

}

Page 36: The current state of web on mobile - Have smartphone browsers gotten smarter?

Touch vs. Pointer Events

Touch Pointer

Chrome 37 Yes will implement ->

No, they changed mind

Opera 22 Yes No

Firefox 26 Yes No

IE 10 No Yes

IE 11.next Yes Yes

Safari 7 Yes No

Android 4.4 Yes Nocaniuse.com • groups.google.com/a/chromium.org

Page 37: The current state of web on mobile - Have smartphone browsers gotten smarter?
Page 38: The current state of web on mobile - Have smartphone browsers gotten smarter?
Page 39: The current state of web on mobile - Have smartphone browsers gotten smarter?
Page 40: The current state of web on mobile - Have smartphone browsers gotten smarter?

To-do list for the camera app

•  Offline support

•  Before - AppCache was Douchebag™

•  Now - Service Workers

•  Web Components

•  Custom Elements

•  Shadow DOM

•  HTML Templates

•  Imports

Page 41: The current state of web on mobile - Have smartphone browsers gotten smarter?

Keep up to date

https://flic.kr/p/8tuc1u by randomliteraturecouncil b

Page 42: The current state of web on mobile - Have smartphone browsers gotten smarter?

Chromium Dashboard

Page 43: The current state of web on mobile - Have smartphone browsers gotten smarter?

IE Platform Status

Page 44: The current state of web on mobile - Have smartphone browsers gotten smarter?

Thank you <3

Tomomi Imura

•  girliemac.com

•  twitter.com/girlie_mac

•  github.com/girliemac