WebRTC & Firefox OS - presentation at Google
Upcoming SlideShare
Loading in...5
×
 

WebRTC & Firefox OS - presentation at Google

on

  • 2,484 views

 

Statistics

Views

Total Views
2,484
Views on SlideShare
2,237
Embed Views
247

Actions

Likes
6
Downloads
71
Comments
0

4 Embeds 247

https://twitter.com 220
http://unsolublesugar.com 22
http://webcache.googleusercontent.com 3
http://localhost 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

WebRTC & Firefox OS - presentation at Google WebRTC & Firefox OS - presentation at Google Presentation Transcript

  • WebRTC & Firefox OS
  • @robertnyman
  • Mozilla is aglobal non-profit dedicatedto putting youin control ofyour onlineexperience andshaping thefuture of theWeb for thepublic good
  • WebRTC
  • 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 supportedin this browser.);// Display a friendly "sorry" message to the user}
  • function successCallback(stream) {// Set the source of the video element with the stream from the cameraif (video.mozSrcObject !== undefined) {video.mozSrcObject = stream;} else {video.src = (window.URL && window.URL.createObjectURL(stream)) ||stream;}video.play();}
  • Firefox & WebRTC status
  • "Fix a lot of bugs and improve quality"
  • First implementation in Firefox 22,including DataChannelsTURN support for Desktop in Firefox 23Audio recording support. We hope toget it landed in Firefox 24We havent started working on videorecordingDesktop
  • Stretch goal of shipping WebRTC (prefdon) in Firefox 24 -- though Firefox 25 ismore likely.It is already in Firefox 23 for Android,but behind a pref (the same pref thatdesktop was behind)Android
  • Were starting to get WebRTCfunctioning on Firefox OS. gUM willcome first.Since Firefox OS doesnt ship on thetrain system, the initial code for this willlikely ship later in the year (sometimeafter Firefox OS v1.1)Firefox OS
  • Persona/Identity integrationBUNDLESDP renegotiation via newoffer/answer pairStatistics API (at least theframework for it)persistent permissionssupport more than 1 audioflow and 1 video flowRoadmap
  • Using HTML5, CSS andJavaScript together with anumber of APIs to buildapps and customize the UI.Firefox OS
  • A walk in the park
  • Open Web Apps
  • Build excellent interfaces!
  • Packaged vs. Hosted Apps
  • WebAPIs
  • Security Levels
  • Web ContentRegular web contentInstalled Web AppA regular web appPrivileged Web AppMore access, more responsibilityCertified Web AppDevice-critical applications
  • https://wiki.mozilla.org/WebAPI#Planned_for_initial_release_of_B2G_.28aka_Basecamp.29
  • "permissions": {"contacts": {"description": "Required for autocompletion in the share screen","access": "readcreate"},"alarms": {"description": "Required to schedule notifications"}}
  • PERMISSIONS
  • Vibration API (W3C)Screen OrientationGeolocation APIMouse Lock API (W3C)Open WebAppsNetwork Information API (W3C)Battery Status API (W3C)Alarm APIWeb ActivitiesPush Notifications APIWebFM APIWebPaymentIndexedDB (W3C)Ambient light sensorProximity sensorNotificationREGULAR APIS
  • BATTERY STATUSAPI
  • 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 eventsbattery.addEventListener("levelchange", setStatus, false);battery.addEventListener("chargingchange", setStatus, false);battery.addEventListener("chargingtimechange", setStatus, false);battery.addEventListener("dischargingtimechange", setStatus, false);}
  • SCREENORIENTATION API
  • // Portrait mode:screen.mozLockOrientation("portrait");/*Possible values:"landscape""portrait""landscape-primary""landscape-secondary""portrait-primary""portrait-secondary"*/
  • VIBRATION API
  • // 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);
  • DEVICEPROXIMITY
  • window.addEventListener("deviceproximity", function (event) {// Current device proximity, in centimetersconsole.log(event.value);// The maximum sensing distance the sensor is// able to report, in centimetersconsole.log(event.max);// The minimum sensing distance the sensor is// able to report, in centimetersconsole.log(event.min);});
  • AMBIENT LIGHTEVENTS
  • window.addEventListener("devicelight", function (event) {// The lux values for "dim" typically begin below 50,// and the values for "bright" begin above 10000console.log(event.value);});
  • Device Storage APIBrowser APITCP Socket APIContacts APIsystemXHRPRIVILEGED APIS
  • DEVICE STORAGEAPI
  • var deviceStorage = navigator.getDeviceStorage("videos");
  • // "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]);
  • 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 isnt a video, skip itif (file.type.substring(0, 6) !== "video/") {cursor.continue();return;}// If it isnt playable, skip itvar testplayer = document.createElement("video");if (!testplayer.canPlayType(file.type)) {cursor.continue();return;}};
  • WEB ACTIVITIES
  • Interacting with the camera
  • var activity = new MozActivity({name: "view",data: {type: "image/png",url: ...}});activity.onsuccess = function () {console.log("Showing the image!");};activity.onerror = function () {console.log("Cant view the image!");};
  • {"activities": {"share": {"filters": {"type": ["image/png", "image/gif"]}"href": "sharing.html","disposition": "window"}}}
  • 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});
  • Future APIs
  • Resource lock APIUDP Datagram Socket APIPeer to Peer APIWebNFCWebUSBHTTP-cache APICalendar APISpellcheck APILogAPIKeyboard/IME APIWebRTCFileHandle APISync API
  • Web Apps from Mozilla
  • DialerContactsSettingsSMSWeb browserGalleryVideo PlayerMusic PlayerE-mail (POP, IMAP)CalendarAlarm ClockCameraNotesFirst Run ExperienceNotificationsHome ScreenMozilla MarketplaceSystem UpdaterLocalization Support
  • Get started
  • https://addons.mozilla.org/firefox/addon/firefox-os-simulator/
  • FIREFOX OSBOILERPLATE APPhttps://github.com/robnyman/Firefox-OS-Boilerplate-App
  • https://marketplace.firefox.com/
  • https://marketplace.firefox.com/developers/
  • Trying things out
  • Go have some fun!
  • Robert Nymanrobertnyman.comrobert@mozilla.comMozilla@robertnyman