Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JavaScript in the next generation

Phil Nash
October 05, 2012

JavaScript in the next generation

JavaScript, once a "toy" language is now driving the interfaces of the most popular sites on the web. We've come a long way from snowflakes drifting over a site around Christmas time, now creating powerful client side applications. But JavaScript can do more for us than taking the heat off the server. There is a new generation of interfaces emerging in our browsers that will allow us to do even more interesting stuff in the client side of our apps. This talk will cover some of the interesting integrations between browser and device that are becoming available to us through JavaScript. From existing APIs, such as Geolocation, to bleeding edge stuff like the Battery API (woo!) or getting input from cameras or microphones with getUserMedia, we'll discover how browsers in the near future will shape users' interactions with our apps.

Links to demos:
Device Orientation: http://philnash.github.com/rainbow/
getUserMedia: http://philnash.github.com/getUserMedia/
WebRTC: https://apprtc.appspot.com/

Phil Nash

October 05, 2012
Tweet

More Decks by Phil Nash

Other Decks in Programming

Transcript

  1. R R

  2. DEVICE APIS DEVICE APIS GEOLOCATION GEOLOCATION DEVICEORIENTATION AND DEVICEMOTION DEVICEORIENTATION

    AND DEVICEMOTION BATTERY API BATTERY API VIBRATION VIBRATION CAMERAS AND MICROPHONES CAMERAS AND MICROPHONES MORE! MORE! ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠ ☠
  3. USES FOR GEOLOCATION USES FOR GEOLOCATION TREASURE MAPS AND DIRECTIONS

    TREASURE MAPS AND DIRECTIONS REPLACEMENT FOR APPLE MAPS REPLACEMENT FOR APPLE MAPS ☠ ☠ ☠ ☠
  4. DEVICEORIENTATION if ('ondeviceorientation' in window){ window.addEventListener('deviceorientation', function(e){ console.log("Alpha: " +

    e.alpha); console.log("Beta: " + e.beta); console.log("Gamma: " + e.gamma); }, false); } 01. 02. 03. 04. 05. 06. 07.
  5. USES FOR DEVICEORIENTATION USES FOR DEVICEORIENTATION AND DEVICEMOTION AND DEVICEMOTION

    SHIP'S COMPASS AND SPEEDOMETER SHIP'S COMPASS AND SPEEDOMETER GAMES - WII CONTROLLER STYLE CONTROL GAMES - WII CONTROLLER STYLE CONTROL ☠ ☠ ☠ ☠
  6. USES FOR THE BATTERY API USES FOR THE BATTERY API

    RESTRICTING FEATURES AND PROCESSOR USAGE WHEN RESTRICTING FEATURES AND PROCESSOR USAGE WHEN BATTERY LEVELS ARE LOW. BATTERY LEVELS ARE LOW. ☠ ☠
  7. Our temporary implementation Our temporary implementation name was Vibrator API,

    but since it name was Vibrator API, but since it gave the wrong impression, we now gave the wrong impression, we now call it Vibration API call it Vibration API “ “
  8. CAMERAS AND MICROPHONES if(navigator.getUserMedia){ navigator.getUserMedia( {video: true}, function(stream){ // do

    something... }, function(){ alert("Error"); } ) } 01. 02. 03. 04. 05. 06. 07. 08. 09.
  9. CAMERAS AND MICROPHONES function streamSuccess(stream){ var video = document.getElementsByTagName('video')[0]; source

    = window.URL.createObjectURL(stream); video.src = stream; } 01. 02. 03. 04. 05.