76
WebRTC & Firefox OS

WebRTC & Firefox OS - presentation at Google

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: WebRTC & Firefox OS - presentation at Google

WebRTC & Firefox OS

Page 2: WebRTC & Firefox OS - presentation at Google
Page 5: WebRTC & Firefox OS - presentation at Google

Mozilla is a global non-profit dedicated to putting you in control of your online experience and shaping the future of the Web for the public good

Page 7: WebRTC & Firefox OS - presentation at Google
Page 8: WebRTC & Firefox OS - presentation at Google

WebRTC

Page 9: WebRTC & Firefox OS - presentation at Google
Page 10: WebRTC & Firefox OS - presentation at Google
Page 11: WebRTC & Firefox OS - presentation at Google
Page 12: WebRTC & Firefox OS - presentation at Google

var video = document.querySelector('video');

navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;

// Call the getUserMedia method with our callback functionsif (navigator.getUserMedia) { navigator.getUserMedia({video: true}, successCallback, errorCallback);} else { console.log('Native web camera streaming (getUserMedia) not supported in this browser.'); // Display a friendly "sorry" message to the user}

Page 13: WebRTC & Firefox OS - presentation at Google

function successCallback(stream) { // Set the source of the video element with the stream from the camera if (video.mozSrcObject !== undefined) { video.mozSrcObject = stream; } else { video.src = (window.URL && window.URL.createObjectURL(stream)) || stream; } video.play();}

Page 16: WebRTC & Firefox OS - presentation at Google
Page 18: WebRTC & Firefox OS - presentation at Google
Page 20: WebRTC & Firefox OS - presentation at Google

Firefox & WebRTC status

Page 21: WebRTC & Firefox OS - presentation at Google

"Fix a lot of bugs and improve quality"

Page 22: WebRTC & Firefox OS - presentation at Google

First implementation in Firefox 22, including DataChannels

TURN support for Desktop in Firefox 23

Audio recording support. We hope to get it landed in Firefox 24

We haven't started working on video recordingDesktop

Page 23: WebRTC & Firefox OS - presentation at Google

Stretch goal of shipping WebRTC (pref'd on) in Firefox 24 -- though Firefox 25 is more likely.

It is already in Firefox 23 for Android, but behind a pref (the same pref that desktop was behind)

Android

Page 24: WebRTC & Firefox OS - presentation at Google

We're starting to get WebRTC functioning on Firefox OS. gUM will come first.

Since Firefox OS doesn't ship on the train system, the initial code for this will likely ship later in the year (sometime after Firefox OS v1.1)

Firefox OS

Page 25: WebRTC & Firefox OS - presentation at Google

Persona/Identity integration

BUNDLE

SDP renegotiation via new offer/answer pair

Statistics API (at least the framework for it)

persistent permissions

support more than 1 audio flow and 1 video flow

Roadmap

Page 26: WebRTC & Firefox OS - presentation at Google

Using HTML5, CSS and JavaScript together with a number of APIs to build apps and customize the UI.

Firefox OS

Page 28: WebRTC & Firefox OS - presentation at Google

Open Web Apps

Page 29: WebRTC & Firefox OS - presentation at Google

Build excellent interfaces!

Page 30: WebRTC & Firefox OS - presentation at Google

Packaged vs. Hosted Apps

Page 31: WebRTC & Firefox OS - presentation at Google

WebAPIs

Page 32: WebRTC & Firefox OS - presentation at Google
Page 33: WebRTC & Firefox OS - presentation at Google

Security Levels

Page 34: WebRTC & Firefox OS - presentation at Google

Web Content

Regular web content

Installed Web App

A regular web app

Privileged Web App

More access, more responsibility

Certified Web App

Device-critical applications

Page 36: WebRTC & Firefox OS - presentation at Google

"permissions": { "contacts": { "description": "Required for autocompletion in the share screen", "access": "readcreate" }, "alarms": { "description": "Required to schedule notifications" }}

Page 38: WebRTC & Firefox OS - presentation at Google

Vibration API (W3C)

Screen Orientation

Geolocation API

Mouse Lock API (W3C)

Open WebApps

Network Information API (W3C)

Battery Status API (W3C)

Alarm API

Web Activities

Push Notifications API

WebFM API

WebPayment

IndexedDB (W3C)

Ambient light sensor

Proximity sensor

Notification

REGULAR APIS

Page 39: WebRTC & Firefox OS - presentation at Google

BATTERY STATUS API

Page 40: WebRTC & Firefox OS - presentation at Google

var battery = navigator.battery;if (battery) { var batteryLevel = Math.round(battery.level * 100) + "%", charging = (battery.charging)? "" : "not ", chargingTime = parseInt(battery.chargingTime / 60, 10), dischargingTime = parseInt(battery.dischargingTime / 60, 10); // Set events battery.addEventListener("levelchange", setStatus, false); battery.addEventListener("chargingchange", setStatus, false); battery.addEventListener("chargingtimechange", setStatus, false); battery.addEventListener("dischargingtimechange", setStatus, false); }

Page 41: WebRTC & Firefox OS - presentation at Google

SCREENORIENTATION API

Page 42: WebRTC & Firefox OS - presentation at Google

// Portrait mode:screen.mozLockOrientation("portrait");

/* Possible values: "landscape" "portrait" "landscape-primary" "landscape-secondary" "portrait-primary" "portrait-secondary"*/

Page 43: WebRTC & Firefox OS - presentation at Google

VIBRATION API

Page 44: WebRTC & Firefox OS - presentation at Google

// Vibrate for one secondnavigator.vibrate(1000);

// Vibration pattern [vibrationTime, pause,…]navigator.vibrate([200, 100, 200, 100]);

// Vibrate for 5 secondsnavigator.vibrate(5000);

// Turn off vibrationnavigator.vibrate(0);

Page 45: WebRTC & Firefox OS - presentation at Google

DEVICEPROXIMITY

Page 46: WebRTC & Firefox OS - presentation at Google

window.addEventListener("deviceproximity", function (event) { // Current device proximity, in centimeters console.log(event.value); // The maximum sensing distance the sensor is // able to report, in centimeters console.log(event.max); // The minimum sensing distance the sensor is // able to report, in centimeters console.log(event.min);});

Page 47: WebRTC & Firefox OS - presentation at Google

AMBIENT LIGHT EVENTS

Page 48: WebRTC & Firefox OS - presentation at Google

window.addEventListener("devicelight", function (event) { // The lux values for "dim" typically begin below 50, // and the values for "bright" begin above 10000 console.log(event.value);});

Page 49: WebRTC & Firefox OS - presentation at Google

Device Storage API

Browser API

TCP Socket API

Contacts API

systemXHR

PRIVILEGED APIS

Page 50: WebRTC & Firefox OS - presentation at Google

DEVICE STORAGE API

Page 51: WebRTC & Firefox OS - presentation at Google

var deviceStorage = navigator.getDeviceStorage("videos");

Page 52: WebRTC & Firefox OS - presentation at Google

// "external", "shared", or "default".deviceStorage.type;

// Add a file - returns DOMRequest with file namedeviceStorage.add(blob);

// Same as .add, with provided namedeviceStorage.addNamed(blob, name);

// Returns DOMRequest/non-editable File objectdeviceStorage.get(name);

// Returns editable FileHandle objectdeviceStorage.getEditable(name);

// Returns DOMRequest with success or failuredeviceStorage.delete(name);

// Enumerates filesdeviceStorage.enumerate([directory]);

// Enumerates files as FileHandlesdeviceStorage.enumerateEditable([directory]);

Page 53: WebRTC & Firefox OS - presentation at Google

var storage = navigator.getDeviceStorage("videos"), cursor = storage.enumerate(); cursor.onerror = function() { console.error("Error in DeviceStorage.enumerate()", cursor.error.name);};

cursor.onsuccess = function() { if (!cursor.result) return; var file = cursor.result;

// If this isn't a video, skip it if (file.type.substring(0, 6) !== "video/") { cursor.continue(); return; }

// If it isn't playable, skip it var testplayer = document.createElement("video"); if (!testplayer.canPlayType(file.type)) { cursor.continue(); return; }};

Page 54: WebRTC & Firefox OS - presentation at Google

WEB ACTIVITIES

Page 56: WebRTC & Firefox OS - presentation at Google
Page 57: WebRTC & Firefox OS - presentation at Google

var activity = new MozActivity({ name: "view", data: { type: "image/png", url: ... }});

activity.onsuccess = function () { console.log("Showing the image!");};

activity.onerror = function () { console.log("Can't view the image!");};

Page 58: WebRTC & Firefox OS - presentation at Google

{ "activities": { "share": { "filters": { "type": ["image/png", "image/gif"] } "href": "sharing.html", "disposition": "window" } }}

Page 59: WebRTC & Firefox OS - presentation at Google

navigator.mozSetMessageHandler("activity", function (a) { var img = getImageObject(); img.src = a.source.url; // Call a.postResult() or a.postError() if // the activity should return a value});

Page 60: WebRTC & Firefox OS - presentation at Google

Future APIs

Page 61: WebRTC & Firefox OS - presentation at Google
Page 62: WebRTC & Firefox OS - presentation at Google

Resource lock API

UDP Datagram Socket API

Peer to Peer API

WebNFC

WebUSB

HTTP-cache API

Calendar API

Spellcheck API

LogAPI

Keyboard/IME API

WebRTC

FileHandle API

Sync API

Page 63: WebRTC & Firefox OS - presentation at Google

Web Apps from Mozilla

Page 64: WebRTC & Firefox OS - presentation at Google
Page 65: WebRTC & Firefox OS - presentation at Google

Dialer

Contacts

Settings

SMS

Web browser

Gallery

Video Player

Music Player

E-mail (POP, IMAP)

Calendar

Alarm Clock

Camera

Notes

First Run Experience

Notifications

Home Screen

Mozilla Marketplace

System Updater

Localization Support

Page 67: WebRTC & Firefox OS - presentation at Google

Get started

Page 70: WebRTC & Firefox OS - presentation at Google

https://marketplace.firefox.com/

Page 72: WebRTC & Firefox OS - presentation at Google

Trying things out

Page 73: WebRTC & Firefox OS - presentation at Google