<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>David Rousset - HTML5 &amp; Gaming Technical Evangelist</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/davrous/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/davrous/feed.xml</link>
    <description>HTML5 &amp;amp; Gaming Technical Evangelist</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:20:32 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Discovering Sponza by Babylon.js and sharing tips on how to build a cross-platforms WebGL game</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/discovering-sponza-by-babylon-js-and-sharing-tips-on-how-to-build-a-cross-platforms-webgl-game</link>
      <pubDate>Fri, 05 Feb 2016 18:52:41 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/?p=3052</guid>
      <description><![CDATA[window.location =...]]></description>
      <content:encoded><![CDATA[<script>window.location = "https://www.davrous.com/2016/02/05/discovering-sponza-by-babylon-js-and-sharing-tips-on-how-to-build-a-cross-platforms-webgl-game/";</script>
<p>To celebrate the 2.3 version of Babylon.js, the team decided to build a new cool demo of what can be done with our WebGL engine but also to show how HTML5 web standards can build great games today. The idea was to build a similar, if not identical, experience on all WebGL supported platforms and to try to reach native apps’ features.  <p>This article will then explain how this experience works and the various challenges we’ve faced to build it. <p>For that, this demo is using a fairly impressive number of “<i>HTML5 features</i>” like <b>WebGL</b>, <b>Web Audio</b> of course but also <b>Pointer Events</b> (available everywhere thanks to <b>jQuery PEP</b> polyfill), <b>Gamepad</b> API, <b>IndexedDB</b>, HTML5 <b>appcache</b>, <b>CSS3 transition/animation, </b><b>flexbox</b> and <b>fullscreen</b> API.  <p>Test it on your desktop, mobile or Xbox One: <a href="https://babylonjs.com/demos/sponza" target="_blank">https://babylonjs.com/demos/sponza</a> <p> <p><a href="https://babylonjs.com/demos/sponza" target="_blank"><img title="Sponza" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Sponza" src="https://msdnshared.blob.core.windows.net/media/2016/02/Sponza.jpg" width="800" height="500"></a>  <h2>Discovering the demo</h2> <p>First, you’ll start on an auto-animated sequence giving the credits to who built this scene.  <p>Most of the team’s members come from the “<b><i>demo scene</i></b>”. If you don’t know what it is, have a look to this <a href="https://www.pouet.net/" target="_blank">site</a> or go on <a href="https://en.wikipedia.org/wiki/Demoscene" target="_blank">Wikipedia</a>. You’ll discover that this is an important part of the 3D developers’ culture. On my side, I was on Atari while David Catuhe was on Amiga which is still a regular source of conflicts between us ;-). I was coding a bit but mainly doing the music in my demo group. I was a huge fan of <a href="https://en.wikipedia.org/wiki/Future_Crew" target="_blank">Future Crew</a> and more specifically of <a href="https://www.youtube.com/watch?v=cJF0vUtVpCM" target="_blank">Purple Motion</a>, my favorite demo scene composer of all time. <p>For Sponza, here are the contributors: <ul> <li><b>Michel Rousseau</b> aka “Mitch” has done the awesome visual, animations &amp; rendering optimizations acting as the 3D artist. It took the great Sponza model provided freely by Crytek on their <a href="https://www.crytek.com/cryengine/cryengine3/downloads/" target="_blank">website</a> and used our <a href="https://github.com/BabylonJS/Babylon.js/tree/master/Exporters/3ds%20Max" target="_blank">3DS Max exporter</a> to generate what you see.</li> <li><b>David Catuhe</b> aka “deltakosh” and I have done the core part of the Babylon.js engine and also all the code for this demo (custom loader, special effects for the demo mode using fade to black post-processes, etc.) as well as a new type of camera named “<i>UniversalCamera</i>” handling all type of inputs in a generic way.</li> <li>I’ve done the music using Renoise and the awesome EastWest Symphonic Orchestra sound bank. I’ve already shared my way to compose music: <a href="https://blogs.msdn.microsoft.com/davrous/2012/06/20/composing-the-music-for-the-world-monger-windows-8-game-using-the-renoise-tracker-east-west-vst-plug-ins/" target="_blank">Composing the music for the World Monger Windows 8 game using the Renoise tracker &amp; East West VST Plug-ins</a><b></b></li> <li><b>Julien Moreau-Mathis</b> helped us by building a new tool to help 3D artists finalizing the job between the modeling tools (3DS Max, Blender) and the final results. For instance, Michel has used it to test &amp; tune the various animated cameras and to inject the particles into the scene. </li></ul> <p>If you wait until the end of the automatic sequence up to the <strong>epic finish</strong> (my favorite part, you should check it), you’ll be automatically switched to the free interactive mode. If you’d like to by-pass the demo mode, simply click on the camera icon or press A on your gamepad. <p>In the interactive mode, if you’re on a PC/Mac, you’ll be able to move inside the scene using keyboard/mouse like a FPS game, if you’re on smartphone, you’ll be able to move using a single touch (and 2 to rotate camera) and finally, on an Xbox One using the gamepad (or a desktop if you’re plugging a gamepad into it).  <p>Fun fact: on a Windows touch PC, you can potentially use the 3 types of input in the same time. <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/2016/02/wlEmoticon-smile.png"> <p>The atmosphere is different in the interactive mode. You’ve got 3 storms sounds randomly positioned in the 3D environment, some wind and some small fire sounds on each corner. On supported browsers (Firefox, Chrome, Opera &amp; Safari), you can even switch between the normal speaker mode and the headphone mode clicking on the dedicated icon. This will then use the <b>binaural audio</b> rendering of Web Audio for a more realistic audio simulation if you’re listening via a headphone.  <p>To have a complete app-like experience, we’ve generated icons &amp; tiles for all platforms. This means for instance on Windows 8/10 that you can pin this web app into the start menu. We even have multiple sizes available: <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/image22.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/02/image_thumb16.png" width="372" height="400"></a>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/2016/02/image51.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/02/image5_thumb.png" width="375" height="400"></a></p> <p>Same on your iPhone, Windows Mobile or Android device:  <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/IMG_0035.png"><img title="IMG_0035" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="IMG_0035" src="https://msdnshared.blob.core.windows.net/media/2016/02/IMG_0035_thumb.png" width="270" height="480"></a>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/2016/02/wp_ss_20160204_0001.png"><img title="wp_ss_20160204_0001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="wp_ss_20160204_0001" src="https://msdnshared.blob.core.windows.net/media/2016/02/wp_ss_20160204_0001_thumb.png" width="270" height="480"></a>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/2016/02/Screenshot_2016-02-05-13-19-59.png"><img title="Screenshot_2016-02-05-13-19-59" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Screenshot_2016-02-05-13-19-59" src="https://msdnshared.blob.core.windows.net/media/2016/02/Screenshot_2016-02-05-13-19-59_thumb.png" width="270" height="480"></a></p> <h3>Offline first!</h3> <p>Once the demo has been completely loaded, you can switch your phone to airplane mode to cut connectivity and click on the Sponza icon. Our web app will still provide the complete experience with WebGL rendering, 3D web audio and touch support. Switch it to full screen and you <b>won’t be able to make the difference with a native app</b>!  <p>We’re using our IndexedDB layer available natively inside Babylon.js for that. The scene (JSON format) and the resources (JPG/PNG textures as well as MP3 for the music &amp; sounds) are stored in IDB. The IDB layer coupled with HTML5 application cache is then providing this complete offline experience. To learn more about this part and how to configure your game to obtain similar results, read this: <a href="https://blogs.msdn.microsoft.com/davrous/2013/09/24/using-indexeddb-to-handle-your-3d-webgl-assets-sharing-feedbacks-tips-of-babylon-js/" target="_blank">Using IndexedDB to handle your 3D WebGL assets: sharing feedbacks &amp; tips of Babylon.JS</a> and <a href="https://doc.babylonjs.com/tutorials/07._Caching_Resources_in_IndexedDB" target="_blank">Caching Resources in IndexedDB in Babylon.js</a> <h3>Xbox One enjoys the show also</h3> <p>Last but not least, the very same demo works flawlessly in MS Edge on your Xbox One: <p> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/xboxonesponza001.jpg"><img title="xboxonesponza001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="xboxonesponza001" src="https://msdnshared.blob.core.windows.net/media/2016/02/xboxonesponza001_thumb.jpg" width="640" height="360"></a></p> <p>Press <strong>A</strong> to switch to <strong>interactive</strong> <strong>mode</strong>. The Xbox One says that you can now move using your gamepad inside the 3D scene: <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/xboxonesponza0025.jpg"><img title="xboxonesponza002[5]" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="xboxonesponza002[5]" src="https://msdnshared.blob.core.windows.net/media/2016/02/xboxonesponza0025_thumb.jpg" width="640" height="360"></a></p> <p>So, let’s briefly recap.  <p>The <b>very same code base</b> works across Windows, Mac, Linux on MS Edge, Chrome, Firefox, Opera &amp; Safari, on iPhone/iPad, on Android devices with Chrome or Firefox, Firefox OS and on Xbox One! Isn’t that cool? Being able to target so many devices with a native like experience directly from your web server?  <p>I’ve already shared my excitement about this huge potential in a previous article: <a href="https://blogs.msdn.microsoft.com/davrous/2014/06/20/the-web-the-next-game-frontier/" target="_blank">The web: the next game frontier?</a> <h2>Hack the scene with our debug layer to learn how we’ve made it</h2> <p>If you’d like to understand how Michel is mastering the magic of 3D modeling, you can hack the scene using the Babylon.js <b>Debug Layer</b> tool.  <p>To enable it on a machine with a keyboard, press “<i><strong>CTRL + SHIFT + D</strong></i>” and if you’re using a gamepad on PC or Xbox, press on “<i><strong>Y</strong></i>”.  <p><b><u>Note:</u></b> <i>displaying the debug layer costs a bit of performance due to the composition job the rendering engine needs to do. So the FPS displayed are a bit less important than the real FPS you’ve got without the debug layer displayed. </i> <p>Let’s test it on a PC for instance. <p>Move near the lion’s head and cut the bump channel from our shader’s pipeline: <p> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/image17.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/02/image_thumb11.png" width="640" height="425"></a>  <p>You should see that the head is now less realistic. Play with the other channel to check what’s going on.  <p>You can also cut the dynamic lightning engine or disable the collisions engine to fly or move through the walls. For instance, disable the “<i>collisions</i>” checkbox and fly to the first floor. Put the camera in front of the red flags. You can see them slightly moving. Michel has used the bones/skeletons support of Babylon.js to move them. Disable the “<i>skeletons</i>” option and they should stop moving: <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/image18.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/02/image_thumb12.png" width="640" height="425"></a>  <p>At last, you can display the meshes tree on the top right corner. You can enable/disable them to completely break the great job done by Michel: <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/image19.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/02/image_thumb13.png" width="640" height="425"></a>  <p>Removing the geometries, our über shader’s channels or some options of our engine can help you troubleshooting performances on a specific device to see what is currently costing too much. You can also check if you’re CPU limited or GPU limited. Even if, most of the time, we’re CPU limited in WebGL due to the mono-threading nature of JavaScript. Finally, this tool is also very useful to learn how a scene has been built by the 3D artist.  <p>By the way, it works great on Xbox One also: <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/xboxonesponza004.jpg"><img title="xboxonesponza004" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="xboxonesponza004" src="https://msdnshared.blob.core.windows.net/media/2016/02/xboxonesponza004_thumb.jpg" width="640" height="360"></a>  <h2>Challenges</h2> <p>We faced a number of questions &amp; challenges to build this experience. Let me share some of them. <h3>WebGL performance and cross-platforms compatibility</h3> <p>On the programming side, this one was probably the easiest one as it’s completely handled by the Babylon.js engine itself.  <p>We’re using a <strong>unique shader’s architecture that adapts itself to the platform</strong> by trying the find the best shader available for the current browser/GPU using various fallbacks. The idea is to lower the quality/complexity of the rendering engine until we manage to display something on screen.  <p>Babylon.js is mainly based on WebGL 1.0 to guarantee that the 3D experiences built on top of it will run everywhere. It has been built with a web philosophy in mind, so we’re using a “<b>graceful degradation</b>” like approach on the shader compilation process. This is completely transparent for the 3D artist who doesn’t want to understand those complexities most of the time. <p>Still, the 3D artist has a very important role in the performance optimizations. He has to know the platform he’s targeting, its features supported and its limitations. You can’t take assets coming from AAA games made for high end GPUs and DirectX 12 and push them like that on a WebGL engine. Targeting WebGL is today very similar to the job you’ll have to do to optimize for mobile, plus the fact that JavaScript is highly mono-threaded.  <p>Mitch is extremely good doing that: optimizing the textures, pre-calculating the lightning to bake it into the textures, reducing as much as possible the number of draw calls, etc. He’s got years of experience behind him and saw the various generations of 3D hardware &amp; engines (from PowerVR/3DFX to today’s GPUs) which really helps. <p>He already shared a bit of those basics: <a href="https://blogs.msdn.com/b/designmichel/archive/2013/06/27/real-time-3d-making-a-demo-for-webgl-purposes-basics.aspx" target="_blank">Real Time 3D : making a demo for WebGL Purposes –Basics.</a> and already proved several times you can create stunning graphics on the web with high performance on small integrated GPUs with the <a href="https://babylonjs.com/demos/mansion" target="_blank">Mansion</a>, <a href="https://babylonjs.com/demos/hillvalley" target="_blank">Hill Valley</a> or <a href="https://babylonjs.com/demos/espilit" target="_blank">Espilit</a> demo scenes for instance. I’m also highly recommending you watching his great talk: <a href="https://www.youtube.com/watch?v=ObZX541I-Tk" target="_blank">NGF2014 - Create 3D assets for the mobile world &amp; the web, the point of view of a 3D designer</a> where he shared his experience and how he managed to optimize the Hill Valley scene from less than 1 fps to 60 fps!  <p>The initial goal for Sponza was to build 2 scenes. 1 for the desktop and 1 for the mobile with less complexity, smaller textures, simpler meshes/geometries. But during our tests, we finally discovered that the desktop version was also running pretty fine on mobiles as it can run up to 60fps on an iPhone 6s or an Android OnePlus 2. We then decided not to continue working on the simpler mobile version. But again, <b>following the general web best practices for web games is a good idea</b>. It would have been probably better to have a pure “<b>mobile first</b>” approach on Sponza to reach 30fps+ on most mobiles and then enhance the scene for high-end mobiles and desktop. Still, most of the feedback we have on twitter seems to indicate that the final result works very well on a lot of mobiles. Sponza has been optimized on a HD4000 GPU (Intel Core i5 integrated) which is more or less equivalent to actual high-end mobiles’ GPUs.  <p>We’re then pretty happy of the performance. Sponza is using our über shader with <b>ambient</b>, <b>diffuse</b>, <b>bump</b>, <b>specular</b> &amp; <b>reflection</b> enabled, we have some <b>particles</b> to simulate small fires on each corner, we’ve got animated <b>bones</b> for the red flags, 3D positioned <b>sounds</b> and <b>collisions</b> when you’re moving using the interactive mode. Technically speaking, we’ve got 98 meshes used in the scene generating up to <b>377781 vertices</b>, 16 actives bones, 60+ particles that could generate up to 36 draw calls. And trust me, having few draw calls is the key to optimal performance, even more on the web. <h3>The loader</h3> <p>For Sponza, we wanted to create a new loader, different than the default one we’re using on the <a href="https://www.babylonjs.com" target="_blank">babylonjs.com</a> website, to really have a polished web app. I’ve then asked to Michel to suggest something new.  <p>He first provided me that: <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/Loadingexplained.jpg"><img title="Loadingexplained$" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Loadingexplained$" src="https://msdnshared.blob.core.windows.net/media/2016/02/Loadingexplained_thumb.jpg" width="640" height="427"></a>  <p>Which looks very nice when you first have a look to it!  <p>But then, you’re quickly asking to yourself: “<i>how am I going to make this working on all devices in a responsive way?</i>”. Well, you probably perfectly understand me.  <p>Let’s talk first about the background. The effect created by Michel was nice but wasn’t working well across all window sizes &amp; resolutions generating some moiré. I’ve then changed it with a classical screenshot of the scene.  <p>I then wanted the background to completely fill the screen without black bars and without stretching the image to break the ratio.  <p>The solution mainly comes from CSS “<b><i>background-size: cover</i></b>” + centering the image on X &amp; Y. <p>We then have the experience I was looking to, whatever the screen ratio being used: <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/image111.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/02/image11_thumb.png" width="160" height="250"></a>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/2016/02/image110.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/02/image1_thumb.png" width="583" height="250"></a> <p>The other parts are using classical percentage-based CSS positioning. But my main wonder was on how to handle the <strong>size of the fonts based on the size of the viewport</strong>.  <p>Well, the good news is that you’ve got a specific unit for that! It’s named “<b>vw</b>” or “<b>vh</b>” where 1vw is 1% of the viewport width for instance. This CSS property is doing all the magic for you and is pretty well supported across browsers. Well, at least, all WebGL-compatible browsers are supporting it and that was more than enough for me. ;-)  <p>To know more about this: <a href="https://css-tricks.com/viewport-sized-typography/">Viewport Sized Typography</a> <p>Finally, we’re playing with the opacity property of the background image to move it from 0 to 1 based on the current downloading process moving from 0 to 100%. <h3>Handling all inputs in a transparent way for the users</h3> <p>Our WebGL engine is doing all the job on the rendering side to display the good stuff on all platforms. But how to guarantee that the user will be able to move inside the scene whatever the input type used?  <p>We were currently supporting all types of input and user’s interactions in Babylon.js v2.2: keyboard/mouse, touch, virtual touch joysticks, gamepad, device orientation VR (for Card Board) and WebVR, each via a dedicated camera. You can read our documentation to know more about them: <a href="https://doc.babylonjs.com/tutorials/05._Cameras">https://doc.babylonjs.com/tutorials/05._Cameras</a> <p>Touch is being universally addressed via the <a href="https://www.w3.org/TR/pointerevents/">Pointer Events</a> specification propagated to all platforms via the <a href="https://github.com/jquery/PEP">jQuery PEP</a> polyfill (generating <a href="https://www.w3.org/TR/touch-events/">Touch Events</a> for you when needed). To know more about Pointer Events: <a href="https://blogs.msdn.microsoft.com/davrous/2015/08/10/unifying-touch-and-mouse-how-pointer-events-will-make-cross-browsers-touch-support-easy/">Unifying touch and mouse: how Pointer Events will make cross-browsers touch support easy</a> <p>The idea for Sponza was to have a unique camera handling all users’ scenarios possible: desktop, mobile &amp; console.  <p>We ended up creating the <b>UniversalCamera</b>. It was so obvious and simple to create that I still don’t know why we didn’t do it before. The UniversalCamera is more or less a gamepad camera extending the <b>TouchCamera</b> which extends the <b>FreeCamera</b>.  <p>The FreeCamera is providing the keyboard/mouse logic, the TouchCamera is providing the touch logic and the final extend the gamepad logic. <p>This <b>UniversalCamera is now used by default by Babylon.js</b>. If you’re navigating on the <a href="https://babylonjs.com">https://babylonjs.com</a> demos, you can move inside the scenes using mouse, touch &amp; gamepad on all of them now. To know more on how we’ve built it, read our code: <a href="https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.universalCamera.ts">babylon.universalCamera.ts</a> <h3>Synchronizing the transitions with the music</h3> <p>This is where we’ve asked ourselves most of the questions. You may have noticed that the <strong>introduction sequence is synchronized with specific moments of the music</strong>. The first texts are displayed with some of the drums I’ve used and the final ending sequence is switching quickly from one camera to another on each note of the horn instrument I’m using. <p>Synchronizing audio with the WebGL rendering loop is not easy. Again, this is the mono-threaded nature of JavaScript that generates this complexity. To better understand why, please read the first part of this article: <a href="https://blogs.msdn.microsoft.com/davrous/2011/07/15/introduction-to-the-html5-web-workers-the-javascript-multithreading-approach">Introduction to the HTML5 Web Workers: the JavaScript multithreading approach</a>. It’s really important to understand the problem highlighted by the first diagram to understand the global issue we’re facing. <p>Usually, in demo scenes (and video games I guess), if you’d like to synchronize the visuals with the sounds/music, you’re going to be driven by the audio stack. 2 approaches are used: <p>1 – Generate some metadata injected into the audio files that could raise some events when you’re reaching a specific part of it<br>2 – Real-time analyzing the audio stream via FFT or similar to detect interesting peaks or BPM changes that would again generate events for the visual engine.  <p>Those approaches particularly work well in multi-threaded environments like C++. But in JavaScript with Web Audio, we’ve got 2 problems:  <p>1 – JavaScript, which is mono-threaded and unfortunately, most of the time, web workers won’t help<br>2 – <strong>Web Audio doesn’t have any events</strong> that could be sent back to the UI thread even if Web Audio is being handled on a separate thread by the browser.  <p>Web Audio has a much precised timer than JS. It would have been cool to be able to use this separate timer on a separate thread to drive the events back to the UI thread. But today, you can’t do that. <p>On the other side, we’re rendering the scene using WebGL and the <i>requestAnimationFrame</i> function. This means that, in “best cases”, we have 16ms windows timeframe. If you’re missing one, you’ll have to wait up to 16ms to be able to act on the next frame to reflect the sound synchronization (for instance to launch a fade to black effect).  <p>I was then thinking about injecting the synchronization logic into the <b>requestAnimationFrame</b> loop. Checking the time spent since the beginning of the sequence and checking if I should impact the visual to react on an audio event. The good news is that web audio will render the sound whatever is going on in the main UI thread. For instance, you can be sure that the 12s timestamp of the music will arrive exactly 12s after the music have started even if the GPU is having a hard time rendering the scene.  <p>But we finally chose the simplest solution ever: using <b>setTimeout</b>() calls…  <p>Yes, I know. The above article on the introduction to web workers says that this is unreliable. But in our case, once the scene is ready to be rendered, we know that we’ve downloaded all our resources (textures &amp; sounds) and compiled our shaders. We shouldn’t be too much annoyed by unexpected events saturating the UI thread. <b>GC could be a problem</b> but we’ve also spent a lot of time fighting against it in the engine: <a href="https://blogs.msdn.microsoft.com/eternalcoding/2013/09/04/reducing-the-pressure-on-the-garbage-collector-by-using-the-f12-developer-bar-of-internet-explorer-11/">Reducing the pressure on the garbage collector by using the F12 developer bar of Internet Explorer 11</a> <p>Still, I know this is far from being an ideal solution. Switching to another tab or locking your phone and unlocking it some seconds later could generate some issues on the synchronization parts of our demos. We could fix those problems by using <a href="https://www.w3.org/TR/page-visibility/">the Page Visibility</a> API by pausing the rendering loop, the various sounds and re-computing the next timeframes for the setTimeout() calls. <p>I’ve got the feeling that I’ve missed something, that there is probably a better approach to handle this problem. So feel free to share your ideas or solutions in the comment section if you think you’ve got something better! <p>Oh, by the way, the text animations are simply done using <b>CSS3 transitions</b> or animations combined with a <b>flexbox</b> layout to have a simple but efficient way to display at the center or on each corner using <b>alignItems</b> to “<i>center</i>”, “<i>flex-start</i>” or “<i>flex-end</i>” and <b>justifyContent</b> to “<i>center</i>”, “<i>flex-start</i>” and “<i>flex-end</i>” also.  <p>To know more about Flexbox: <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">A Complete Guide to Flexbox</a> <h3>Handling Web Audio on iOS</h3> <p>The last challenge I’d like to share with you is the way Web Audio is being handled by iOS on iPhone &amp; iPad. If you’re looking in search engines for “web audio + iOS”, you’ll find lot of people having hard time to play sounds on iOS. <p>iOS is perfectly supporting Web Audio, even the binaural audio mode. But Apple has decided that a web page can’t play any sound by default without a specific user’s interaction. It’s probably to avoid having ads or whatever disturbing the user by playing unsolicited sounds.  <p>You then first need to <strong>unlock the web audio context of iOS</strong> after a user’s touch before trying to play any sound. Otherwise, your web application will remain desperately mute.  <p>Unfortunately, the only way I’ve found to do this check if by doing a user platform sniffing approach as I didn’t found a feature detection way to do it. I really hate doing that but sometimes, this is the only solution you’ve got… <p>You can check my code: <a href="https://github.com/BabylonJS/Babylon.js/blob/master/src/Audio/babylon.audioEngine.ts">babylon.audioEngine.ts</a> <p>If you’re not on iPad/iPhone/iPod, the audio context is immediately available for use. Otherwise, we’re unlocking the audio context of iOS by playing a code generated empty sound on the <i>touchend</i> event. You can register to the <i>onAudioUnlocked</i> event if you’d like to wait for that before launching your game.  <p>So if you’re launching Sponza on an iPhone/iPad, you’ll have this final screen at the end of the loading sequence: <p><a href="https://msdnshared.blob.core.windows.net/media/2016/02/IMG_0036.png"><img title="IMG_0036" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="IMG_0036" src="https://msdnshared.blob.core.windows.net/media/2016/02/IMG_0036_thumb.png" width="640" height="360"></a>  <p>Touching anywhere on the screen will unlock the audio stack of iOS and will launch the show. <p>I hope that you’ve enjoyed our Sponza by Babylon.js experience. I also hope that you’ve learned interesting details in this article. To learn more, read the complete source code of this demo on our github. Main files to review are: <a href="https://github.com/BabylonJS/Samples/blob/master/Demos/Sponza/index.js">index.js</a> and <a href="https://github.com/BabylonJS/Samples/blob/master/Demos/Sponza/babylon.demo.ts">babylon.demo.ts</a> <p>Finally, I really hope you’ll be now even more convinced that the web is definitely a great platform for gaming! <p>Stay tuned, we’ve got great new demos coming soon and trust me, they are very very cool. :)  <p>David</p>]]></content:encoded>
    </item>
    <item>
      <title>Debugging your HTML5 on Xbox One / MS Edge with the Xbox Windows Store app and Vorlon.js</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/debugging-your-html5-on-xbox-one-ms-edge-with-the-xbox-windows-store-app-and-vorlon-js</link>
      <pubDate>Fri, 13 Nov 2015 03:31:55 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2015/11/13/debugging-your-html5-on-xbox-one-ms-edge-with-the-xbox-windows-store-app-and-vorlon-js/</guid>
      <description><![CDATA[window.location =...]]></description>
      <content:encoded><![CDATA[<script>window.location = "https://www.davrous.com/2015/11/13/debugging-your-html5-on-xbox-one-ms-edge-with-the-xbox-windows-store-app-and-vorlon-js/";</script>
<p>Starting yesterday, <a href="https://news.xbox.com/2015/11/12/new-xbox-one-experience-begins-today/" target="_blank">a new update is available on Xbox One</a>. I really love the new dashboard and the Xbox 360 backward compatibility as a gamer. But as a web developer, I’m more than happy to now have <strong>Microsoft Edge running on my console</strong>! This means that you can now run very modern content inside the Xbox One browser!</p>  <h2>Testing your HTML5 content on Xbox One / MS Edge</h2>  <p>It supports for instance <strong>WebGL, Web Audio, Gamepad API</strong> as you can see in this video:</p> <iframe height="480" src="https://www.youtube.com/embed/vz3OZzOP2J4" frameborder="0" width="854" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />We’re using the <a href="https://www.babylonjs.com/index.html?MANSION" target="_blank">Babylon.js Mansion demo</a> on the <strong>Xbox One</strong>. It runs perfectly fine! I’m still amazed by the beauty of the web standards. If you’re following best practices, your code will run everywhere! Even better, I’m using the<strong> Xbox Windows Store app</strong> in this video to stream the video output of my Xbox One on my <strong>Windows 10 PC</strong>. This mean that I can test my web content on my Xbox One without leaving my chair ;)</p> <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0116.image_0C7B0A39.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2133.image_thumb_57DD3EAE.png" width="900" height="506" /></a>&#160; <br /><font size="2"><em>Thanks to the Xbox Windows Store app, you can remotely test the MS Edge Xbox One browser from your Windows 10 PC!     <br />      <br /></em></font>   <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4606.image_79C8A132.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3404.image_thumb_34AFD3FC.png" width="640" height="360" /></a>     <br />Playing to the <a href="https://www.flightarcade.com" target="_blank">WebGL Babylon.js Flight Arcade demo</a> on Xbox One!</p>  <h2>Remote debugging your HTML5 content on Xbox One thanks to Vorlon.js</h2>  <p><a href="https://www.vorlonjs.io" target="_blank">Vorlon.js</a> is an open-source cross-platforms remote debugging tool that has been made to easily remote debug any web page from any device. Let’s check that together in the following video:</p> <iframe height="480" src="https://www.youtube.com/embed/zdiuEwMi8_8" frameborder="0" width="854" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />By simply adding a single script reference at the beginning of your HTML page, you can remote debug your site from any browser using the Vorlon.js dashboard. In this video, I’m checking the support for the <strong>Gamepad API</strong> using the <strong>Modernizr plug-in</strong>, using the <strong>interactive console</strong> to check for potential errors and <strong>to execute JavaScript</strong> on the Xbox One and finally the <strong>DOM Explorer</strong> to update the HTML and <strong>some Flexbox properties</strong>. Again, using the Xbox Windows Store app is very useful to live debug the page. Simply snap it on the left and snap the Vorlon.js dashboard on the right. Even better, use multiple screens on your Windows 10 PC:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8321.image_6104E228.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;border-left: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0830.image_thumb_29BE5AED.png" width="900" height="253" /></a> </p>  <p>I’m definitely more than convinced that Web Standards and <strong>WebGL offer great new possibilities for the gaming industry</strong>! I’ve talked about this in a previous article: <a title="https://blogs.msdn.com/b/davrous/archive/2014/06/20/the-web-the-next-game-frontier.aspx" href="https://blogs.msdn.com/b/davrous/archive/2014/06/20/the-web-the-next-game-frontier.aspx" target="_blank">The web: the next game frontier?</a> It seems to really start to be true. ;-)</p>  <p>David</p>]]></content:encoded>
    </item>
    <item>
      <title>Creating fun &amp; immersive audio experiences with Web Audio</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/creating-fun-immersive-audio-experiences-with-web-audio</link>
      <pubDate>Thu, 05 Nov 2015 14:24:08 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2015/11/05/creating-fun-immersive-audio-experiences-with-web-audio/</guid>
      <description><![CDATA[window.location =...]]></description>
      <content:encoded><![CDATA[<script>window.location = "https://www.davrous.com/2015/11/05/creating-fun-immersive-audio-experiences-with-web-audio/";</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>  <p>Today, thanks to the power of the<strong> Web Audio</strong> API, you can create <strong>immersive audio experiences</strong> directly in the browser. <strong>No need for any plug-in</strong> to create amazing experiences. I’d like to share with you what I’ve learned while building the audio engine of our <a href="https://www.babylonjs.com/" target="_blank">Babylon.js</a> open-source gaming engine. </p>  <p>By the end of this article, you’ll know how to build <a href="https://dev.windows.com/en-us/microsoft-edge/testdrive/demos/musiclounge/" target="_blank">this kind of experience</a>:</p>  <p><a title="Music Lounge WebGL/Web Audio link" href="https://dev.windows.com/en-us/microsoft-edge/testdrive/demos/musiclounge/" target="_blank"><img title="Picture2" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Picture2" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7853.Picture2_7055E5CA.png" width="400" height="241" /></a></p>  <p><strong><u>Usage:</u></strong> move the cubes with your mouse or touch near the center of the white circle to mix <a href="https://soundcloud.com/david-rousset/coding4fun-ms-techdays-2015" target="_blank">my music</a> in this 3D experience using WebGL &amp; Web Audio. View the <a href="https://github.com/MicrosoftEdge/Demos/tree/master/musiclounge" target="_blank">source code</a>. </p>  <h2>Web Audio in a nutshell</h2>  <p>Web Audio is the most advanced audio stack for the web. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6354.Create-fun--immersive-audio-experiences-with-Web-Audio-01_167A986F.png"><img title="Create fun &amp; immersive audio experiences with Web Audio 01" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Create fun &amp; immersive audio experiences with Web Audio 01" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0552.Create-fun--immersive-audio-experiences-with-Web-Audio-01_thumb_018BA6AD.png" width="640" height="327" /></a><font size="1">      <br />From </font><a href="https://www.devbattles.com/en/sand/post-69-Learn-Web-Audio-API"><font size="1">Learn</font></a><font size="1"> <a href="https://www.devbattles.com/en/sand/post-69-Learn+Web+Audio+API">Web Audio API</a></font></p>  <p>If you ever tried to do something else than streaming some sounds or music using the <a href="https://www.w3.org/TR/html5/embedded-content-0.html#the-audio-element" target="_blank">HTML5 audio element</a>, you know how limited it was. Web Audio allows you to break all the barriers and provides you <strong>access to the complete stream</strong> <strong>and audio pipeline </strong>like in any modern native application. It works thanks to an <strong>audio routing graph made of audio nodes</strong>. This gives you <strong>precise control over time, filters, gains, analyzer, convolver and 3D spatialization</strong>. </p>  <p>It’s being <a href="https://dev.windows.com/en-us/microsoft-edge/platform/status/webaudioapi?filter=f3f0000bf&amp;search=web audio" target="_blank">widely supported now</a> (MS Edge, Chrome, Opera, Firefox, Safari, iOS, Android, FirefoxOS and Windows Mobile 10). In MS Edge (but I’m guessing in other browsers too), it’s been <strong>rendered in a separate thread</strong> than the main JS thread. This means that almost all the time, it will have few if <strong>no performance impact</strong> on your app or game. The <strong>codecs supported are at least WAV and MP3</strong> by all browsers and some of them also support OGG. MS Edge even <a href="https://blogs.windows.com/msedgedev/2015/05/26/announcing-dolby-audio-for-high-performance-audio-in-microsoft-edge/" target="_blank">supports the multi-channel Dolby Digital Plus™ audio format!</a>! You then need to pay attention to that to build a web app that will run everywhere and provides potentially multiple sources for all browsers. </p>  <h3>Audio routing graph explained</h3>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1732.Create-fun--immersive-audio-experiences-with-Web-Audio-02_25315331.png"><img title="Create fun &amp; immersive audio experiences with Web Audio 02" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Create fun &amp; immersive audio experiences with Web Audio 02" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4188.Create-fun--immersive-audio-experiences-with-Web-Audio-02_thumb_19C2D1F8.png" width="663" height="397" /></a></p>  <p><strong><u>Note:</u></strong> <em>this picture has been built using the graph displayed into the awesome Web Audio tab of the Firefox DevTools. </em><a href="https://twitter.com/davrous/status/660130281752522752" target="_blank"><em>I love this tool</em></a><em>. :) So much that I’ve planned to mimic it via a <a href="https://www.vorlonjs.io" target="_blank">Vorlon.js</a> plug-in. I’ve started working on it but it’s still very early draft.</em></p>  <p>Let’s have a look to this diagram. Every node can have something as an input and be connected to the input of another node. In this case, we can see that MP3 files act as the source of the <strong>AudioBufferSource</strong> node, connected to a <strong>Panner</strong> node (which provides spatialization effects), connected to <strong>Gain</strong> nodes (volume), connected to an <strong>Analyser</strong> node (to have access to frequencies of the sounds in real-time) finally connected to the <strong>AudioDestination</strong> node (your speakers). You see also you can control the volume (gain) of a specific sound or several of them at the same time. For instance, in this case, I’ve got a “global volume” being handled via the final gain node just before the destination and some kind of tracks’ volume with some gains node placed just before the analyser node.</p>  <p>Finally, Web Audio provides 2 <a href="https://en.wikipedia.org/wiki/Psychoacoustics" target="_blank">psychoacoustics</a> models to simulate spatialization:</p>  <p>- <strong>equalpower</strong> (set by default) to support classic speakers for your laptop or floorstanding speakers.     <br />- <strong>HRTF</strong> which provides the best results with an headphone as it simulates <a href="https://en.wikipedia.org/wiki/Binaural_recording" target="_blank">binaural recording</a>.</p>  <p><strong><u>Note:</u></strong> <em>MS Edge currently only supports equalpower. </em></p>  <p>And you’re set for the basics. To start playing with some code, I would suggest you reading those great resources:</p>  <p>- The W3C spec: <a title="https://webaudio.github.io/web-audio-api/" href="https://webaudio.github.io/web-audio-api/">https://webaudio.github.io/web-audio-api/</a>. Again, I’ve learned a lot by simply reading the spec.     <br />- <a title="https://www.html5rocks.com/en/tutorials/webaudio/intro/" href="https://www.html5rocks.com/en/tutorials/webaudio/intro/" target="_blank">Getting Started with Web Audio API</a>, <a title="https://www.html5rocks.com/en/tutorials/webaudio/games" href="https://www.html5rocks.com/en/tutorials/webaudio/games" target="_blank">Developing Game Audio with the Web Audio API</a> and <a title="https://www.html5rocks.com/en/tutorials/webaudio/positional_audio" href="https://www.html5rocks.com/en/tutorials/webaudio/positional_audio" target="_blank">Mixing Positional Audio and WebGL</a> on HTML5 Rocks. Definitely awesome content. They sometimes contain deprecated links to demos (using previous web audio specifications) but they’re still very relevant most the time. Beware also of the codec being used in the demo, it couldn’t be supported by your browser.     <br />- <a title="https://blogs.windows.com/msedgedev/2015/05/19/bringing-web-audio-to-microsoft-edge-for-interoperable-gaming-and-enthusiast-media/" href="https://blogs.windows.com/msedgedev/2015/05/19/bringing-web-audio-to-microsoft-edge-for-interoperable-gaming-and-enthusiast-media/" target="_blank">Bringing Web Audio to Microsoft Edge for interoperable gaming and enthusiast media</a> which is one of the most recent and thus accurate resource. </p>  <p>For instance, let’s imaging we’d like to create such an audio graph:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8475.Create-fun--immersive-audio-experiences-with-Web-Audio-03_31724809.png"><img title="Create fun &amp; immersive audio experiences with Web Audio 03" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Create fun &amp; immersive audio experiences with Web Audio 03" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3000.Create-fun--immersive-audio-experiences-with-Web-Audio-03_thumb_0A3A8F85.png" width="640" height="141" /></a></p>  <p>I’d like to play 2 synchronized music that will each have its own gain connected to their own analyser. This means that we’ll be able to display the frequencies of each music on separate canvas and play with the volume of each one separately also. Finally, we will have a global volume that will act on both music at the same time and a third analyser that will display the frequencies on both music cumulated on a third canvas. </p>  <p>You’ll find the demo here: <a title="https://david.blob.core.windows.net/webaudio/demos/articlesample1/analysersSample.html" href="https://david.blob.core.windows.net/webaudio/demos/articlesample1/analysersSample.html" target="_blank">analysersSample.html</a> </p>  <p><a href="https://david.blob.core.windows.net/webaudio/demos/articlesample1/analysersSample.html" target="_blank"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8168.image_251DA967.png" width="640" height="191" /></a></p>  <p>Simply have a look to the source code using your favorite browser and it’s F12 tool. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3058.image_4438E9D4.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6114.image_thumb_738A5F5E.png" width="900" height="435" /></a></p>  <p><strong>sound.js</strong> is abstracting the logic to load a sound, decode it and play it. <strong>analyser.js</strong> is abstracting the job to do to use the Web Audio analyser and display frequencies on a 2D canvas. Finally, <strong>analysersSample.js</strong> is using both files to create the above result. </p>  <p>Play with the sliders to act on the volume on each track or on the global volume to review what’s going on. For instance, try to understand if you’re putting the global volume to 0, why can you still see the 2 analysers showing data on the right?</p>  <p>To be able to play the 2 tracks synchronized, you just need to load them via a XHR2 request, decode the sound and as soon as those 2 asynchronous operations are done, simply call the Web Audio play function on each of them. </p>  <h2>Web Audio in Babylon.js</h2>  <h3>Basics</h3>  <p>I wanted to keep our “<em>simple &amp; powerful</em>” philosophy while working on the audio stack. Even if Web Audio is not that complicated, it’s still very verbose to me and you’re quickly doing boring and repetitive tasks to build your audio graph. My objective was then to encapsulate that to provide a very simple abstraction layer and to let people <strong>create 2D or 3D sounds without being a sound engineer</strong>. </p>  <p>Here is the signature we’ve chosen to create a sound:</p>  <pre class="code"><span style="color: blue">var </span><span style="color: black">newSound = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;nameofyoursound&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;URLToTheFile&quot;</span><span style="color: black">, yourBabylonScene,
                                callbackFunctionWhenSoundReadyToBePlayed,
                                optionsViaJSONObject);</span></pre>

<p>For instance, here is how to create new sounds in Babylon.js:</p>

<pre class="code"><span style="color: blue">var </span><span style="color: black">sound1 = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;sound1&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;./sound1.mp3&quot;</span><span style="color: black">, scene,
                                </span><span style="color: blue">null</span><span style="color: black">, { loop: </span><span style="color: blue">true</span><span style="color: black">, autoplay: </span><span style="color: blue">true </span><span style="color: black">});

</span><span style="color: blue">var </span><span style="color: black">sound2 = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;sound2&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;./sound2.wav&quot;</span><span style="color: black">, scene,
                                </span><span style="color: blue">function </span><span style="color: black">() { sound2.play(); },
                                { playbackRate: 2.0 });

</span><span style="color: blue">var </span><span style="color: black">streamingSound = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;streamingSound&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;./sound3.mp3&quot;</span><span style="color: black">, scene,
                                </span><span style="color: blue">null</span><span style="color: black">, { autoplay: </span><span style="color: blue">true</span><span style="color: black">, streaming: </span><span style="color: blue">true </span><span style="color: black">});</span></pre>

<p>First sound will be played automatically in loop as soon as it will be loaded from the web server and decoded by Web Audio. </p>

<p>Second sound will be played once thanks to the callback function that will trigger the <i>play()</i> function on it once decoded and ready to be played. It will be played also at a 2x playback rate. </p>

<p>The last sound is using the <em><strong>“streaming: true</strong></em>” option. It means we’ll use the <strong>HTML5 Audio element</strong> instead of doing a XHR2 request and using a Web Audio <i>AudioBufferSource</i> object. It could be useful if you’d like to stream a music rather than waiting to download it completely. Still, you can apply all the magic of Web Audio on top of this HTML5 Audio element: analyser, 3D spatialization and so on. </p>

<p>You can play with this logic into our playground such as with this very simple sample: <a title="https://www.babylonjs-playground.com/index.html?22" href="https://www.babylonjs-playground.com/index.html?22">https://www.babylonjs-playground.com/index.html?22</a></p>

<h3>Engine, Tracks and memory foot print</h3>

<p>The Web Audio audio context is only created at the very last moment. When the Babylon.js audio engine is created in the Babylon.js main engine constructor, it only checks for Web Audio support and set a flag. Also, every sound is living inside a sound track. By default, the sound will be added into the main sound track attached to the scene. </p>

<p>The Web Audio context and the main track (containing its own gain node attached to the global volume) are really created only after the very first call to <i>new BABYLON.Sound().</i></p>

<p>We’ve done that to avoid creating some audio resources for scenes that won’t use audio, which is today the case of most of our scenes hosted on <a href="https://www.babylonjs.com">https://www.babylonjs.com</a>. Still, the audio engine is ready to be called at any time. This helps us also to detach the audio engine from the core game engine if we’d like to build a core version of Babylon.js without any audio code inside it to make it more lightweight. At last, we’re currently working with big studios that pay of lot of attention to resources being used. </p>

<p>To better understand that, we’re going to use Firefox and its Web Audio tab.</p>

<p>- Navigate to: <a title="https://www.babylonjs-playground.com/" href="https://www.babylonjs-playground.com/">https://www.babylonjs-playground.com/</a> and open the Web Audio tab via F12. You should see that:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5758.image_20CD5CF4.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0574.image_thumb_0BDE6B32.png" width="640" height="183" /></a></p>

<p>No audio context has been created yet. </p>

<p>- Into the playground editor on the left, add this line of code just before “<em>return scene</em>” for instance:</p>

<pre class="code"><span style="color: blue">var </span><span style="color: black">music = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;Violons&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;sounds/violons11.wav&quot;</span><span style="color: black">,
                scene, </span><span style="color: blue">null</span><span style="color: black">, { loop: </span><span style="color: blue">true</span><span style="color: black">, autoplay: </span><span style="color: blue">true </span><span style="color: black">});</span></pre>

<p>- You should now see this audio graph in F12:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3247.image_18D84B43.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8836.image_thumb_021903BA.png" width="640" height="183" /></a></p>

<p>The audio context has been dynamically created after the first call to <em>new BABYLON.Sound()</em> as well as the main volume, the main track volume and the volume associated to this sound. </p>

<h3>3D Sounds </h3>

<h4>Basics</h4>

<p>Web Audio is highly inspired by models used in libraries such as <a href="https://www.openal.org/">OpenAL</a> (Open Audio Library) for 3D. <strong>Most of the 3D complexity will then be handled for you by Web Audio</strong>. It will handle the 3D position of the sounds, their direction and their velocity (to apply a <a href="https://en.wikipedia.org/wiki/Doppler_effect">Doppler effect</a>). </p>

<p>As a developer, you then need to ask to Web Audio to position your sound in the 3D space and to set and/or update the position and orientation of the <a href="https://webaudio.github.io/web-audio-api/#AudioListener">Web Audio listener</a> (your virtual ears) using the <em>setPosition()</em> and <em>setOrientation()</em> function. But if you’re not a 3D guru, it could be a bit complex. That’s why, we’re doing that for you in Babylon.js. We’re updating the Web Audio listener with the position of our camera in the 3D world. It’s <strong>like some virtual ears </strong>(the listener)<strong> were stick onto some virtual eyes </strong>(the camera). </p>

<p>Up to now, we’ve been using 2D sound. To transform a sound into a spatial sound, you need to specify that via the options:</p>

<pre class="code"><span style="color: blue">var </span><span style="color: black">music = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;music&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;music.wav&quot;</span><span style="color: black">,
    scene, </span><span style="color: blue">null</span><span style="color: black">, { loop: </span><span style="color: blue">true</span><span style="color: black">, autoplay: </span><span style="color: blue">true</span><span style="color: black">, spatialSound: </span><span style="color: blue">true </span><span style="color: black">});</span></pre>

<p>Default properties of a spatial sound are:</p>

<p><strong>- distanceModel</strong> (the attenuation) is using a “<strong>linear</strong>” equation by default. Other options are “<em>inverse</em>” or “<em>exponential</em>”. 

  <br />- <strong>maxDistance</strong> is set to <strong>100</strong>. This means that once the listener is farther than 100 units from the sound, the volume will be 0. You can’t hear the sound anymore 

  <br />- <strong>panningModel</strong> is set to “<strong>equalpower</strong>” following the specifications. The other available option is “<em>HRTF</em>”. The specification says it’s: “<em>a higher quality spatialization algorithm using a convolution with measured impulse responses from human subjects. This panning method renders stereo output</em>”. This is the best algorithm when using a headphone.</p>

<p><strong>maxDistance</strong> is only used when using the “<em>linear</em>” attenuation. Otherwise, you can tune the attenuation of the other models using the <strong>rolloffFactor</strong> and <strong>refDistance</strong> options. Both are set to 1 by default but you can change it of course.</p>

<p>For instance:</p>

<pre class="code"><span style="color: blue">var </span><span style="color: black">music = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;music&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;music.wav&quot;</span><span style="color: black">,
    scene, </span><span style="color: blue">null</span><span style="color: black">, {
        loop: </span><span style="color: blue">true</span><span style="color: black">, autoplay: </span><span style="color: blue">true</span><span style="color: black">, spatialSound: </span><span style="color: blue">true</span><span style="color: black">,
        distanceModel: </span><span style="color: #a31515">&quot;exponential&quot;</span><span style="color: black">, rolloffFactor: 2
    });</span></pre>

<p>Default position of sound in the 3D world is <em>(0,0,0)</em>. To change that, use the <em>setPosition()</em> function:</p>

<pre class="code"><span style="color: black">music.setPosition(</span><span style="color: blue">new </span><span style="color: black">BABYLON.Vector3(100, 0, 0));</span></pre>

<p>To have a better understanding, please <a href="https://www.babylonjs-playground.com/#2AH4YH" target="_blank">have a look to this sample</a> into our playground: </p>

<p><a href="https://www.babylonjs-playground.com/#2AH4YH" target="_blank"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4810.image_57E42009.png" width="640" height="344" /></a></p>

<p>Move into the scene using keyboard &amp; mouse. Each sound is represented by a purple sphere. When you’re entering a sphere, you’ll start hearing one the music. The sound is louder at the center of the sphere and fall down to 0 when leaving the sphere. You’ll also notice that the sound is being balanced between the right &amp; left speakers as well as front / rear (which is harder to notice using only classic stereo speakers). </p>

<h4>Attaching a sound to a mesh</h4>

<p>The previous demo is cool but didn’t reach my “<strong>simple &amp; powerful</strong>” bar. I wanted something even more simple to use. I finally ended up with the following approach.</p>

<p>Simply create a <em>BABYLON.Sound</em>, attach it to an existing mesh and you’re done! Only 2 lines of code! If the mesh is moving, the sound will move with it. You have nothing to do, everything else is being handled by Babylon.js.&#160; </p>

<p>Here’s the code to use:</p>

<pre class="code"><span style="color: blue">var </span><span style="color: black">music = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;Violons&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;sounds/violons11.wav&quot;</span><span style="color: black">,
            scene, </span><span style="color: blue">null</span><span style="color: black">, { loop: </span><span style="color: blue">true</span><span style="color: black">, autoplay: </span><span style="color: blue">true </span><span style="color: black">});

</span><span style="color: green">// Sound will now follow the box mesh position
</span><span style="color: black">music.attachToMesh(box);</span></pre>

<p>Calling the <em>attachToMesh()</em> function on a sound will transform it automatically into a spatial 3D sound. Using the above code, you’ll fall into default Babylon.js values: a <em>linear</em> attenuation with a <em>maxDistance</em> of 100 and a panning model of type “<em>equalpower</em>”.</p>

<p>Put your headphone and <a href="https://www.babylonjs-playground.com/index.html?23" target="_blank">launch this sample into our playground</a>:</p>

<p><a href="https://www.babylonjs-playground.com/index.html?23" target="_blank"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1641.image_48FD5C42.png" width="640" height="344" /></a></p>

<p>Don’t move the camera. You should hear my music rotating around your head as the cube is moving. Want to have an <strong>even better experience with your headphone?</strong></p>

<p>Launch the same demo into a browser supporting HRTF (like Chrome or Firefox), click on the “<strong>Debug layer</strong>” button to display it and scroll down to the audio section. <strong>Switch</strong> the current panning model <strong>from “Normal speakers”</strong> (equalpower)<strong> to “Headphone”</strong> (HRTF). You should enjoy a slightly better experience. If not, change your headphone… or your ears. ;-)</p>

<p><a href="https://www.babylonjs-playground.com/index.html?23" target="_blank"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3286.image_7BFE8385.png" width="640" height="344" /></a></p>

<p><strong><u>Note:</u></strong> you can also move into the 3D scene using arrow keys &amp; mouse (like in a FPS game) to check the impact of the 3D sound positioning. </p>

<h4><a href="https://doc.babylonjs.com/tutorials/16._Playing_sounds_and_music#creating-a-spatial-directional-3d-sound" name="creating-a-spatial-directional-3d-sound"></a>Creating a spatial directional 3D sound</h4>

<p>By default, spatial sounds are omnidirectional. But you can have directional sounds if you’d like to.</p>

<p><strong><u>Note:</u></strong> directional sounds only work for spatial sounds attached to a mesh. </p>

<p>Here is the code to use:</p>

<pre class="code"><span style="color: blue">var </span><span style="color: black">music = </span><span style="color: blue">new </span><span style="color: black">BABYLON.Sound(</span><span style="color: #a31515">&quot;Violons&quot;</span><span style="color: black">, </span><span style="color: #a31515">&quot;violons11.wav&quot;</span><span style="color: black">, scene, </span><span style="color: blue">null</span><span style="color: black">, { loop: </span><span style="color: blue">true</span><span style="color: black">, autoplay: </span><span style="color: blue">true </span><span style="color: black">});
music.setDirectionalCone(90, 180, 0);
music.setLocalDirectionToMesh(</span><span style="color: blue">new </span><span style="color: black">BABYLON.Vector3(1, 0, 0));
music.attachToMesh(box);</span></pre>

<p>setDirectionalCone takes 3 parameters:</p>

<p><strong>- coneInnerAngle</strong>: size of the inner cone in degree 

  <br />- <strong>coneOuterAngle</strong>: size of the outer cone in degree 

  <br />- <strong>coneOuterGain</strong>: volume of the sound when you’re outside the outer cone (between 0.0 and 1.0)</p>

<p>Outer angle of the cone must be superior or equal to the inner angle, otherwise an error will be logged and the directional sound won’t work. </p>

<p><em>setLocalDirectionToMesh()</em> is simply the orientation of the cone related to the mesh you’re attached to. By default, it’s <em>(1,0,0)</em>. On the right of the object if you want to.</p>

<p>You can play with <a href="https://www.babylonjs-playground.com/#1BO0YS" target="_blank">this sample from our playground</a> to better understand the output: </p>

<p><a href="https://www.babylonjs-playground.com/#1BO0YS" target="_blank"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1614.image_326F3588.png" width="640" height="344" /></a></p>

<p>Move into the 3D scene. If you’re inside the<strong> space defined by the grey cone</strong>, you should hear the music, if not you’ll not hear it as the <strong>coneOuterGain</strong> is set to 0. </p>

<h3>Going further</h3>

<p>Play with our famous <strong>Mansion Web Audio</strong> <a href="https://www.babylonjs.com/index.html?MANSION" target="_blank">demo</a>:</p>

<p><a href="https://www.babylonjs.com/index.html?MANSION" target="_blank"><img title="mansion" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="mansion" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6747.mansion_1290737E.jpg" width="280" height="175" /></a><a href="https://www.babylonjs.com/index.html?MANSION" target="_blank"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2475.image_5496E2BF.png" width="311" height="175" /></a><a href="https://www.babylonjs.com/index.html?MANSION" target="_blank"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0743.image_06FD46F0.png" width="311" height="175" /></a></p>

<p>Try to find the interactive objects in the Mansion scene, they’re almost all associated to a sound. To build this scene, our 3D artist, <strong>Michel Rousseau, hasn’t use a single line of code!</strong> He made it entirely using our new Actions Builder tool and 3DS Max. The Actions Builder is indeed currently only available in our 3DS Max exporter. We will soon expose it into our <a href="https://www.babylonjs.com/sandbox" target="_blank">sandbox tool</a>. If you’re interested in building a similar experience, please read those articles:</p>

<p>- <a title="https://medium.com/babylon-js/actions-builder-b05e72aa541a" href="https://medium.com/babylon-js/actions-builder-b05e72aa541a" target="_blank">Actions Builder</a> from <a href="https://twitter.com/Luaacro" target="_blank">Julien Moreau-Mathis</a>, our Babylon.js awesome intern who made the tool 

  <br />- <a title="https://blogs.msdn.com/b/designmichel/archive/2015/10/20/create-actions-in-babylonjs.aspx" href="https://blogs.msdn.com/b/designmichel/archive/2015/10/20/create-actions-in-babylonjs.aspx" target="_blank">Create actions in BabylonJS</a> by <a href="https://twitter.com/rousseau_michel" target="_blank">Michel Rousseau</a>. He explains here how to use actions in a basic way. He has used the same approach to build the <a href="https://www.babylonjs.com/index.html?MANSION" target="_blank">Mansion demo</a> as the Actions Builder also supports sound actions.</p>

<p>But, the best thing to definitely understand and learn how we’ve been using Web Audio in our gaming engine is <strong>by reading our source code</strong>:</p>

<p>- <a href="https://github.com/BabylonJS/Babylon.js/blob/master/src/Audio/babylon.audioEngine.ts" target="_blank">BABYLON.AudioEngine</a> being created by the Babylon.js core engine as static. 

  <br />- <a href="https://github.com/BabylonJS/Babylon.js/blob/master/src/Audio/babylon.soundtrack.ts" target="_blank">BABYLON.SoundTrack</a> containing several sounds. You have at least one track being created if you’re creating a sound, this is the main track. 

  <br />- <a href="https://github.com/BabylonJS/Babylon.js/blob/master/src/Audio/babylon.sound.ts" target="_blank">BABYLON.Sound</a> containing the main logic you’ll interact with 

  <br />- <a href="https://github.com/BabylonJS/Babylon.js/blob/master/src/Audio/babylon.analyser.ts" target="_blank">BABYLON.Analyser</a> that can be attached to the audio engine itself (to view the output via the global volume) or on a specific track. </p>

<p>Please also have a look into <a href="https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts" target="_blank">BABYLON.Scene</a> and the <b>_updateAudioParameters()</b> function to understand how we’re updating the Web Audio listener based on the current position &amp; orientation of the camera. </p>

<p>Finally, here are some useful resources to read:</p>

<p>- <a href="https://doc.babylonjs.com/tutorials/16._Playing_sounds_and_music" target="_blank">Babylon.js audio documentation</a> 

  <br />- <a href="https://www.flightarcade.com/learn/webaudio" target="_blank">Learn Web Audio with the Flight Arcade experience</a> where you’ll learn stuff I haven’t implemented yet in Babylon.js like convolvers. </p>

<h2>Building a demo using multitracks &amp; analysers</h2>

<p>In order to show you what you can quickly do with our Babylon.js audio stack, I’ve built <a href="https://david.blob.core.windows.net/webaudio/demos/articlesample2/multitracks.html" target="_blank">this fun demo</a>:</p>

<p><a href="https://david.blob.core.windows.net/webaudio/demos/articlesample2/multitracks.html" target="_blank"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5543.image_3FCAFA06.png" width="900" height="388" /></a></p>

<p>It uses several features from Babylon.js such as the <strong>assets loader</strong> that will automatically load the remote WAV files and display a default loading screen, <strong>multi sounds tracks </strong>and several <strong>analyser objects</strong> being connected to the sound tracks.</p>

<p>Please have a look to the source code of <strong><u>multitracks.js</u></strong> via your F12 tool to check how it works. </p>

<p><a href="https://david.blob.core.windows.net/webaudio/demos/articlesample2/multitracks.html" target="_blank">This demo</a> is based on a music I’ve already composed in the past that I’ve slightly re-arranged: <a title="https://soundcloud.com/david-rousset/the-geek-council" href="https://soundcloud.com/david-rousset/the-geek-council" target="_blank">The Geek Council</a>. You can do your own mixing for the first part of the music by playing with the sliders. You can click as many time and as quickly as possible on the “<em><strong>Epic cymbals</strong></em>” button to add a dramatic effect. Finally, click on the “<em><strong>Initiate epic end sequence</strong></em>”. It will wait for the end of the current loop and will stop the 4 first tracks (drums, epic background, pads &amp; horns) to play the final epic sequence! :) Click on the “<em><strong>Reset</strong></em>” button to restart from the beginning.</p>

<p><strong><u>Note:</u></strong> it turns out that to<strong> have great sounds loops</strong>, without any glitch, <strong>you need to avoid using MP3</strong> as explained in this <a href="https://www.html5gamedevs.com/topic/10976-seamless-loop/" target="_blank">forum</a>: “<em>The simplest solution is to just not use .mp3. If you use .ogg or .m4a instead you should find the sound loops flawlessly, as long as you generate those files from the original uncompressed audio source, not from the mp3 file! The process of compressing to mp3 inserts a few ms of silence at the start of the audio, making mp3 unsuited to looping sounds. I read somewhere that the silence is actually supposed to be file header information but it incorrectly gets treated as sound data!</em>”. That’s why, I’m using WAV files in this demo. It’s the only clean solution working accross all browsers. </p>

<h2>And what about the Music Lounge demo?</h2>

<p>The <a href="https://dev.windows.com/en-us/microsoft-edge/testdrive/demos/musiclounge/" target="_blank">music lounge demo</a> is basically re-using everything being described before. But you’re missing a last piece to be able to recreate it as it’s based on a feature I haven’t explained yet: the customAttenuationFunction.</p>

<p>You’ve got the option to<strong> provide your own attenuation function</strong> to Babylon.js to replace the default one provided by Web Audio (linear, exponential and inverse) as <a href="https://doc.babylonjs.com/tutorials/16._Playing_sounds_and_music#creating-your-own-custom-attenuation-function" target="_blank">explained in our documentation</a>.</p>

<p>For instance, if you’re trying this <a href="https://www.babylonjs-playground.com/#1YIXEO" target="_blank">playground demo</a>, you’ll see I’m using this stupid attenuation function:</p>

<pre class="code"><span style="color: black">music.setAttenuationFunction(</span><span style="color: blue">function </span><span style="color: black">(currentVolume, currentDistance,
                                maxDistance, refDistance, rolloffFactor) {
    </span><span style="color: blue">return </span><span style="color: black">currentVolume * currentDistance / maxDistance;
});</span></pre>

<p>Near the object, volume is almost 0. The further, the louder. It’s completely counter intuitive but it’s a sample to give you the idea. </p>

<p>In the case of the Music Lounge demo, it has been very useful. Indeed, the volume of each track doesn’t depend on the distance of each cube from the camera but on the distance between the cube and the center of the white circle. If you’re looking at the <a href="https://github.com/MicrosoftEdge/Demos/blob/master/musiclounge/src/musicLounge.soundCube.ts" target="_blank">source code</a>, the magic happens here:</p>

<pre class="code"><span style="color: black">attachedSound.setAttenuationFunction((currentVolume, currentDistance,
                            maxDistance, refDistance, rolloffFactor) =&gt; {
    </span><span style="color: blue">var </span><span style="color: black">distanceFromZero = BABYLON.Vector3.Zero()
                        .subtract(</span><span style="color: blue">this</span><span style="color: black">._box.getBoundingInfo().boundingSphere.centerWorld)
                        .length();

    </span><span style="color: blue">if </span><span style="color: black">(distanceFromZero &lt; maxDistance) { 
        </span><span style="color: blue">return </span><span style="color: black">currentVolume * (1 - distanceFromZero / maxDistance); 
    } 
    </span><span style="color: blue">else </span><span style="color: black">{ 
        </span><span style="color: blue">return </span><span style="color: black">0; 
    }
});</span></pre>

<p>We’re computing the distance between the current cube (this._box) and the (0,0,0) coordinates which happens to be the center of the circle. Based on this distance, we’re setting a linear attenuation function for the volume of the sound associated to the cube. Rest of the demo is using sounds attached to the various meshes (the cubes) and an analyser object connected to the global volume to animate the outer circle made of particles. </p>

<p>I hope you’ll enjoy this article as much as I had writing it. I also hope that it will bring you <strong>new</strong> <strong>ideas to create cool Web Audio / WebGL applications</strong> or demos!</p>

<p>David</p>

<p><a class="twitter-follow-button" href="https://twitter.com/davrous">Follow @davrous</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Guide du speaker intergalactique (ou comment augmenter ses chances d’être retenu en tant que speaker en conférences au sein de l’univers)</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/guide-du-speaker-intergalactique-ou-comment-augmenter-ses-chances-dtre-retenu-en-tant-que-speaker-en-confrences-au-sein-de-lunivers</link>
      <pubDate>Fri, 11 Sep 2015 01:31:42 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2015/09/11/guide-du-speaker-intergalactique-ou-comment-augmenter-ses-chances-dtre-retenu-en-tant-que-speaker-en-confrences-au-sein-de-lunivers/</guid>
      <description><![CDATA[window.location =...]]></description>
      <content:encoded><![CDATA[<script>window.location = "https://www.davrous.com/2015/09/11/guide-du-speaker-intergalactique-ou-comment-augmenter-ses-chances-dtre-retenu-en-tant-que-speaker-en-confrences-au-sein-de-lunivers/";</script>
<p>J’ai la chance d’être « speaker » (orateur en bon vieux français) depuis plusieurs années dans différentes conférences, principalement grâce à mon job. Donc j’avoue, déjà, je triche. Mais j’organise aussi des évènements pour le compte de Microsoft où j’ai ainsi la lourde charge de devoir choisir des speakers pour les <strong>Techdays</strong> par exemple. Tout cela mélangé, j’ai l’impression d’avoir désormais une bonne vision du métier, de ses travers et de ce qu’il faut faire pour bien faire. </p>  <p>Tous les ans, c’est la même histoire. <strong>Certains rêvent d’être orateur mais ils sortent de nulle part</strong>. Tout du moins, je ne les connais pas et je n’ai aucun moyen d’en savoir davantage sur eux. Aussi, j’aimerais partager avec vous ma vision très personnelle du processus de sélection.</p>  <p><b><u>Note :</u></b> oui, cet article est très personnel. Mais je pense que la plupart de mes collègues gérant les tracks des Techdays ou d’autres conférences doivent partager une grande partie de mon point de vue. Malgré tout, je ne suis pas à l’abris de passer pour un sombre abruti à vos yeux et je respecterais votre point de vue ! </p>  <p>Commençons par parler des <strong>qualités importantes</strong> pour être un bon speaker. Nous verrons ensuite comment nous sélectionnons les orateurs et comment, du coup, vous pouvez augmenter vos chances d’être retenu. </p>  <p><a href="https://www.julienrio.com/marketing/french/guide-ultime-orateur-succes" target="_blank"><img title="clip_image001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0777.clip_image001_315AA868.jpg" width="600" height="388" /></a></p>  <p>A noter que je ne parlerais pas des fameuses techniques pour rendre votre présentation plus attrayante, de comment créer une connexion émotionnelle avec votre public ou ce genre de trucs. Vous trouverez pleins de choses plus ou moins intéressantes sur le net à ce sujet. </p>  <h2>C’est quoi la différence entre un bon et un mauvais speaker ?</h2>  <p>Bah le mauvais speaker, il monte sur scène, il fait son show avec des slides et des exemples techniques puis il part tu vois. Mais il a été mauvais. Tant dis que le bon speaker, bah, il monte sur scène mais il fait son show ! Avec des slides et des exemples techniques en plus et là, boom ! Telle une star, il part dans un nuage de fumée. Tu vois ?</p>  <p>Non. Je vois bien que tu ne vois pas. </p>  <p>Etre speaker, c’est <b>avant tout avoir l’envie de partager quelque chose d’intéressant</b> à des gens qui font l’effort de t’écouter. Cela implique du coup 2 choses importantes : avoir envie de <b>partager</b> et avoir un truc <b>intéressant</b> à dire. </p>  <p>Il faut en effet savoir que les gens qui viennent en conférence n’en ont rien à carrer de la tronche du speaker qui monte sur scène. Les gens ne viennent pas vous voir vous, ils viennent apprendre et écouter ce que vous avez à partager. Il existe certes quelques rares « méga stars » que l’on souhaite voir car ils ont non seulement quelque chose de super intéressant à dire tout en excellant dans le rôle de l’orateur. En général, ils ont créé un truc énorme (un logiciel, un concept, une entreprise), sont des orateurs hors pair et bossent de surcroît comme des chiens leurs présentations. Mais soyons honnête, il y a très peu de chance que vous apparteniez à cette catégorie de niche. Mais ce n’est pas grave, ce n’est pas ce que l’on recherche le plus. </p>  <p>Par contre, si vous êtes juste un mégalo de service qui souhaitez monter sur scène pour monter sur scène, passez votre chemin. Vous n’avez pas trouvé le bon domaine où exprimer cela. Vous allez souler les gens qui ont autre chose à faire que de supporter votre melon surdimensionné. Essayez de faire comique, chanteur dans le métro, j’sais pas moi, mais autre chose. Le problème, c’est que j’ai l’impression d’avoir souvent affaire à des mégalos en puissance. Malgré tout, il faut bien sûr être un chouilla sûr de soi pour oser monter sur scène et prendre la parole en public. Un timide maladif va surement stresser l’audience. Ce n’est pas grave. <b>Monter sur scène n’est pas le but ultime dans la vie</b>. Si tu n’as pas les qualités nécessaires pour parler devant beaucoup de gens, il reste d’autre moyens pour partager ton savoir et ta passion : écrire des articles, des exemples de code, participer à un projet communautaire, faire des petites vidéos. Bref, pleins d’autres formes d’expressions. </p>  <p>Ensuite, voici ce que je recherche personnellement dans les talents d’un bon orateur :</p>  <p>- <b>Humble</b>. Les gars, c’est de l’informatique. On n’est pas là pour sauver la planète donc ne cherchez pas à vous la raconter. En général, ce que l’on fait n’a rien de compliqué donc n’essayez pas de faire croire aux gens le contraire. Vous êtes là pour pousser les gens vers le haut, pas les écraser sous votre soi-disant expertise qui cache souvent une vraie incompétence ou un complexe d’infériorité.</p>  <p>- <b>Pédagogue. </b>On avait beau se moquer de nos profs quand on était « piti », cela n’est pas donné à tout le monde d’expliquer de manière claire un concept qui semble parfois compliqué.<b></b></p>  <p>- <b>Dynamique</b>. Il faut du rythme (mais pas trop) pour éviter que les gens dans la salle ne s’endorment au chaud dans leur siège tout en regardant leurs emails sur leurs téléphones. Il faut savoir alterner théorie, pratique et interaction avec la salle.<b></b></p>  <p>- <b>Autocritique</b>. Il faut être capable de s’apercevoir que l’on a délivré une mauvaise conférence ou que l’on a tout simplement pas été bon. Des fois, ce n’est pas forcément totalement de sa faute : fatigue, maladie, problèmes liés à la salle. Mais souvent, cela vient de nous : hors sujet, sujet trop complexe ou mal abordé, mauvaise préparation. Ce n’est pas grave de foirer une conférence, il faut juste en avoir conscience pour s’améliorer la prochaine fois. Autre point : <b>s’exposer, c’est prendre un risque</b>. Le risque d’être jugé, le risque d’être contredit, le risque d’avoir mal compris ou expliqué. Mais rassurez-vous, c’est bien plus noble d’essayer de partager en s’exposant que de basher tranquillement derrière son écran à l’abris, tel un petit lâche. <b></b></p>  <p>- <b>Va à l’essentiel</b>. Souvent, une conférence dure de 4 min (Lightning Talks) à 60 min max et la plupart du temps autour des 30/40 min. Ce n’est donc pas une formation ! Il faut donc quelqu’un qui soit synthétique et qui sache éviter de rentrer dans des détails inutiles ou de « live coder » des trucs absurdes qui lui font perdre du temps. Mais souvent, le fait qu’il soit humble évite naturellement ce genre de délires <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Clignement d&#039;œil" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1614.wlEmoticon-winkingsmile_0A0F4C95.png" /></p>  <p>- <b>Réactif et attentif à la salle</b>. Il y a souvent beaucoup de gens dans la salle. Aux <a href="https://www.mstechdays.fr" target="_blank">Techdays</a>, cela va de 10 à 800 personnes, donc vous avez beaucoup à apprendre de la salle. Essayez de voir comment la salle réagie en observant par exemple le langage corporel des gens pour vous adapter en temps réel. Cela va vous permettre de voir si personne ne capte rien à ce que vous dites car vous n’êtes pas clair ou au contraire si vous n’allez pas assez vite car vous balancez des lieux communs. C’est un exercice difficile mais vraiment super intéressant.</p>  <p>- <b>Technique</b>. Pour moi, c’est le moins important de toute la liste. Malgré tout, il faut évidemment être relativement bon techniquement. Mais soyons honnête, c’est assez facile de trouver quelqu’un de bon techniquement (n’importe qui peut le devenir s’il se donne la peine). C’est bien plus difficile de trouver quelqu’un qui dispose des talents précédents. Pourtant, presqu’à chaque fois que l’on me contacte, on me vante avant tout ses qualités techniques en tant que consultant interplanétaires de telle ou telle techno. Je vais vous avouer un truc : je m’en fous. Je cherche un bon speaker. ;)</p>  <p>Cette liste est plus ou moins par ordre décroissant d’importance, de mon point de vue. </p>  <p>Parmi les exemples qui m’empêchent de dormir la nuit : le <b>speaker monotone et hésitant</b>, qui ne regarde jamais les gens, uniquement le mur (surement un fils de peintre en bâtiment), a retenu un sujet chiant, qu’il traite en plus super mal et qui balance des exemples de code super compliqués, sans lien évident, le tout à pleine vitesse. Bah oui, cela va surement impressionner la salle. Poubelle direct. Qu’il fasse cela devant sa mère ou son animal de compagnie si cela l’amuse mais qu’il évite de faire perdre du temps aux gens. Merci. </p>  <p>J’ai déjà bien entendu vu également un autre spécimen intéressant : l’<b>ultra arrogant.</b> Il pense que sans lui, l’informatique est perdue. En général, il prétend avoir déjà inventé une centaine d’algorithmes ou patterns révolutionnaires à lui seul. Ou alors mieux : que tout simplement la conférence n’a pas lieu d’être sans lui. Ne rigolez pas, ils existent vraiment. </p>  <p>Ils sont souvent dynamiques, peuvent étonnamment avoir des choses intéressantes à dire et combinent plusieurs des talents qui me paraissent importants. Mais ils génèrent malheureusement une étrange réaction dans l’assistance : une très forte envie de lui coller une magistrale baffe pour qu’il la ferme. Donc vu qu’ils génèrent plus de stress que de bien être dans la conférence, ils sont également à proscrire au plus haut point. Sauf si cela s’inscrit dans une volonté explicite d’amuser l’auditoire et de générer du buzz. Mais prévenez le public avant pour éviter une émeute. </p>  <p>Et oui, ce n’est pas parce que l’on dispose de certaines des qualités que l’on est pas pour autant un mauvais speaker. Etonnant non ?</p>  <p><b><u>Note :</u></b> toute ressemblance avec des personnages existants ou ayant existé ne serait que purement fortuite. </p>  <p>Voilà, vous en savez un peu plus sur le genre de profile que l’on recherche. Je vous rassure, c’est très rare d’avoir quelqu’un qui combine toutes les qualités ci-dessus. Je pense simplement qu’il faut tendre vers ce modèle. Mais si vous pensez en disposer d’une bonne partie (à commencer par l’humilité), essayons de voir maintenant comment augmenter vos chances d’être « sélectionné ». </p>  <h2>Le chemin vers la gloire</h2>  <p>Ce n’est pas tout d’être convaincu d’être un bon speaker, il faut aussi convaincre les gens qui organisent la conférence. </p>  <p>Soit tout le monde vous connait déjà comme <a href="https://twitter.com/shanselman" target="_blank">Scott Hanselman</a> dans la communauté Microsoft ou <a href="https://twitter.com/LeaVerou" target="_blank">Lea Verou</a> dans le monde du web et c’est fastoche. D’ailleurs dans ces cas-là, c’est davantage les organisateurs qui vous contactent plutôt que l’inverse. ;)</p>  <p>Soit vous êtes plutôt méconnu et on va donc chercher à vérifier par nous-même vos prétendues qualités. </p>  <p>Je me rends à beaucoup de conférences et de meetups. C’est souvent là que j’identifie mon futur vivier de speakers. Du coup, voilà le processus que je vous conseille avant de postuler aux très grosses conférences :</p>  <p>- Commencez par <b>faire des présentations à vos collègues dans votre entreprise</b>. Cela vous permettra d’identifier un sujet intéressant à partager et de vous entrainer sur une audience plutôt sympathique envers vous en général (sauf si vous bossez dans une boîte dite « à la con » ™). Demandez à vos collègues un maximum de retours sur votre présentation : clarté, pertinence, dynamisme, format, durée, etc. Soyez prêt à accepter leurs retours que nous espérons constructifs et à vous remettre en cause. Testez ensuite les versions corrigées sur d’autres équipes. </p>  <p>- Une fois le sujet bien maitrisé et la confiance en soi acquise, tentez <b>l’aventure des meetups</b>. Vous en trouverez des tonnes ici : <a href="https://www.meetup.com/fr/" target="_blank">https://www.meetup.com/fr/</a>. Vous allez alors vous faire la main sur une audience plus compliquée, plus exigeante. Commencez à vous entrainer à « profiler » la salle, à observer la réaction des gens. Certains oseront venir vous dire certaines de vos fautes en face à face, d’autres préféreront vous sabrer magistralement sur les réseaux sociaux (Twitter, le groupe meetup, articles de blog). Ne le prenez jamais personnellement, c’est une occasion unique de progresser. Ma dernière en date : <a href="https://www.meetup.com/fr/Copenhagen-Net-User-Group/events/224687151/?eventId=224687151" target="_blank">https://www.meetup.com/fr/Copenhagen-Net-User-Group/events/224687151/?eventId=224687151</a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5078.clip_image003_3C1A906E.png"><img title="clip_image003" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image003" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1212.clip_image003_thumb_6BD838ED.png" width="378" height="82" /></a></p>  <p>Bon j’avoue je l’ai quand même un petit peu mal pris <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Clignement d&#039;œil" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1614.wlEmoticon-winkingsmile_0A0F4C95.png" />. Mais cela me rappelle avant tout les progrès qu’il me reste à faire en anglais pour améliorer la qualité de mes conférences.</p>  <p>- Ça y est, vous avez fait <strong>plusieurs meetups</strong>, cela se passe maintenant super bien, vous souhaitez<strong> passer à l’échelle supérieure</strong>. Identifiez les organisateurs des conférences en rapport avec votre expertise ou domaine de compétences et servez-vous de vos références meetups pour démontrer vos qualités. Le top : que vous ayez déjà eu des meetup filmés ou conférences pour donner le lien directement aux organisateurs. </p>  <p>Bon, tout cela est bien beau. Cela va valider vos qualités d’orateurs. Mais rappelez-vous, ce qui compte avant tout : ce que vous allez raconter aux gens ! Donc le sujet est encore plus important que le messager. </p>  <h2>Bien choisir son sujet</h2>  <p>C’est également souvent là que les gens se plantent magistralement. A nouveau car ils n’ont pas compris la chose essentielle : il faut que cela soit<strong> intéressant pour l’audience visée</strong>. Il ne faut pas forcément parler de son sujet favori. Eh oui désolé, mais cela n’intéresse souvent pas beaucoup les autres (sauf situation exceptionnelle comme <a href="https://www.babylonjs.com" target="_blank">Babylon.js</a> ou <a href="https://www.vorlonjs.io" target="_blank">Vorlon.js</a> <img class="wlEmoticon wlEmoticon-smilewithtongueout" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Tire la langue" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8475.wlEmoticon-smilewithtongueout_2064F1DA.png" />).</p>  <p>Je pense aussi qu’il y a plusieurs cas de figures. </p>  <p>Tout d’abord, d’une manière générale, mieux vous <strong>maitrisez un sujet</strong>, mieux cela est. Par exemple, si vous avez bossé sur un projet assez long avec une nouvelle technologie et que vous avez un peu galéré, vous avez surement une bonne matière première pour un sujet de conférence. Par ailleurs, si vous suivez le processus que je vous ai indiqué, vos collègues et/ou meetup vous auront permis de trouver un sujet qui semble déchainer les passions. Au passage, pour augmenter votre crédibilité et vos chances d’être retenu, n’hésitez pas à faire savoir ce que vous avez déjà fait sur le sujet : articles de <strong>blog</strong>, contribution de code sur <strong>github</strong>, conception d’un <strong>logiciel</strong>, etc. Cela rassure les organisateurs sur une partie de vos envies réelles de partage et vos talents de communication.</p>  <p>Mais d’autres ont une approche intéressante (que je suis parfois aussi) : ils prennent un sujet qu’ils rêveraient de voir abordé mais auquel ils ne connaissent encore rien. Cela leur donne une motivation (et pression !) pour se former sur le sujet et partager immédiatement leurs connaissances fraichement acquises auprès de la communauté. </p>  <p>Ensuite, bien sûr, si vous bossez chez Facebook, Twitter, Google, Mozilla ou d’autres entreprises dans le même genre, on attends de vous que vous parliez de ce que vous faites. C’est suffisamment intéressant ou impactant pour justifier votre présence. </p>  <p>Dans le cas de conférences brandées comme les Techdays, vous vous doutez bien que l’<strong>on cherche avant tout à parler des nouveautés de nos produits</strong>. Sachez aussi que l’on va surement se garder les sujets les plus importants stratégiquement parlant pour nous. Prendre le risque de vous donner un sujet important à nos yeux, c’est prendre le risque de ne pas le voir traité comme on le souhaite. Et notre boulot consiste quand même à bien présenter nos technologies. </p>  <p>Donc si vous proposez une session sur les nouveautés de la techno bidule importante du moment, vous allez rentrer en concurrence directe avec les évangélistes de l’équipe ainsi que tous les autres génies qui eut la même idée que vous. Donc, outre vos qualités éventuelles de speaker, vos chances de réussite deviennent déjà quasi nulles. A vous donc d’être malin et d’identifier des sujets périphériques : des retours d’expériences suite à vos projets, une tendance que vous maitrisez qui est souvent peu abordée dans la conférence, etc. </p>  <p>Par exemple, en <a href="https://blogs.msdn.com/b/davrous/archive/2012/12/19/tout-savoir-sur-le-parcours-windows-8-windows-phone-8-des-techdays-2013.aspx">2013</a>, j’ai dû avoir franchement 20 fois la même proposition sur comment faire une application HTML5 pour le Windows Store et manque de pot pour vous, c’est moi qui avait envie de la faire. En parallèle, uniquement 1 personne a eu l’idée d’aborder l’importante complexité de la gestion du tactile sur le web. Un sujet qui arrivait pile poil au bon moment avec l’explosion des tablettes et smartphone chez nous. Je ne connaissais pas bien le speaker mais j’ai préféré prendre le risque car le sujet était franchement intéressant. Je l’ai fait encadrer par <a href="https://twitter.com/meulta" target="_blank">un autre speaker</a> que je savais relativement bon (aujourd’hui évangéliste chez nous ;-P) et boom : 800 personnes dans la salle et une session très bien notée. </p>  <p>Dans le cas des Techdays, nous avons aussi tous les ans le débat du niveau technique des sessions avec certains d’entre vous. Elles vont de 100 (débutant) à 400 (expert). Dans le cas des sessions visant les développeurs, on a tendance à considérer que cela commence d’ailleurs à 200. La plupart de nos sessions sont d’ailleurs soit 200, où l’on découvre une nouvelle technologie ou un nouveau sujet, soit 300 où l’on va approfondir ou faire un retour d’expérience. </p>  <p>Dans le cas du 400, c’est bien plus compliqué. Tout d’abord, le niveau technique le plus élevé n’implique pas de faire un truc que personne ne comprend dans la salle. En effet, je vous rappelle à nouveau l’objectif de monter sur scène : partager pour que les gens apprennent des choses grâce à votre humilité et votre pédagogie. Pourtant, j’en ai vu des vainqueurs visant du soi-disant 400 tout en observant les gens sortir de la salle, dégoutés et n’ayant rien compris. En plus, en général, le gars il est content de lui et de sa connerie. Mais si cela ne tenait qu’à moi, il ne parlait plus dans notre conférence. C’est l’exemple typique du mec qui n’a rien compris. Faire du 400, cela implique d’être extrêmement bon techniquement mais surtout d’être un excellent pédagogue, très synthétique et très humble face à la technique. Bref, c’est très très rare. Et pour être honnête, dans le giron de développement Microsoft, il y a souvent que 2 personnes qui me viennent à l’esprit : <a href="https://mitsufu.wordpress.com/" target="_blank">Mitsu Furuta</a> et <a href="https://twitter.com/deltakosh" target="_blank">David Catuhe</a>. Personnellement, je ne sais pas faire ce genre de conférence et cela ne m’empêche pas du tout de dormir la nuit. Je m’éclate sur du 200 car j’adore ce format. </p>  <p>Autre problème du 400 : l’audience potentielle. Plus vous réduisez la cible, par effet d’entonnoir, moins il y aura de personnes dans la salle. Et nous nous sommes déjà retrouvés avec 5 personnes dans une salle sur un sujet de niche, les 5 personnes se connaissant déjà toutes et maitrisant déjà parfaitement le sujet. Bref, cela ressemble à une réunion entre potes sympathique mais qui nous coute cher. Je préfère qu’ils viennent squatter une salle de réunion chez nous ou qu’ils fassent leur propre meetup. </p>  <p>Et oui, n’oubliez pas que même si cela est un évènement technique, cela est payé par notre budget marketing. Et j’imagine que quand vous, vous voulez vendre votre produit ou votre nouvelle techno et que vous dépensez vos sous pour inviter des gens à venir la découvrir, vous êtes bien dégouté quand il n’y a que 2 pékins qui se soient déplacés, principalement pour manger gratos. Bah nous… c’est pareil ! ;-)</p>  <p>Pour finir, j’aimerais aborder la délicate session « sponsor ». Je la connais depuis 2 axes : les Techdays où nous avons de généreux sponsors sans qui la conférence ne pourrait pas avoir lieu et moi, en tant que représentant de Microsoft, qui sponsorise un évènement.</p>  <p>Commençons par les Techdays. Si vous êtes un sponsor, je vais vous donner un conseil précieux : n’essayez pas de rentrer en concurrence avec une session que vous savez présente dans le track officiel géré par Microsoft. Les gens préfèrent voir l’original que la copie. Alors même que si ça se trouve, vous serez meilleur que le présentateur de Microsoft ! C’est injuste mais c’est comme ça. Inversement, si vous faites qu’une présentation marketing pure de votre produit, les gens ne viendront pas non plus ou partirons en cours de session. Bref, il faut à nouveau être malin. Trouver un sujet qui <b>intéresse</b> le plus grand nombre, basé sur votre expérience et expertise tout en glissant un tout petit peu votre produit, processus, prestations, etc. Les gens ne sont pas dupes.</p>  <p>Pour ma part, j’ai exactement la même approche dans les conférences web dans lesquelles je me rends. Parfois, certains organisateurs m’invitent pour parler de nos produits (Windows 10, Microsoft Edge) donc c’est avec plaisir que je le fais. Ce fut le cas récemment pour ma part au Danemark, à Copenhague pour la superbe <a href="https://coldfrontconf.com/" target="_blank">conférence ColdFront</a>.</p>  <p>Mais bien souvent, j’y suis présent en tant que sponsor. Déjà quand il y a marqué : « <i>session sponsor</i> » sur le programme, les gens lisent « <i>attention, piège, n’y vas pas, le mec va essayer de refourguer sa came moisie</i> ». Bref, vous partez avec un handicap. Du coup, j’évite absolument de pousser un produit, dont souvent tout le monde se fout (j’en ai conscience hein) mais plutôt de trouver un sujet sur lequel j’ai bossé et je me suis éclaté, en périphérie bien sûr avec nos technologies. Et sans trop me la raconter, je pense que cela marche souvent assez bien. Il m’est arrivé de me planter comme tout le monde, mais dès l’instant que vous venez avec une démarche sincère de partage, vous pouvez démontrer vos technologies sans faire le bourrin et cela va intéresser les gens. </p>  <p>A bon entendeur !</p>]]></content:encoded>
    </item>
    <item>
      <title>Creating an accessible breakout game using Web Audio &amp; SVG</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/creating-an-accessible-breakout-game-using-web-audio-svg</link>
      <pubDate>Thu, 27 Aug 2015 09:59:02 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2015/08/27/creating-an-accessible-breakout-game-using-web-audio-svg/</guid>
      <description><![CDATA[window.location =...]]></description>
      <content:encoded><![CDATA[<script>window.location = "https://www.davrous.com/2015/08/27/creating-an-accessible-breakout-game-using-web-audio-svg/";</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>  <p>As the co-author of <a href="https://www.babylonjs.com/">Babylon.js</a>, a WebGL gaming engine, I was always felt a little uneasy listening to folks discuss accessibility best practices at web conferences. The content created with Babylon.js is indeed completely inaccessible to blind people. Making the <strong>web accessible to everyone is very important</strong>. I’m more convinced than ever about that <a></a><a href="https://facecacheeduhandicap.com/" target="_blank">as I’m personally touched via my own son</a>. And so I wanted to contribute to the accessibility of the web in some way.</p>  <p>That’s why I decided to work on creating a game that uses WebGL and is fully accessible, to prove that visual games aren’t inherently inaccessible. I chose to keep it simple, so I created a breakout clone, which you can see in action in the following YouTube video:</p> <iframe height="315" src="https://www.youtube.com/embed/25quyIGtujk" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />You can <a href="https://david.blob.core.windows.net/accessibility/accessiblebreakout/index.html" target="_blank">test it in a Web Audio compatible browser</a> (<a href="https://caniuse.com/#feat=audio-api" target="_blank">see caniuse.com for a list</a>) or <a href="https://github.com/davrous/accessiblebreakout" target="_blank">download or peruse the source code on Github</a></p>  <p>Now, let me share with you the background <strong>story of this game</strong> and all the experiments involved…</p>  <h2>Once upon a time</h2>  <p>It all started during the <a href="https://2014.kiwiparty.fr/" target="_blank">Kiwi Party 2014 conference</a>, while listening to <a href="https://laurakalbag.com/" target="_blank">Laura Kalbag</a>’s talk about guidelines for top accessible design considerations. I was discussing with <a href="https://nota-bene.org/" target="_blank">Stéphane Deschamps</a>, a lovely, funny &amp; talented guy about my lack of knowledge on how to make WebGL accessible and how I could avoid people creating lots of inaccessible content. To motivate me, <strong>he challenged me</strong>. Probably without estimating the consequences: “<i>it would be very cool if you’d manage to create an accessible breakout game!</i>”. Boom. The seed of what you see here got put in my brain right there and then. I started thinking about that in earnest and researched on how I could create such an experience. </p>  <p>First, I discovered that there were already accessible <a href="https://en.wikipedia.org/wiki/Audio_game" target="_blank">audio games</a> available at <a href="https://www.audiogames.net/" target="_blank">audiogames.net</a> and <a href="https://game-accessibility.com/" target="_blank">game-accessibility.com</a>. I also researched best practices for creating games for blind people. While interesting to read, I wasn’t finding what I was looking for. I didn’t want to create a dedicated experience for blind people,<strong> I wanted to create a universal game, playable by anybody, </strong>regardless of ability. I’m convinced that the web was created for this reason and my dream was to embrace this philosophy in my game. I wanted to create a unique experience that could be played by all kind of users so they could share in the joy together. I wanted great visuals &amp; sounds, not a “look it’s accessible, that’s why it can’t be as good” solution. </p>  <p>To this end, I started to do some experiments. I took <a href="https://blogs.msdn.com/b/eternalcoding/archive/2011/09/06/write-a-small-game-using-html5-and-javascript-brikbrok.aspx" target="_blank">a small breakout game written by my friend, David Catuhe, that used SVG</a>. I refactored it a bit to use the <a href="https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute" target="_blank">SVG viewbox</a> for better scaling across screens and re-wrote it in TypeScript. I also replaced the animated 2D Canvas in the background with a WebGL canvas using Babylon.js to add a starfield experience. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4341.image_362BBA48.png"><img title="Screenshot of the game using a large window to show SVG scalability feature" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Screenshot of the game using a large window to show SVG scalability feature" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6242.image_thumb_4EBDE849.png" width="640" height="384" /></a>&#160;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5047.image6_57414793.png"><img title="Screenshot of the game using a small window to show SVG scalability feature" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Screenshot of the game using a small window to show SVG scalability feature" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2627.image6_thumb_549B1C93.png" width="378" height="210" /></a>     <br /><font size="2"><em><em>The beauty of the SVG viewbox is that it perfectly scales across sizes &amp; resolutions</em> </em></font></p>  <p>This became the baseline for my experiments.</p>  <p>For audio, I had several ideas. The main trick I wanted to use was <strong>spatial sound</strong> to enable people to know where they are on the board without having to see the screen. <strong>This can be achieved using <a href="https://webaudio.github.io/web-audio-api/" target="_blank">Web Audio</a></strong>. As I didn’t have access to a visually impaired tester, I ‘cheated’ by closing my eyes while wearing a good set of headphones. You’ll see later that testing the game with a real blind user helped me fix a lot more things, but as a start, this was an OK way to test the game. </p>  <p>I started tinkering with the Web Audio API using a sample from <a href="https://www.html5rocks.com/en/tutorials/webaudio/games/" target="_blank">an excellent tutorial on HTML5Rocks as my guide</a>. The main demo is in the “<i>3D positional sound</i>” section:</p>  <p><a title="HTML5 Rocks sound sample" href="https://www.html5rocks.com/en/tutorials/webaudio/games/" target="_blank"><img title="Screenshot of the HTML5 Rocks sample with spatial audio mapped to mouse move" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Screenshot of the HTML5 Rocks sample with spatial audio mapped to mouse move" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4010.image22_6F67429F.png" width="409" height="317" /></a></p>  <p>I then replaced the sound emitted by the mouse cursor with the position of the ball in the game. Testing that didn’t work out as well as I’d hoped. It was too complex to understand exactly where the ball was on the screen by sound alone and you couldn’t predict the direction of the ball like you can when you see the screen. Still, I thought it was interesting to emit some 3D sounds when the ball was hitting something—a brick or one of the walls. It was information that could be useful to anybody, so I kept that part.</p>  <p>As I’m also a <a href="https://soundcloud.com/david-rousset" target="_blank">composer in my spare time</a>, my next idea was to use a specific piano note for every brick’s column, thereby adding a sense of what is left and right. By default, I chose to have 8 columns to cover an octave. I coded it and… it was fun, but didn’t help the gameplay.</p>  <p><a title="Diagram illustrating how to map a piano note to a bricks&#039; column from left to right" href="https://www.html5rocks.com/en/tutorials/webaudio/games/"><img title="Diagram illustrating how to map a piano note to a bricks&#039; column from left to right" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Diagram illustrating how to map a piano note to a bricks&#039; column from left to right" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6470.image16_5188BE9E.png" width="640" height="275" /></a></p>  <p>I knew I needed help, so I showed what I did to my my oldest son and he came up with the <strong>best solution.</strong> He told me it would make sense to <strong>use the play rate and effect of the sound</strong> to provide information about where the ball was. After several tests, I’ve ended up with the following algorithm:</p>  <p>- If the ball is perfectly <strong>vertically aligned</strong> with the paddle, play the sound at the “normal” rate     <br />- If the ball <strong>is not aligned</strong> with the paddle, <strong>slow down the play rate</strong>. The farther the ball is from the paddle, the slower the sound will be. It will give an immediate feedback to blind people that the ball is not aligned anymore and they need to move the paddle to avoid missing the ball     <br />- Play the <strong>sound of the music in a spatialized way</strong>: 0 on the X axis if the ball is at the center of the paddle, and –value and +value on the X axis based on the distance of the ball from the paddle. </p>  <p>The first tests of this algorithm were very encouraging—I was almost able to play the game while closing my eyes. After a while, I tweaked the gameplay and algorithm to address some issues I was seeing. You can’t anticipate the ball direction when you can’t see it, so it <strong>was too difficult</strong> to move the paddle when the music was suddenly slowing down. You just couldn’t adjust the paddle position in time. </p>  <p>To address this, I added <strong>some tolerance</strong>. First of all, the <strong>paddle is twice as wide in the “accessible mode”</strong> to compensate for not being able to see it. Secondly, I slow down the ball once it reaches 80% of the vertical screen in order to give users a little more time to bounce it before it hits the ground. Finally, I changed the play rate as soon as the ball is not aligned with <strong>66% of the paddle width</strong>. The rest of the paddle still works for the ball collision, but using this approach enables a blind user <strong>to anticipate</strong> when the ball is about to miss the paddle. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2538.image1_0620FB7E.png"><img title="Diagram explaining the accessible gameplay adjustments" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Music is played at normal play rate only when the ball is aligned with 66% of the surface and slowing down the speed once the ball has reached 80% of the height of the viewport" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5265.image1_thumb_381B2CB9.png" width="640" height="279" /></a></p>  <p>I was very happy with the game using these gameplay parameters. I’ve been testing the game with several of my colleagues who were able to play the game while closing their eyes. But they all knew what a breakout game should look like and, thus, their brain was able to more or less anticipate the gameplay mechanics already. They were <i>conditioned</i>. </p>  <p>My ultimate test was during <a href="https://www.paris-web.fr/2014/" target="_blank">Paris Web 2014</a>, an <strong>awesome and well-known conference in France</strong>. My goal was to finish a first draft of the game for the <a href="https://www.paris-web.fr/2014/conferences/lightning-talks.php" target="_blank">famous lightning talks</a>. I was a bit nervous about what I’d done and met again Stéphane to share my worries. He told me I should talk to <a href="https://twitter.com/sylduch" target="_blank">Sylvie Duchateau</a>, who is <strong>a blind woman involved in web accessibility</strong>, to describe what I’d done and do a quick test with her. </p>  <p>During one of the breaks, I shared my project and the audio gameplay ideas behind it with her. To my surprise, she told me she didn’t know what a breakout game was! Which is obvious once you think about it. If you can’t see, a purely visual game doesn’t have much appeal to you. However, she found the idea of a game with spatial audio interesting, so we gave it a go. </p>  <p>She put on my headset, and I started the game… to my dismay, she wasn’t able to play the game at all. There was too much audio information to precisely decide what to do. Should I move left or right now? After a brief discussion with her, she told me I should remove some audio details. She also suggested that I avoid using web audio spatialization for the music (it was moving from the center to the left or right based on the distance from the paddle) and instead enable only the right or left speaker in order to provide very clear instruction on what to do. I quickly fixed the code while she was there and the<strong> she was immediately able to break her 2 first bricks</strong>. I was so happy, you can’t even imagine. She even asked me what was the best score to beat, which means that I reached my goal of delivering an accessible game—at least for the visually impaired.</p>  <p>The main code handling all of this is here:</p>    <pre class="code"><span style="color: green">// To help visually impaired users, the sound is being played at normal rate
// on 66% of the global width. It's to help them anticipating the ball
</span><span style="color: blue">export const </span><span style="color: black">ACCESSIBLE_PAD_TOLERANCE = 0.66;
</span><span style="color: blue">export const </span><span style="color: black">DEFAULT_MUSIC_PLAYRATE = 1.3;

</span><span style="color: blue">private </span><span style="color: black">_updateAccessibilityMusic() {
    </span><span style="color: blue">var </span><span style="color: black">paddleX = </span><span style="color: blue">this</span><span style="color: black">._padX;
    </span><span style="color: blue">var </span><span style="color: black">paddleW = </span><span style="color: blue">this</span><span style="color: black">._padWidth;
    </span><span style="color: blue">var </span><span style="color: black">ballPosition = { x: </span><span style="color: blue">this</span><span style="color: black">._ballX, y: </span><span style="color: blue">this</span><span style="color: black">._ballY };

    </span><span style="color: blue">var </span><span style="color: black">deltaX = paddleW * ((1 - ACCESSIBLE_PAD_TOLERANCE) / 2);

    </span><span style="color: blue">if </span><span style="color: black">(ballPosition.x &gt; deltaX + 10 &amp;&amp; ballPosition.x &lt; </span><span style="color: blue">this</span><span style="color: black">._viewPortWidth - (deltaX + 10)) {
        paddleX += paddleW * ((1 - ACCESSIBLE_PAD_TOLERANCE) / 2);
        paddleW = paddleW * ACCESSIBLE_PAD_TOLERANCE;
    }

    </span><span style="color: green">// If paddle &amp; ball aligned, sound is played on both ears (X = 0, for center)
    // If the ball is on the left, musicIndicatorX should be negative otherwise positive
    </span><span style="color: blue">var </span><span style="color: black">musicIndicatorX;

    </span><span style="color: green">// Position coordinates are in normalized canvas coordinates
    // with -0.5 &lt; x, y &lt; 0.5
    </span><span style="color: blue">if </span><span style="color: black">(ballPosition) {
        </span><span style="color: blue">var </span><span style="color: black">x = (ballPosition.x - </span><span style="color: blue">this</span><span style="color: black">._viewPortCenter.x) / </span><span style="color: blue">this</span><span style="color: black">._viewPortWidth;

        </span><span style="color: green">// Ball and paddle are vertically aligned
        </span><span style="color: blue">if </span><span style="color: black">(ballPosition.x &gt;= paddleX &amp;&amp; ballPosition.x &lt;= paddleX + paddleW) {
            </span><span style="color: blue">this</span><span style="color: black">._music.setPlaybackRate(DEFAULT_MUSIC_PLAYRATE)
            musicIndicatorX = 0;
        }
        </span><span style="color: blue">else </span><span style="color: black">{
            </span><span style="color: blue">var </span><span style="color: black">distanceFromPaddle;
            </span><span style="color: green">// Ball is on the left of the paddle
            </span><span style="color: blue">if </span><span style="color: black">(ballPosition.x &lt; paddleX) {
                distanceFromPaddle = paddleX - ballPosition.x;
                musicIndicatorX = -30;
            }
            </span><span style="color: blue">else </span><span style="color: black">{
                distanceFromPaddle = ballPosition.x - paddleX - paddleW;
                musicIndicatorX = 30;
            }
            </span><span style="color: blue">var </span><span style="color: black">distanceFromPaddleNormalized = distanceFromPaddle / </span><span style="color: blue">this</span><span style="color: black">._viewPortWidth;
            </span><span style="color: green">// Slowing down the play rate based on the distance from the paddle
            </span><span style="color: blue">this</span><span style="color: black">._music.setPlaybackRate(0.9 * (1 - distanceFromPaddleNormalized));
        }
        </span><span style="color: green">// Playing music on left or right speaker based on the ball position from the paddle
        </span><span style="color: blue">this</span><span style="color: black">._music.setPosition(</span><span style="color: blue">new </span><span style="color: #2b91af">BABYLON</span><span style="color: black">.</span><span style="color: #2b91af">Vector3</span><span style="color: black">(musicIndicatorX, 0.5, 0));
    }
}</span></pre>

<p><b><u>Note:</u></b> I’m using the BABYLON.JS sound stack implemented on top of Web Audio. You can <a href="https://doc.babylonjs.com/tutorials/16._Playing_sounds_and_music">read our documentation</a> or <a href="https://github.com/BabylonJS/Babylon.js/tree/master/src/Audio">get the code on Github</a>. </p>

<h2>Other ideas I added to the game</h2>

<p>I can’t remember every trick I’ve tried in order to optimize the gameplay to be “universal”, so I’ll wrap up with what I’ve implemented.</p>



<h3>Speech synthesis</h3>

<p>Some users may not be able to see how many bricks are left. Similarly, they have no way of knowing if they have won or lost, based on the visuals. That’s why I thought it was a good idea<strong> to use the Web Audio speech library</strong> <a href="https://www.masswerk.at/mespeak/" target="_blank">meSpeak.js</a> to add audio clues. However, after discussing with <a href="https://twitter.com/rik24d" target="_blank">Anthony Ricaud</a> and a bunch of other people at the event, it turns out that was not the best solution. The issue was that I would be forcing a specific voice and speed in my code. Users of assistive technology, however, already have <strong>preferred settings —a certain voice at a defined speed</strong>. It is therefore better to use an <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions" target="_blank">ARIA Live Region</a> to update the user during gameplay. I’m sure there is more I can do too; feel free to enhance my code if you’d like to, I’d appreciate it.</p>

<p>The speech synthesis currently tells you the number of bricks left to break, that the game has started or ended (by losing or winning), and your final score. As values in an ARIA live region, screenreaders will automatically read this information to the user. Visual users don’t need a robot voice to tell them what’s going on.</p>

<h3>SVG styling</h3>

<p>I decided to use <strong>SVG for this game</strong> for several reasons: it scales perfectly on all screens as it’s <strong>vector based</strong>, it can be <strong>coupled with CSS</strong> for the design, and, last but not least, it <strong>works perfectly well with ARIA</strong>. I’ve already mentioned the scaling part earlier in this article and I haven’t done enough research into where ARIA (apart from Live Regions) could be useful with SVG in this case.</p>

<p>CSS, on the other hand, was very helpful to me. As a reminder, my goal was to have the same game, with the same code base, being used by anybody. When you’re loading the <a href="https://david.blob.core.windows.net/accessibility/accessiblebreakout/index.html" target="_blank">game</a>, I load the default style sheet with optimisations for the visually impaired. Here’s why:</p>

<p>- If you can’t see or you only see partially, <strong>it is better to start with the high contrast visuals</strong>. I’m loading “<em>indexvi.css</em>” by default to have a high contrast colors using yellow &amp; black. I’m also disabling the background WebGL canvas to reduce the visual clutter. If you can see and don’t like this, you can uncheck the appropriate options and get the starfield and less vivid visuals. 

  <br />- If you can’t see at all<strong>, you can disable the “visual impaired” option to enable high quality graphics</strong>. This will load the “<em>index.css</em>” style-sheet and enable the WebGL background. Thanks to the beauty of SVG mixed with CSS, we just need to load this new style-sheet and the rest happens automatically. Of course someone who can’t see doesn’t care about having poor or great graphics. But it’s better for people watching you play as it shows that accessible games don’t have to look basic.

  <br />- If you can see clearly<strong>, uncheck all options. You’ll have great visuals and the speed and paddle width will be adjusted to be more difficult</strong>. You also won’t get the audio clues as to how many bricks are left and whether you won or lost. That would be unnecessary—it should be pretty obvious.</p>

<p>In conclusion, here is the workflow:</p>

<p>- At first launch of the game, <strong>we anticipate a visual impairment</strong> and give you a high contrast version of the game:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5811.image_24B98B92.png"><img title="Screenshot of the game using the high contrast style-sheet" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Screenshot of the game using the high contrast style-sheet" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8831.image_thumb_422E6D4F.png" width="640" height="387" /></a></p>

<p>- If you can’t see at all, you can uncheck the “<strong>Visual Impaired</strong>” option to enable great graphics for your surrounding audience. The paddle width remains the same and you still have audio assistance:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1263.image_362C7D1B.png"><img title="Screenshot of the game using the blind theme. Great graphics but keeping the wide paddle and audio assistance." style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Screenshot of the game using the blind theme. Great graphics but keeping the wide paddle and audio assistance." src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2465.image_thumb_2C6715A3.png" width="640" height="387" /></a></p>

<p>- If you don’t have any visual impairments, you can uncheck everything to make the paddle more narrow and the ball speed faster:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4544.image_62D7C7A5.png"><img title="Screenshot of the game with no accessibility feature enabled. Great graphics, small paddle and no audio assistance." style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="Screenshot of the game with no accessibility feature enabled. Great graphics, small paddle and no audio assistance." src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2437.image_thumb_1BF13559.png" width="640" height="387" /></a></p>

<h2>Ideas not implemented &amp; conclusion</h2>

<p>The challenge I gave myself was to have a great gaming experience independent of a person’s ability to see. I know that I haven’t completely fulfilled this commitment—for example, if you can’t see at all, you don’t know where the remaining bricks to break are on the screen whereas if you can see or have minor visual impairments, you can likely locate the remaining bricks and adjust the ball direction to break them. </p>

<p>My initial idea was to use speech synthesis once there are only 10 bricks left. It could say something like: “<em>4 bricks are on the left, 4 on the center and 2 on the right</em>”. Still, this is not very precise and it remains difficult to change the direction of the ball without visuals. But maybe one of you will find a cool &amp; elegant solution to solve that (hint, hint).</p>

<p>Still, I’m <strong>quite happy about this challenge and I had a lot of fun trying to solve it</strong>. I’ve learned a lot by reading articles dealing with accessibility. I also hope I’ve proven that accessibility can be provided to people, even in unexpected areas, by <strong>simply thinking about what’s possible</strong>. Last but not least, I learned that by enabling accessibility in your games, you can improve the experience for everybody. </p>



<p>David</p>

<p><a class="twitter-follow-button" href="https://twitter.com/davrous">Follow @davrous</a></p>

<p><em>I’d like to special thanks <a href="https://twitter.com/codepo8" target="_blank">Chris Heilmann</a> and <a href="https://twitter.com/AaronGustafson" target="_blank">Aaron Gustafson</a> who helped me reviewing this article.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Unifying touch and mouse: how Pointer Events will make cross-browsers touch support easy</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/unifying-touch-and-mouse-how-pointer-events-will-make-cross-browsers-touch-support-easy</link>
      <pubDate>Mon, 10 Aug 2015 03:14:00 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2013/10/21/unifying-touch-and-mouse-how-pointer-events-will-make-cross-browsers-touch-support-easy/</guid>
      <description><![CDATA[window.location =...]]></description>
      <content:encoded><![CDATA[<script>window.location = "https://www.davrous.com/2015/08/10/unifying-touch-and-mouse-how-pointer-events-will-make-cross-browsers-touch-support-easy/";</script>
<p><!-- Include the VideoJS Library --></p><script type="text/javascript" src="https://david.blob.core.windows.net/videos/video-js/video.js"></script><script type="text/javascript">// </script> <p></p> <p>I often get questions from developers like, “<i>with so many touch-enabled devices on phones and tablets, where do I start?</i>” and “<i>what is the easiest way to build for touch-input?</i>” Short answer: <i>“It’s complex.” </i>Surely there’s a more unified way to handle multi-touch input on the web – in modern, touch-enabled browsers or as a fallback for older browsers. In this article I’d like to show you some browser experiments using <a href="https://www.w3.org/TR/pointerevents/" target="_blank">Pointers</a> – an emerging multi-touch technology and polyfills that make cross-browser support, well <i>less complex</i>. The kind of code you can also experiment with and easily use on your own site.</p> <p>First of all, many touch technologies are evolving on the web – for browser support you need to look the <a href="https://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/TouchEvent/TouchEvent.html" target="_blank">iOS touch event</a> model and the <a href="https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mouseevents" target="_blank">W3C mouse event</a> model in additional to at <a href="https://blogs.msdn.com/b/ie/archive/2011/09/20/touch-input-for-ie10-and-metro-style-apps.aspx">MSPointers</a>, to support all browsers. Yet there is growing support (and willingness) to standardize. In September 2012, Microsoft submitted <a href="https://www.w3.org/Submission/pointer-events/" target="_blank">MSPointers to the W3C for standardization</a> and in February 2015, we’ve reached <strong>W3C Recommendation</strong>: <a title="https://www.w3.org/TR/pointerevents" href="https://www.w3.org/TR/pointerevents" target="_blank">https://www.w3.org/TR/pointerevents</a>. The <a href="https://blogs.msdn.com/b/interoperability/" target="_blank">MS Open Tech</a> team also released an <a href="https://blogs.msdn.com/b/interoperability/archive/2012/12/18/open-source-release-from-ms-open-tech-pointer-events-initial-prototype-for-webkit.aspx" target="_blank">initial Pointer Events prototype for Webkit</a> and recently, <a href="https://hacks.mozilla.org/2015/08/pointer-events-now-in-firefox-nightly/" target="_blank">Mozilla has announced support for Pointer Events in Firefox Nightly</a>!</p> <p>The reason why I experiment with Pointer Events is not based on device share – it’s because Microsoft’s approach to basic input handling is quite different than what’s currently available on the web and it deserves a look for what it <i>could become</i>. The difference is that developers can write to a more abstract form of input, called a “Pointer.” A Pointer can be any point of contact on the screen made by a mouse cursor, pen, finger, or multiple fingers. So you don’t waste time coding for every type of input separately.</p> <p><em><strong>Article updated the<font color="#800000"> 08/10/2015</font> to reflect the support of non-prefixed CR version of Pointer Events in IE11/Microsoft Edge/Firefox Nightly &amp; Windows 8.1/10 apps. </strong></em></p> <p><em>If you’re running IE10, you’ll need to prefix the API or use our polyfill library <a href="https://blogs.msdn.com/b/eternalcoding/archive/2013/01/16/hand-js-a-polyfill-for-supporting-pointer-events-on-every-browser.aspx" target="_blank">Hand.js</a>. You’ll find the original article with prefixes here: <a title="https://www.codeproject.com/Articles/566315/Unifying-touch-and-mouse-how-Pointer-Events-will-m" href="https://www.codeproject.com/Articles/566315/Unifying-touch-and-mouse-how-Pointer-Events-will-m" target="_blank">Unifying touch and mouse: how Pointer Events will make cross-browsers touch support easy</a></em></p> <h2>The concepts</h2> <p>We will begin by reviewing apps running inside <a href="https://ietestdrive.com" target="_blank">Internet Explorer 11, Microsoft Edge or Firefox Nightly</a> which exposes the Pointer Events API and then solutions to support all browsers. After that, we will see how you can take advantage of IE/MS Edge gestures services that will help you handling touch in your JavaScript code in an easy way. As Windows 8.1/10 and Windows Phone 8.1/Mobile 10 share the same browser engine, the code &amp; concepts are identical for both platforms. Moreover, everything you’ll learn on touch in this article will help you do the very same tasks in <a href="https://windowsstore.com" target="_blank">Windows Store apps</a> built with HTML5/JS, as this is again the same engine that is being used.</p> <p>The idea behind the Pointer is to let you addressing mouse, pen &amp; touch devices via a single code base using a pattern that match the classical mouse events you already know. Indeed, mouse, pen &amp; touch have some properties in common: you can move a pointer with them and you can click on element with them for instance. Let’s then address these scenarios via the very same piece of code! Pointers will aggregate those common properties and expose them in a similar way than the mouse events.</p> <p>The most obvious common events are then: <a href="https://msdn.microsoft.com/en-us/library/hh771909(v=vs.85).aspx" target="_blank">pointerdown</a> , <a href="https://msdn.microsoft.com/en-us/library/hh771911(v=vs.85).aspx" target="_blank">pointermove</a> &amp; <a href="https://msdn.microsoft.com/en-us/library/hh771914(v=vs.85).aspx" target="_blank">pointerup</a> which directly map to the mouse events equivalent. You will have the X &amp; Y coordinates of the screen as an output.</p> <p>You have also specific events like: <a href="https://msdn.microsoft.com/en-us/library/hh771913(v=vs.85).aspx" target="_blank">pointerover</a> , <a href="https://msdn.microsoft.com/en-us/library/hh771912(v=vs.85).aspx" target="_blank">pointerout</a> or <a href="https://msdn.microsoft.com/en-us/library/hh846776(v=vs.85).aspx" target="_blank">pointercancel</a></p> <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8004.clip_image001_43511543.png"><img title="clip_image001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;border-top-width: 0px;margin-right: auto" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4300.clip_image001_thumb_4E7D303E.png" width="233" height="240"></a></p> <p>But of course, there could be also some cases where you want to address touch in a different manner than the default mouse behavior to provide a different UX. Moreover, thanks to the multi-touch screens, you can easily let the user rotate, zoom or pan some elements. Pens/stylus can even provide you some pressure information a mouse can’t. The Pointer Events will still aggregate those differences and will let you build some custom code for each devices’ specifics.</p> <p><b><u>Note:</u></b> it would be better to test the following embedded samples if you have a touch screen of course on a Windows 8.1/10 device or if you’re using a Windows Phone 8+. Still, you can have some options:</p> <blockquote> <p>1. Get a first level of experience by using the Windows 8.1/10 Simulator that ships with the free Visual Studio 2013/2015 Express development tools. For more details on how this works, please read this article: <a href="https://blogs.msdn.com/b/davrous/archive/2012/07/10/using-the-windows-8-simulator-amp-vs-2012-to-debug-the-ie10-touch-events-amp-your-responsive-design.aspx">Using the Windows 8 Simulator &amp; VS 2012 to debug the IE10 touch events &amp; your responsive design</a> . <br>2. Have a look to <a href="https://david.blob.core.windows.net/videos/MSPointerEventsArticleVideo.mp4">this video</a> also available in other formats at the end of the article. The <a href="https://david.blob.core.windows.net/videos/MSPointerEventsArticleVideo.mp4">video demonstrates all the below samples</a> on a Windows 8 tablet supporting touch, pen &amp; mouse. <br>3. Use a virtual cross-browsing testing service like <a href="https://browserstack.com">BrowserStack</a> to test interactively if you don’t have access to the Windows 8 device or <a href="https://www.modern.ie/fr-fr/virtualization-tools" target="_blank">download one of our VMs</a>.</p></blockquote> <h2>Handling simple touch events</h2> <h3>Step 1: do nothing in JS but add a line of CSS</h3> <p>Let’s start with the basics. You can easily take any of your existing JavaScript code that handles mouse events and it will just work as-is using some pens or touch devices in Internet Explorer 10/11 &amp; MS Edge. IE &amp; MS Edge are indeed firing mouse events as a last resort if you’re not handling Pointers Events in your code. That’s why, you can “click” on a button or on any element of any webpage using your fingers even if the developer never thought that one day someone would have done it this way. So any code registering to mouvedown and/or mouseup events will work with no modification at all. But what about mouvemove?</p> <p>Let’s review the default behavior to answer to that question. For instance, let’s take this piece of code:</p><pre class="code"><span style="color: blue">&lt;!</span><span style="color: maroon">DOCTYPE </span><span style="color: red">html</span><span style="color: blue">&gt;
&lt;</span><span style="color: maroon">html</span><span style="color: blue">&gt;
&lt;</span><span style="color: maroon">head</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">title</span><span style="color: blue">&gt;</span>Touch article sample 1<span style="color: blue">&lt;/</span><span style="color: maroon">title</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">head</span><span style="color: blue">&gt;
&lt;</span><span style="color: maroon">body</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">canvas </span><span style="color: red">id</span><span style="color: blue">="drawSurface" </span><span style="color: red">width</span><span style="color: blue">="400px" </span><span style="color: red">height</span><span style="color: blue">="400px" </span><span style="color: red">style</span><span style="color: blue">="</span><span style="color: red">border</span><span style="color: blue">: 1px dashed black;"&gt;
    &lt;/</span><span style="color: maroon">canvas</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">script</span><span style="color: blue">&gt;
        var </span>canvas = document.getElementById(<span style="color: maroon">"drawSurface"</span>);
        <span style="color: blue">var </span>context = canvas.getContext(<span style="color: maroon">"2d"</span>);
        context.fillStyle = <span style="color: maroon">"rgba(0, 0, 255, 0.5)"</span>;

        canvas.addEventListener(<span style="color: maroon">"mousemove"</span>, paint, <span style="color: blue">false</span>);

        <span style="color: blue">function </span>paint(event) {
            context.fillRect(event.clientX, event.clientY, 10, 10);
        }
    <span style="color: blue">&lt;/</span><span style="color: maroon">script</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">body</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">html</span><span style="color: blue">&gt;
</span></pre>
<p>It simply draws some blue 10px by 10px squares inside an HTML5 canvas element by tracking the movements of the mouse. <i>To test it, move your mouse inside the box. If you have a touch screen, try to interact with the canvas to check by yourself the current behavior</i>:</p>
<table cellspacing="0" cellpadding="2" width="900" border="0">
<tbody>
<tr>
<td valign="top" width="450"><iframe src="https://david.blob.core.windows.net/html5/touchsample1.htm" width="430" height="430" frameBorder="0"></iframe></td>
<td valign="top" width="450">
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center"><em>Sample 0</em> : <strong>default behavior</strong> if you do nothing</p>
<p align="center"><em>Result</em> : <strong>only mousedown/up/click works</strong> with touch</p></td></tr></tbody></table>
<p>You’ll see than when you’re moving the mouse inside the canvas element, it will draw some series of blue squares. But using touch instead, it will only draw a unique square at the exact position where you will tap the canvas element. As soon as you will try to move your finger in the canvas element, the browser will try to pan inside the page as it’s the default behavior being defined.</p>
<p>You then need to specify you’d like to override the default behavior of the browser and tell it to redirect the touch events to your JavaScript code rather than trying to interpret it. For that, target the elements of your page that shouldn’t react anymore to the default behavior and apply this CSS rule to them:</p><pre class="code"><span style="color: red">touch-action</span>: <span style="color: blue">auto | none | pan-x | pan-y</span>;</pre>
<p>You have various values available based on what you’d like to filter or not. You’ll find the values described in the W3C specification for IE11, MS Edge and Firefox Nightly: <a title="https://www.w3.org/TR/pointerevents/#the-touch-action-css-property" href="https://www.w3.org/TR/pointerevents/#the-touch-action-css-property">the touch-action css property</a> and for IE10: <a href="https://blogs.msdn.com/b/ie/archive/2012/04/20/guidelines-for-building-touch-friendly-sites.aspx">Guidelines for Building Touch-friendly Sites</a></p>
<p>The classic use case is when you have a map control in your page. You want to let the user pan &amp; zoom inside the map area but keep the default behavior for the rest of the page. In this case, you will apply this CSS rule only on the HTML container exposing the map.</p>
<p>In our case, add this block of CSS:</p><pre class="code"><span style="color: blue">&lt;</span><span style="color: maroon">style</span><span style="color: blue">&gt;
    </span><span style="color: maroon">#drawSurface
    </span>{
        <span style="color: red">touch-action</span>: <span style="color: blue">none</span>; <span style="color: #006400">/* Disable touch behaviors, like pan and zoom */
    </span>}
<span style="color: blue">&lt;/</span><span style="color: maroon">style</span><span style="color: blue">&gt;
</span></pre>
<p>Which now generates this result:</p>
<table cellspacing="0" cellpadding="2" width="900" border="0">
<tbody>
<tr>
<td valign="top" width="450"><iframe src="https://david.blob.core.windows.net/html5/PECR/touchsample2.htm" width="430" height="430" frameBorder="0"></iframe></td>
<td valign="top" width="450">
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center"><em>Sample 1</em>: just after adding <strong><span style="color: red">touch-action</span>: <span style="color: blue">none</span></strong>&nbsp;</p>
<p align="center"><em>Result</em>: default browser panning disabled and <strong>mousemove works but with 1 finger only</strong></p></td></tr></tbody></table>
<p><strong><u>IE10 users:</u></strong> test the prefixed version here: <a title="https://david.blob.core.windows.net/html5/touchsample2.htm" href="https://david.blob.core.windows.net/html5/touchsample2.htm" target="_blank">https://david.blob.core.windows.net/html5/touchsample2.htm</a></p>
<p>Now, when you’re moving your finger inside the canvas element, it behaves like a mouse pointer. That’s cool! But you will quickly ask yourself this question: why does this code only track 1 finger? Well, this is because we’re just falling in the last thing IE &amp; MS Edge are doing to provide a very basic touch experience: mapping one of your fingers to simulate a mouse. And as far as I know, we’re using only 1 mouse at a time. So 1 mouse === 1 finger max using this approach. Then, how to handle multi-touch events?</p>
<h3>Step 2: use Pointer Events instead of mouse events</h3>
<p>Take any of your existing code and replace your registration to “mousedown/up/move” by “pointerdown/up/move” (or “MSPointerDown/Up/Move” in IE10) and your code will directly support a multi-touch experience inside Pointer Events enabled browsers!</p>
<p>For instance, in the previous sample, change this line of code:</p><pre class="code">canvas.addEventListener(<span style="color: maroon">"mousemove"</span>, paint, <span style="color: blue">false</span>);</pre>
<p>to this one:</p><pre class="code">canvas.addEventListener(<span style="color: maroon">"pointermove"</span>, paint, <span style="color: blue">false</span>);</pre>
<p>And you will get this result:</p>
<table cellspacing="0" cellpadding="2" width="900" border="0">
<tbody>
<tr>
<td valign="top" width="450"><iframe src="https://david.blob.core.windows.net/html5/PECR/touchsample3.htm" width="430" height="430" frameBorder="0"></iframe></td>
<td valign="top" width="450">
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center"><em>Sample 2</em>: using <strong>pointermove</strong> instead of mousemove</p>
<p align="center"><em>Result</em>: <strong>multi-touch works</strong></p></td></tr></tbody></table>
<p><strong><u>IE10 users:</u></strong> test the prefixed version here: <a title="https://david.blob.core.windows.net/html5/touchsample3.htm" href="https://david.blob.core.windows.net/html5/touchsample3.htm" target="_blank">https://david.blob.core.windows.net/html5/touchsample3.htm</a></p>
<p>You can now draw as many squares series as touch points your screen supports! Even better, the same code works for touch, mouse &amp; pen. This means for instance that you can use your mouse to draw some lines at the same time you are using your fingers to draw other lines. <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Clignement d'&oelig;il" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0434.wlEmoticon-winkingsmile_05155995.png"></p>
<p>If you’d like to change the behavior of your code based on the type of input, you can test that through the <code>pointerType </code>property value. For instance, let’s imagine that we want to draw some 10px by 10px red squares for fingers, 5px by 5px green squares for pen and 2px by 2px blue squares for mouse. You need to replace the previous handler (the paint function) with this one:</p><pre class="code"><span style="color: blue">function </span>paint(event) {
    <span style="color: blue">if </span>(event.pointerType) {
        <span style="color: blue">switch </span>(event.pointerType) {
            <span style="color: blue">case </span><span style="color: maroon">"touch"</span>:
                <span style="color: #006400">// A touchscreen was used
                // Drawing in red with a square of 10
                </span>context.fillStyle = <span style="color: maroon">"rgba(255, 0, 0, 0.5)"</span>;
                squaresize = 10;
                <span style="color: blue">break</span>;
            <span style="color: blue">case </span><span style="color: maroon">"pen"</span>:
                <span style="color: #006400">// A pen was used
                // Drawing in green with a square of 5
                </span>context.fillStyle = <span style="color: maroon">"rgba(0, 255, 0, 0.5)"</span>;
                squaresize = 5;
                <span style="color: blue">break</span>;
            <span style="color: blue">case </span><span style="color: maroon">"mouse"</span>:
                <span style="color: #006400">// A mouse was used
                // Drawing in blue with a squre of 2
                </span>context.fillStyle = <span style="color: maroon">"rgba(0, 0, 255, 0.5)"</span>;
                squaresize = 2;
                <span style="color: blue">break</span>;
        }

        context.fillRect(event.clientX, event.clientY, squaresize, squaresize);
    }
}</pre>
<p>And you can test the result here:</p>
<table cellspacing="0" cellpadding="2" width="900" border="0">
<tbody>
<tr>
<td valign="top" width="450"><iframe src="https://david.blob.core.windows.net/html5/PECR/touchsample4.htm" width="430" height="430" frameBorder="0"></iframe></td>
<td valign="top" width="450">
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center"><em>Sample 2b</em>: testing <strong>pointerType</strong> to test touch/pen or mouse</p>
<p align="center"><em>Result</em>: You can change the <strong>behavior for mouse/pen/touch</strong> but since 2a the <strong><font color="#804040">code now <em>only</em> works in browsers supporting Pointer Events</font></strong></p></td></tr></tbody></table>
<p><strong><u>IE10 users:</u></strong> test the prefixed version here: <a href="https://david.blob.core.windows.net/html5/touchsample4.htm" target="_blank">https://david.blob.core.windows.net/html5/touchsample4.htm</a></p>
<p>If you’re lucky enough to have a device supporting the 3 types of inputs (like the<em> Sony Duo 11, </em>the <em>Microsoft Surface Pro</em> or the <em>Samsung Tablet</em> some of you had during BUILD2011), you will be able to see 3 kind of drawing based on the input type. Great, isn’t it?</p>
<p>Still, there is a problem with this code. It now handles all type of inputs properly in browsers supporting Pointer Events but doesn’t work at all in others browsers like IE9, Chrome, Opera &amp; Safari.</p>
<h3>Step 3: do feature detection to provide a fallback code</h3>
<p>As you’re probably already aware, the best approach to handle multi-browsers support is to do features detection. In our case, you need to test this:</p><pre class="code">window.PointerEvent</pre>
<p>Beware that this only tells you if the current browser supports Pointer. It doesn’t tell you if touch is supported or not. To test support for touch or not, you need to check <a href="https://www.w3.org/TR/pointerevents/#widl-Navigator-maxTouchPoints">maxTouchPoints</a><strong></strong>.</p>
<p>In conclusion, to have a code supporting Pointer and falling back properly to mouse events in other browsers, you need a code like that:</p><pre class="code"><span style="color: blue">var </span>canvas = document.getElementById(<span style="color: maroon">"drawSurface"</span>);
<span style="color: blue">var </span>context = canvas.getContext(<span style="color: maroon">"2d"</span>);
context.fillStyle = <span style="color: maroon">"rgba(0, 0, 255, 0.5)"</span>;
<span style="color: blue">if </span>(window.PointerEvent) {
    <span style="color: #006400">// Pointer events are supported.
    </span>canvas.addEventListener(<span style="color: maroon">"pointermove"</span>, paint, <span style="color: blue">false</span>);
}
<span style="color: blue">else </span>{
    canvas.addEventListener(<span style="color: maroon">"mousemove"</span>, paint, <span style="color: blue">false</span>);
}

<span style="color: blue">function </span>paint(event) {
    <span style="color: blue">var </span>squaresize = 2;
    <span style="color: blue">if </span>(event.pointerType) {
        <span style="color: blue">switch </span>(event.pointerType) {
            <span style="color: blue">case </span><span style="color: maroon">"touch"</span>:
                <span style="color: #006400">// A touchscreen was used
                // Drawing in red with a square of 10
                </span>context.fillStyle = <span style="color: maroon">"rgba(255, 0, 0, 0.5)"</span>;
                squaresize = 10;
                <span style="color: blue">break</span>;
            <span style="color: blue">case </span><span style="color: maroon">"pen"</span>:
                <span style="color: #006400">// A pen was used
                // Drawing in green with a square of 5
                </span>context.fillStyle = <span style="color: maroon">"rgba(0, 255, 0, 0.5)"</span>;
                squaresize = 5;
                <span style="color: blue">break</span>;
            <span style="color: blue">case </span><span style="color: maroon">"mouse"</span>:
                <span style="color: #006400">// A mouse was used
                // Drawing in blue with a square of 2
                </span>context.fillStyle = <span style="color: maroon">"rgba(0, 0, 255, 0.5)"</span>;
                squaresize = 2;
                <span style="color: blue">break</span>;
        }
    }

    context.fillRect(event.clientX, event.clientY, squaresize, squaresize);
}</pre>
<p>And again you can test the result here:</p>
<table cellspacing="0" cellpadding="2" width="900" border="0">
<tbody>
<tr>
<td valign="top" width="450"><iframe src="https://david.blob.core.windows.net/html5/PECR/touchsample5.htm" width="430" height="430" frameBorder="0"></iframe></td>
<td valign="top" width="450">
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center"><em>Sample 3</em>: feature detecting <strong>PointerEvent</strong> to provide a fallback</p>
<p align="center"><em>Result</em>: full complete experience in IE11/MS Edge &amp; Firefox Nightly and <strong>default mouse events in other browsers</strong></p></td></tr></tbody></table>
<p><strong><u>IE10 users:</u></strong> test the prefixed version here: <a href="https://david.blob.core.windows.net/html5/touchsample5.htm" target="_blank">https://david.blob.core.windows.net/html5/touchsample5.htm</a></p>
<h3>Step 4: support all touch implementation</h3>
<p>If you’d like to go even further and support all browsers &amp; all touch implementations, you have 2 choices:</p>
<p>1 – Write the code to address both events models in parallel like described for instance in this article: <a href="https://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx">Handling Multi-touch and Mouse Input in All Browsers</a></p>
<p>2 – Just add a reference to HandJS, the awesome JavaScript polyfill library written by my friend David Catuhe like described in his article:&nbsp; <a href="https://blogs.msdn.com/b/eternalcoding/archive/2013/01/16/hand-js-a-polyfill-for-supporting-pointer-events-on-every-browser.aspx">HandJS a polyfill for supporting pointer events on every browser</a></p>
<p>David wrote a cool little library that lets you write code leveraging the Pointer Events specification. As I mentioned in the introduction of this article, Microsoft recently<a href="https://blogs.msdn.com/b/ie/archive/2012/09/24/towards-interoperable-pointer-events-evolving-input-events-for-multiple-devices.aspx"> submitted the MSPointer Events specification to W3C</a> for standardization. The W3C created a new Working Group and it has already published <a href="https://www.w3.org/TR/pointerevents/" target="_blank">a W3C Recommendation</a> based on Microsoft’s proposal. The MS Open Tech team also released an <a href="https://blogs.msdn.com/b/interoperability/archive/2012/12/18/open-source-release-from-ms-open-tech-pointer-events-initial-prototype-for-webkit.aspx">initial Pointer Events prototype for Webkit</a> that you might be interested in.</p>
<p>While the Pointer Events specification is not yet a standard, you can still already implement code that supports it leveraging <a href="https://blogs.msdn.com/b/eternalcoding/archive/2013/01/16/hand-js-a-polyfill-for-supporting-pointer-events-on-every-browser.aspx">David’s Polyfill</a> and be ready for when Pointer Events will be a standard implemented in all modern browsers. With David’s library the events will be propagated to MSPointer on IE10, to Touch Events on Webkit based browsers and finally to mouse events as a last resort. In Internet Explorer 11, MS Edge &amp; Firefox Nightly, it will be simply disabled as they implement the last version of the W3C spec. It’s damn cool! Check out his article to discover and understand how it works. Note that this polyfill will also be very useful then to support older browser with elegant fallbacks to mouse events.</p>
<p>To have an idea on how to use this library, please have a look to this article: <a title="https://blogs.msdn.com/b/davrous/archive/2013/02/16/creating-an-universal-virtual-touch-joystick-working-for-all-touch-models-thanks-to-hand-js.aspx" href="https://blogs.msdn.com/b/davrous/archive/2013/02/16/creating-an-universal-virtual-touch-joystick-working-for-all-touch-models-thanks-to-hand-js.aspx">Creating an universal virtual touch joystick working for all Touch models thanks to Hand.JS</a> which shows you how to write a virtual touch joystick using pointer events. Thanks to HandJS, it will work on IE10 on Windows 8/RT, Windows Phone 8, iPad/iPhone &amp; Android devices with the very same code base!</p>
<p>We are also using Hand.js in our <strong>WebGL open-source 3d engine</strong>: <a href="https://www.babylonjs.com">https://www.babylonjs.com</a> . Launch a scene in your WebGL compatible browser and switch the camera to the “Touch camera” for mono-touch control or “Virtual joysticks camera” to use your two thumbs in the control panel:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6607.image_2DAA6ED3.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8132.image_thumb_6C324D2A.png" width="326" height="367"></a></p>
<p>And you’ll be able to move into the 3d world thanks to the power of your finger(s)! <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Clignement d'&oelig;il" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2772.wlEmoticon-winkingsmile_055C7810.png"></p>
<h2>Recognizing simple gestures</h2>
<p>Now that we’ve seen how to handle multi-touch, let’s see how to recognize simple gestures like tapping or holding an element and then some more advanced gestures like translating or scaling an element.</p>
<p>Thankfully, IE10/11 &amp; MS Edge provide a MSGesture object that’s going to help us. Note that this object is currently specific to IE &amp; MS Edge and not part of the W3C specification. Combined with the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/hh453593.aspx">MSCSSMatrix</a> element in IE11 (MS Edge is rather using the <a href="https://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/WebKitCSSMatrixClassReference/WebKitCSSMatrix/WebKitCSSMatrix.html">WebKitCSSMatrix</a> one), you’ll see that you can build very interesting multi-touch experiences in a very simple way. CSSMatrix is indeed representing a 4×4 homogeneous matrix that enables Document Object Model (DOM) scripting access to CSS 2-D and 3-D Transforms functionality. But before playing with that, let’s start with the basics.</p>
<p>The base concept is to <strong>first register to pointerdown</strong>. Then inside the handler taking care of pointerdown, you need to <strong>choose</strong> <strong>which pointers you’d like to send to the MSGesture object</strong> to let it detect a specific gesture. It will then trigger one of those events: <a href="https://msdn.microsoft.com/en-us/library/hh771901(v=vs.85).aspx"><strong>MSGestureTap</strong></a>, <a href="https://msdn.microsoft.com/en-us/library/hh771894(v=vs.85).aspx"><strong>MSGestureHold</strong></a>, <a href="https://msdn.microsoft.com/en-us/library/hh771898(v=vs.85).aspx"><strong>MSGestureStart</strong></a>, <a href="https://msdn.microsoft.com/en-us/library/hh771887(v=vs.85).aspx"><strong>MSGestureChange</strong></a>, <a href="https://msdn.microsoft.com/en-us/library/hh771892(v=vs.85).aspx"><strong>MSGestureEnd</strong></a>, <a href="https://msdn.microsoft.com/en-us/library/hh771906(v=vs.85).aspx"><strong>MSInertiaStart</strong></a>. The MSGesture object will then take all the pointers submitted as input parameters and will apply a gesture recognizer on top of them to provide some formatted data as output. The only thing you need to do is to choose/filter which pointers you’d like to be part of the gesture (based on their ID, coordinates on the screen, whatever…). The MSGesture object will do all the magic for you after that.</p>
<h3>Sample 1: handling the hold gesture</h3>
<p>We’re going to see how to hold an element (a simple DIV containing an image as a background). Once the element will be held, we will add some corners to indicate to the user he has currently selected this element. The corners will be generated by dynamically creating 4 div added on top of each corner of the image. Finally, some CSS tricks will use transformation and linear gradients in a smart way to obtain something like this:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6840.image_576B37A6.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5025.image_thumb_1D7E856B.png" width="240" height="187"></a></p>
<p>The sequence will be the following one:</p>
<p>1 - register to pointerdown &amp; <a href="https://msdn.microsoft.com/en-us/library/hh771894(v=vs.85).aspx">MSPointerHold</a> events on the HTML element you’re interested in</p>
<p>2 - create a MSGesture object that will target this very same HTML element&nbsp; <br>3 - inside the pointerdown handler, add to the MSGesture object the various PointerID you’d like to monitor (all of them or a subset of them based on what you’d like to achieve)</p>
<p>4 - inside the MSPointerHold event handler, check in the details if the user has just started the hold gesture (MSGESTURE_FLAG_BEGIN flag). If so, add the corners. If not, remove them.</p>
<p>This leads to the following code:</p><pre class="code"><span style="color: blue">&lt;!</span><span style="color: maroon">DOCTYPE </span><span style="color: red">html</span><span style="color: blue">&gt;
&lt;</span><span style="color: maroon">html</span><span style="color: blue">&gt;
&lt;</span><span style="color: maroon">head</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">title</span><span style="color: blue">&gt;</span>Touch article sample 5: simple gesture handler<span style="color: blue">&lt;/</span><span style="color: maroon">title</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">link </span><span style="color: red">rel</span><span style="color: blue">="stylesheet" </span><span style="color: red">type</span><span style="color: blue">="text/css" </span><span style="color: red">href</span><span style="color: blue">="toucharticle.css" /&gt;
    &lt;</span><span style="color: maroon">script </span><span style="color: red">src</span><span style="color: blue">="Corners.js"&gt;&lt;/</span><span style="color: maroon">script</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">head</span><span style="color: blue">&gt;
&lt;</span><span style="color: maroon">body</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">div </span><span style="color: red">id</span><span style="color: blue">="myGreatPicture" </span><span style="color: red">class</span><span style="color: blue">="container" /&gt;
    &lt;</span><span style="color: maroon">script</span><span style="color: blue">&gt;
        var </span>myGreatPic = document.getElementById(<span style="color: maroon">"myGreatPicture"</span>);
        <span style="color: #006400">// Creating a new MSGesture that will monitor the myGreatPic DOM Element
        </span><span style="color: blue">var </span>myGreatPicAssociatedGesture = <span style="color: blue">new </span>MSGesture();
        myGreatPicAssociatedGesture.target = myGreatPic;

        <span style="color: #006400">// You need to first register to pointerdown to be able to
        // have access to more complex Gesture events
        </span>myGreatPic.addEventListener(<span style="color: maroon">"pointerdown"</span>, pointerdown, <span style="color: blue">false</span>);
        myGreatPic.addEventListener(<span style="color: maroon">"MSGestureHold"</span>, holded, <span style="color: blue">false</span>);

        <span style="color: #006400">// Once pointer down raised, we're sending all pointers to the MSGesture object
        </span><span style="color: blue">function </span>pointerdown(event) {
            myGreatPicAssociatedGesture.addPointer(event.pointerId);
        }

        <span style="color: #006400">// This event will be triggered by the MSGesture object
        // based on the pointers provided during the MSPointerDown event
        </span><span style="color: blue">function </span>holded(event) {
            <span style="color: #006400">// The gesture begins, we're adding the corners
            </span><span style="color: blue">if </span>(event.detail === event.MSGESTURE_FLAG_BEGIN) {
                Corners.append(myGreatPic);
            }
            <span style="color: blue">else </span>{
                <span style="color: #006400">// The user has released his finger, the gesture ends
                // We're removing the corners
                </span>Corners.remove(myGreatPic);
            }
        }

        <span style="color: #006400">// To avoid having the equivalent of the contextual  
        // "right click" menu being displayed on the MSPointerUp event, 
        // we're preventing the default behavior
        </span>myGreatPic.addEventListener(<span style="color: maroon">"contextmenu"</span>, <span style="color: blue">function </span>(e) {
            e.preventDefault();    <span style="color: #006400">// Disables system menu
        </span>}, <span style="color: blue">false</span>);
    <span style="color: blue">&lt;/</span><span style="color: maroon">script</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">body</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">html</span><span style="color: blue">&gt;</span></pre>
<p>And here is the result:</p>
<p><iframe src="https://david.blob.core.windows.net/html5/PECR/touchsample6.html" width="430" height="430" frameBorder="0"></iframe></p>
<p><strong><u>IE10 users:</u></strong> test with the prefixed version of Pointers here: <a href="https://david.blob.core.windows.net/html5/touchsample6.html" target="_blank">https://david.blob.core.windows.net/html5/touchsample6.html</a></p>
<p>Try to just tap or mouse click the element, nothing occurs. Touch &amp; maintain only 1 finger on the image or do a long mouse click on it, the corners appear. Release your finger, the corners disappear.</p>
<p>Touch &amp; maintains 2 or more fingers on the image, nothing happens as the Hold gesture is only being triggered only if 1 unique finger is holding the element.</p>
<p><strong><u>Note:</u></strong> the white border, the corners &amp; the background image are set via CSS defined in <em>toucharticle.css</em>. <em>Corners.js</em> simply creates 4 DIVs (with the append function) and places them on top of the main element in each corner with the appropriate CSS classes.</p>
<p>Still, there is something I’m not happy with in the current result. Once you’re holding the picture, as soon as you’re slightly moving your finger, the MSGESTURE_FLAG_CANCEL flag is raised and caught by the handler which removes the corners. I would rather like to remove the corners only once the user releases his finger anywhere above the picture or as soon as he’s moving his finger out of the box delimited by the picture. To do that, we’re going to remove the corners only on the pointerup or the pointerout. This gives this code instead:</p><pre class="code"><span style="color: blue">var </span>myGreatPic = document.getElementById(<span style="color: maroon">"myGreatPicture"</span>);
<span style="color: #006400">// Creating a new MSGesture that will monitor the myGreatPic DOM Element
</span><span style="color: blue">var </span>myGreatPicAssociatedGesture = <span style="color: blue">new </span>MSGesture();
myGreatPicAssociatedGesture.target = myGreatPic;

<span style="color: #006400">// You need to first register to pointerdown to be able to
// have access to more complex Gesture events
</span>myGreatPic.addEventListener(<span style="color: maroon">"pointerdown"</span>, pointerdown, <span style="color: blue">false</span>);
myGreatPic.addEventListener(<span style="color: maroon">"MSGestureHold"</span>, holded, <span style="color: blue">false</span>);
myGreatPic.addEventListener(<span style="color: maroon">"pointerup"</span>, removecorners, <span style="color: blue">false</span>);
myGreatPic.addEventListener(<span style="color: maroon">"pointerout"</span>, removecorners, <span style="color: blue">false</span>);

<span style="color: #006400">// Once touched, we're sending all pointers to the MSGesture object
</span><span style="color: blue">function </span>pointerdown(event) {
    myGreatPicAssociatedGesture.addPointer(event.pointerId);
}

<span style="color: #006400">// This event will be triggered by the MSGesture object
// based on the pointers provided during the pointerdown event
</span><span style="color: blue">function </span>holded(event) {
    <span style="color: #006400">// The gesture begins, we're adding the corners
    </span><span style="color: blue">if </span>(event.detail === event.MSGESTURE_FLAG_BEGIN) {
        Corners.append(myGreatPic);
    }
}

<span style="color: #006400">// We're removing the corners on pointer Up or Out
</span><span style="color: blue">function </span>removecorners(event) {
    Corners.remove(myGreatPic);
}

<span style="color: #006400">// To avoid having the equivalent of the contextual  
// "right click" menu being displayed on the pointerup event, 
// we're preventing the default behavior
</span>myGreatPic.addEventListener(<span style="color: maroon">"contextmenu"</span>, <span style="color: blue">function </span>(e) {
    e.preventDefault();    <span style="color: #006400">// Disables system menu
</span>}, <span style="color: blue">false</span>);</pre>
<p>which now provides the behavior I was looking for:</p>
<p><iframe src="https://david.blob.core.windows.net/html5/PECR/touchsample6b.html" width="430" height="430" frameBorder="0"></iframe></p>
<p><strong><u>IE10 users:</u></strong> test with the unprefixed version of Pointers here: <a href="https://david.blob.core.windows.net/html5/touchsample6b.html" target="_blank">https://david.blob.core.windows.net/html5/touchsample6b.html</a></p>
<h3>Sample 2: handling scale, translation &amp; rotation</h3>
<p>Finally, if you want to scale, translate or rotate an element, you simply need to write a very few lines of code. You need to first to register to the <a href="https://msdn.microsoft.com/en-us/library/hh771887(v=vs.85).aspx">MSGestureChange</a> event. This event will send you via the various attributes described in the <a href="https://msdn.microsoft.com/en-us/library/hh772076(v=vs.85).aspx">MSGestureEvent object</a> documentation like <a href="https://msdn.microsoft.com/en-us/library/hh772363(v=vs.85).aspx">rotation</a>, <a href="https://msdn.microsoft.com/en-us/library/hh772082(v=vs.85).aspx">scale</a>, <a href="https://msdn.microsoft.com/en-us/library/hh772083(v=vs.85).aspx">translationX</a>, <a href="https://msdn.microsoft.com/en-us/library/hh772085(v=vs.85).aspx">translationY</a> currently applied to your HTML element.</p>
<p>Even better, by default, the MSGesture object is providing an inertia algorithm for free. This means that you can take the HTML element and throw it on the screen using your fingers and the animation will be handled for you.</p>
<p>Lastly, to reflect these changes sent by the MSGesture, you need to move the element accordingly. The easiest way to do that is to apply some CSS Transformation mapping the rotation, scale, translation details matching your fingers gesture. For that, use the <a href="https://msdn.microsoft.com/en-us/library/windows/apps/hh453593.aspx">MSCSSMatrix</a> element.</p>
<p>In conclusion, if you’d like to handle all this cool gestures to the previous samples, register to the event like that:</p><pre class="code">myGreatPic.addEventListener(<span style="color: maroon">"MSGestureChange"</span>, manipulateElement, <span style="color: blue">false</span>);</pre>
<p>And use the following handler:</p><pre class="code"><span style="color: blue">function </span><span style="color: black">manipulateElement(e) {
    </span><span style="color: green">// Uncomment the following code if you want to disable the built-in inertia provided by dynamic gesture recognition
    // if (e.detail == e.MSGESTURE_FLAG_INERTIA)
    // return;

    </span><span style="color: blue">var </span><span style="color: black">m;
    </span><span style="color: blue">if </span><span style="color: black">(window.WebKitCSSMatrix) {<br>        <span style="color: green">// Get the latest CSS transform on the element in MS Edge </span></span><span style="color: black">
        m = </span><span style="color: blue">new </span><span style="color: black">WebKitCSSMatrix(window.getComputedStyle(myGreatPic, </span><span style="color: blue">null</span><span style="color: black">).transform); </span><span style="color: green">
    </span><span style="color: black">}
    </span><span style="color: blue">else if </span><span style="color: black">(window.MSCSSMatrix) {<br>        <span style="color: green">// Get the latest CSS transform on the element in IE11 </span>
        m = </span><span style="color: blue">new </span><span style="color: black">MSCSSMatrix(window.getComputedStyle(myGreatPic, </span><span style="color: blue">null</span><span style="color: black">).transform);</span><span style="color: green">
    </span><span style="color: black">}
    </span><span style="color: blue">if </span><span style="color: black">(m) {
        e.target.style.transform = m
        .translate(e.offsetX, e.offsetY) </span><span style="color: green">// Move the transform origin under the center of the gesture
        </span><span style="color: black">.rotate(e.rotation * 180 / Math.PI) </span><span style="color: green">// Apply Rotation
        </span><span style="color: black">.scale(e.scale) </span><span style="color: green">// Apply Scale
        </span><span style="color: black">.translate(e.translationX, e.translationY) </span><span style="color: green">// Apply Translation
        </span><span style="color: black">.translate(-e.offsetX, -e.offsetY); </span><span style="color: green">// Move the transform origin back
    </span><span style="color: black">}
}</span></pre>
<p>which gives you this final sample:</p>
<p><iframe height="500" src="https://david.blob.core.windows.net/html5/PECR/touchsample7.html" width="900"></iframe></p>
<p><strong><u>IE10 users:</u></strong> test with the prefixed version of Pointers here: <a href="https://david.blob.core.windows.net/html5/touchsample7.html" target="_blank">https://david.blob.core.windows.net/html5/touchsample7.html</a></p>
<p>Try to move and throw the image inside the black area with 1 or more fingers. Try also to scale or rotate the element with 2 or more fingers. The result is awesome and the code is very simple as all the complexity is being handled natively by IE / MS Edge.</p>
<h2>Video &amp; direct link to all samples</h2>
<p>If you don’t have a touch screen experience available for IE / MS Edge and you’re wondering how these samples works, have a look at this video where I’m describing all samples shared in this article on the Samsung BUILD2011 tablet:</p>
<div class="video-js-box"><!-- Using the Video for Everybody Embed Code https://camendesign.com/code/video_for_everybody --><video id="MSPointerEventsArticleVideo" class="video-js" height="288" width="512" controls="controls" preload="preload" poster="https://david.blob.core.windows.net/videos/MSPointerEventsArticleVideo.jpg"><!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->


                     <!-- Image Fallback. Typically the same as the poster image. -->                     <img title="No video playback capabilities." alt="Poster Image" src="https://david.blob.core.windows.net/videos/MSPointerEventsArticleVideo.jpg" width="512" height="288" />                 
<p></video><!-- Download links provided for devices that can't play video in the browser. --></p>
<p class="vjs-no-video"><strong>Download Video:</strong> <a href="https://david.blob.core.windows.net/videos/MSPointerEventsArticleVideo.mp4">MP4</a>, <a href="https://david.blob.core.windows.net/videos/MSPointerEventsArticleVideo.webm">WebM</a>, <!-- Support VideoJS by keeping this link. --><a href="https://videojs.com">HTML5 Video Player</a> by VideoJS</p></div>
<p>And you can also have a look to all of them here:</p>
<p>- <a title="https://david.blob.core.windows.net/html5/touchsample1.htm" href="https://david.blob.core.windows.net/html5/touchsample1.htm" target="_blank">Simple touch sample 0 with nothing done</a>&nbsp; <br>- <a title="https://david.blob.core.windows.net/html5/touchsample2.htm" href="https://david.blob.core.windows.net/html5/PECR/touchsample2.htm" target="_blank">Simple touch sample 1 with CSS touch-action</a>&nbsp; <br>- <a title="https://david.blob.core.windows.net/html5/touchsample3.htm" href="https://david.blob.core.windows.net/html5/PECR/touchsample3.htm" target="_blank">Simple touch sample 2a with basic pointermove implementation</a>&nbsp; <br>- <a title="https://david.blob.core.windows.net/html5/touchsample4.htm" href="https://david.blob.core.windows.net/html5/PECR/touchsample4.htm" target="_blank">Simple touch sample 2b with pointerType differentiation</a>&nbsp; <br>- <a title="https://david.blob.core.windows.net/html5/touchsample5.htm" href="https://david.blob.core.windows.net/html5/PECR/touchsample5.htm" target="_blank">Simple touch sample 3 with Pointers and mouse fallback</a>&nbsp; <br>- <a title="https://david.blob.core.windows.net/html5/touchsample6.html" href="https://david.blob.core.windows.net/html5/PECR/touchsample6.html" target="_blank">MSGesture sample 1: MSGestureHold handler</a>&nbsp; <br>- <a title="https://david.blob.core.windows.net/html5/touchsample6b.html" href="https://david.blob.core.windows.net/html5/PECR/touchsample6b.html" target="_blank">MSGesture sample 1b: MSGestureHold handler</a>&nbsp; <br>- <a title="https://david.blob.core.windows.net/html5/touchsample7.html" href="https://david.blob.core.windows.net/html5/PECR/touchsample7.html" target="_blank">MSGesture sample 2: MSGestureChange</a>&nbsp;</p>
<h2>Associated resources: </h2>
<p>- <a href="https://www.w3.org/TR/pointerevents/">W3C Pointer Events Specification</a></p>
<p>- <a href="https://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx">Handling Multi-touch and Mouse Input in All Browsers</a> : the polyfill library that should help a lot of developers in the future&nbsp; <br>- <a href="https://msdn.microsoft.com/en-us/library/hh673557(v=vs.85).aspx">Pointer and gesture events</a></p>
<p>- <a title="https://blogs.msdn.com/b/ie/archive/2012/06/20/go-beyond-pan-zoom-and-tap-using-gesture-events.aspx" href="https://blogs.msdn.com/b/ie/archive/2012/06/20/go-beyond-pan-zoom-and-tap-using-gesture-events.aspx">Go Beyond Pan, Zoom, and Tap Using Gesture Events</a></p>
<p>- <a href="https://ie.microsoft.com/testdrive/Browser/BrowserSurface/">IE Test Drive Browser Surface</a> which has greatly inspired lot of the embedded demos</p>
<p>- Try some awesome games in IE10/11 &amp; MS Edge with Touch:</p>
<p>&nbsp; - <a href="https://www.contrejour.ie">Contre Jour</a> and read a very interesting <a href="https://www.contrejour.ie/BehindTheScenes.html">Behind The Scenes</a> article</p>
<p>&nbsp; - <a href="https://atari.com/arcade">Atari Arcade Games</a> and read also this very informative article: <a title="https://atari.com/arcade/developers/building-atari-createjs" href="https://atari.com/arcade/developers/building-atari-createjs">Building Atari with CreateJS</a> which details the choice made to support Touch in all platforms.</p>
<p>- Recording of the BUILD session 3-140: <a title="Touchscreen and stylus and mouse, oh my!" href="https://channel9.msdn.com/Events/Build/2012/3-140">Touchscreen and stylus and mouse, oh my!</a></p>
<p>Logically, with all the details shared in this article and associated links to other resources, <strong>you’re now ready to implement the Pointer Events model in your websites</strong> &amp; Windows Store applications. You have then the opportunity to easily enhance the experience of your users in Internet Explorer 10/11, Microsoft Edge and soon every Firefox users!</p>
<p><a class="twitter-follow-button" href="https://twitter.com/davrous">Follow the author @davrous</a></p><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>]]></content:encoded>
    </item>
    <item>
      <title>Experimenting ECMAScript 6 in an easy way on Babylon.js with TypeScript 1.5</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/experimenting-ecmascript-6-in-an-easy-way-on-babylon-js-with-typescript-1-5</link>
      <pubDate>Thu, 23 Jul 2015 07:41:20 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2015/07/23/experimenting-ecmascript-6-in-an-easy-way-on-babylon-js-with-typescript-1-5/</guid>
      <description><![CDATA[I’m definitely more than happy that we’ve decided more than one year ago to switch over to...]]></description>
      <content:encoded><![CDATA[<p>I’m definitely more than happy that we’ve decided more than one year ago to switch over to TypeScript. David has already explained the reasons behind: <a title="https://blogs.msdn.com/b/eternalcoding/archive/2014/04/28/why-we-decided-to-move-from-plain-javascript-to-typescript-for-babylon-js.aspx" href="https://blogs.msdn.com/b/eternalcoding/archive/2014/04/28/why-we-decided-to-move-from-plain-javascript-to-typescript-for-babylon-js.aspx" target="_blank">Why we decided to move from plain JavaScript to TypeScript for Babylon.js</a></p>  <p>Thanks to TypeScript, we’ve been able to <strong>improve the quality</strong> of our code, <strong>improve our productivity</strong> and create <strong>our fabulous Playground</strong> we’re so proud of: <a title="https://www.babylonjs-playground.com/" href="https://www.babylonjs-playground.com/">https://www.babylonjs-playground.com/</a> which provides auto-completion in the browser! We’ve also been able to welcome some new team members coming from a C# background and few JS skills with no pain. But thanks to the TypeScript compiler, we can also <strong>test the future without rewriting a single line of code</strong>!</p>  <p>David and I are still coding <strong>babylon.js</strong> using Visual Studio and TFS while pushing in a regular manner our code to the <a href="https://github.com/BabylonJS/Babylon.js" target="_blank">github repo</a>. By upgrading our project to <a href="https://www.visualstudio.com/downloads/download-visual-studio-vs?CR_CC=200657563" target="_blank">Visual Studio 2015 RTM</a>, we’ve been able to upgrade it to <strong>TypeScript 1.5</strong>.</p>  <p>Once done, let me show you how quickly I’ve <strong>upgraded Babylon.js from ES5 to ES6</strong>. Right-click on your project, navigate to “<strong>TypeScript Build</strong>” and switch the “<strong>ECMAScript version</strong>” from ES5 to ES6:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0550.image_06BC5EE2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/0550.image_5F00_06BC5EE2.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7144.image_thumb_78ECA997.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/7144.image_5F00_thumb_5F00_78ECA997.png" width="600" height="336" /></a></p>  <p>And that’s it! <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Sourire" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1731.wlEmoticon-smile_69DAEC1F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/1731.wlEmoticon_2D00_smile_5F00_69DAEC1F.png" /></p>  <p>Recompile the solution and you can test the future of ES6 today.</p>  <p>I’ve published an ES6 version of babylonjs.com here: <a href="https://www.babylonjs.com/indexES6.html">https://www.babylonjs.com/indexES6.html</a> to let you play with it. </p>  <h2>Microsoft Edge and ES6</h2>  <p>If you’re interested in ES6, I would recommend you watching this BUILD session: <a title="https://channel9.msdn.com/Events/Build/2015/2-763" href="https://channel9.msdn.com/Events/Build/2015/2-763" target="_blank">What’s New in JavaScript for Fast and Scalable Apps</a></p>  <p>You’ll then note you need a very recent modern browser such as Microsoft Edge to be able to execute this demo &amp; code. MS Edge with Firefox 41 are currently the most advanced browsers in ES6 support. You can check your current browser ES6 support by navigating to this URL: <a title="https://kangax.github.io/compat-table/es6/" href="https://kangax.github.io/compat-table/es6/">https://kangax.github.io/compat-table/es6/</a></p>  <p>Launching it in MS Edge on Windows 10 (build 10240), you’ll have those results:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8233.image_6BC8F237.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/8233.image_5F00_6BC8F237.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0624.image_thumb_0BF1DFCD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/0624.image_5F00_thumb_5F00_0BF1DFCD.png" width="950" height="372" /></a></p>  <p><strong>67% of ES6 features supported in MS Edge</strong> and <strong>68% in Firefox 41 </strong>out of the box. Those results are impressive!</p>  <p>Still, if you’re launching the <a href="https://www.babylonjs.com/indexES6.html" target="_blank">ES6 version of Babylon.js</a> in MS Edge, you’ll see some errors in F12:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4784.image_5F3C677D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/4784.image_5F00_5F3C677D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2148.image_thumb_2EA8E9C5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/2148.image_5F00_thumb_5F00_2EA8E9C5.png" width="907" height="353" /></a></p>  <p>Let’s navigate to <em>babylon.math.js</em> to check the error. We’re falling here:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1425.image_177D6F47.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/1425.image_5F00_177D6F47.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4606.image_thumb_3C118D7C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/4606.image_5F00_thumb_5F00_3C118D7C.png" width="907" height="353" /></a></p>  <p>The “<strong>class</strong>” keyword is not supported yet for production. This is because the spec has changed recently and all browsers are thus putting it behind a flag. </p>  <p>To enable it, navigate to “<strong>about:flags</strong>” in MS Edge and “<strong>Enable experimental JavaScript features</strong>”</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0830.image_401E6BFF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/0830.image_5F00_401E6BFF.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8284.image_thumb_1AB47891.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/8284.image_5F00_thumb_5F00_1AB47891.png" width="640" height="249" /></a></p>  <p>If you now run again the ES6 compatibility tool: <a title="https://kangax.github.io/compat-table/es6/" href="https://kangax.github.io/compat-table/es6/">https://kangax.github.io/compat-table/es6/</a>, you’ll see now that <strong>MS Edge is jumping to 81% of ES6 features</strong> supported. It now supports class, super &amp; generators:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2251.image_67AC39A3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/2251.image_5F00_67AC39A3.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7571.image_thumb_77BB085A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/7571.image_5F00_thumb_5F00_77BB085A.png" width="400" height="175" /></a></p>  <p>To make this demo works in Firefox or Chrome, you’ll probably need a nightly build. </p>  <h2>Time to play with it in F12</h2>  <p>Now that MS Edge is properly configured, navigate to: <a href="https://www.babylonjs.com/indexES6.html">https://www.babylonjs.com/indexES6.html</a> and <strong>open F12</strong> in a separate window. In the “<strong>Debugger</strong>” tab, open “<strong>babylon.gamepadCamera.js</strong>” and set a <strong>breakpoint</strong> on the “super” line of code:</p>  <p>&#160;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1307.image_0388FE13.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/1307.image_5F00_0388FE13.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0257.image_thumb_031F5BCF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/0257.image_5F00_thumb_5F00_031F5BCF.png" width="900" height="341" /></a></p>  <p>Launch the “<strong>Mansion</strong>” demo and switch the camera to “<strong>Gamepad Camera</strong>”:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0535.image_0D3AD867.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/0535.image_5F00_0D3AD867.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6354.image_thumb_6EF02170.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/6354.image_5F00_thumb_5F00_6EF02170.png" width="240" height="225" /></a></p>  <p>You’ll properly break into the code as expected:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7140.image_677D6089.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/7140.image_5F00_677D6089.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7180.image_thumb_24A11C0F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/7180.image_5F00_thumb_5F00_24A11C0F.png" width="900" height="340" /></a></p>  <p>Press <strong>F11</strong> to jump into the extended class (<strong>BABYLON.FreeCamera</strong>):</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2577.image_48C9074F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/2577.image_5F00_48C9074F.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0447.image_thumb_6CF0F28F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/0447.image_5F00_thumb_5F00_6CF0F28F.png" width="900" height="340" /></a></p>  <p>You’re currently debugging ES6 code! Isn’t that cool? <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Sourire" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1731.wlEmoticon-smile_69DAEC1F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/1731.wlEmoticon_2D00_smile_5F00_69DAEC1F.png" /></p>  <p>In the “<strong>Debugger</strong>” tab, open “<strong>babylon.virtualJoystick.js</strong>” and set a breakpoint on line 78 inside the arrow function:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5277.image_3C5D74D7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/5277.image_5F00_3C5D74D7.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5226.image_thumb_2B78D0E7.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/5226.image_5F00_thumb_5F00_2B78D0E7.png" width="900" height="340" /></a></p>  <p>Switch the camera to “<strong>Virtual joysticks camera</strong>”, touch the screen or left click it and you’ll be able to debug the arrow function:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3750.image_447731DD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/3750.image_5F00_447731DD.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3884.image_thumb_286903A3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/3884.image_5F00_thumb_5F00_286903A3.png" width="900" height="340" /></a></p>  <p>Now, imagine you’d like to <strong>edit your ECMAScript 6 code</strong> to improve your debbuging experience. Go to the “<strong>Experiments</strong>” tab and enable the “<strong>Edit JavaScript</strong>” option:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2705.image_796807FF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/2705.image_5F00_796807FF.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3005.image_thumb_7DE11977.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/3005.image_5F00_thumb_5F00_7DE11977.png" width="600" height="136" /></a></p>  <p>And restart the browser. Now, add this line of code on the previous handle “<em>let foo = ‘test’</em>” and do again the previous action:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2766.image_3A482821.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/2766.image_5F00_3A482821.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6835.image_thumb_3082C0A9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/6835.image_5F00_thumb_5F00_3082C0A9.png" width="900" height="340" /></a></p>  <p>Ok, let’s recap. This demo is using: <strong>ECMAScript 6 with classes, super &amp; arrow functions, WebGL, Web Audio, Gamepad API and Pointer Events</strong>. Thank you Babylon.js, thank you TypeScript &amp; thank you MS Edge! <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Clignement d&#39;œil" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6076.wlEmoticon-winkingsmile_1FDF6B2D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-10-46-metablogapi/6076.wlEmoticon_2D00_winkingsmile_5F00_1FDF6B2D.png" /></p>  <p>If you’re interested about other improvements we’ve done in F12, have a look to this article: <a title="https://blogs.windows.com/msedgedev/2015/07/21/announcing-the-latest-improvements-for-the-f12-developer-tools-in-windows-10/" href="https://blogs.windows.com/msedgedev/2015/07/21/announcing-the-latest-improvements-for-the-f12-developer-tools-in-windows-10/" target="_blank">Announcing the latest improvements for the F12 developer tools in Windows 10</a>&#160;</p>  <p>David</p>]]></content:encoded>
    </item>
    <item>
      <title>Testing &amp; debugging your WebGL &amp; HTML5 experiences on Android &amp; Windows Phone thanks to the Visual Studio free emulators</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/testing-debugging-your-webgl-html5-experiences-on-android-windows-phone-thanks-to-the-visual-studio-free-emulators</link>
      <pubDate>Wed, 22 Jul 2015 06:16:49 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2015/07/22/testing-debugging-your-webgl-html5-experiences-on-android-windows-phone-thanks-to-the-visual-studio-free-emulators/</guid>
      <description><![CDATA[window.location =...]]></description>
      <content:encoded><![CDATA[<script>window.location = "https://www.davrous.com/2015/07/22/testing-debugging-your-webgl-html5-experiences-on-android-windows-phone-thanks-to-the-visual-studio-free-emulators/";</script>
<p>With the recent availability of <strong>Visual Studio 2015 RTM</strong> came the free <a title="https://blogs.msdn.com/b/visualstudioalm/archive/2015/07/20/visual-studio-emulator-for-android-in-vs2015-rtm.aspx" href="https://blogs.msdn.com/b/visualstudioalm/archive/2015/07/20/visual-studio-emulator-for-android-in-vs2015-rtm.aspx" target="_blank">Visual Studio Emulator for Android</a>. Let’s see how to <strong>test your WebGL experiences</strong> on these <strong>very fast Android emulators</strong>.</p>  <p>As a reminder, I’ve already explained you <a title="https://blogs.msdn.com/b/davrous/archive/2014/07/21/how-to-remotely-debug-and-profile-the-performance-of-your-html5-websites-amp-apps-on-windows-phone.aspx" href="https://blogs.msdn.com/b/davrous/archive/2014/07/21/how-to-remotely-debug-and-profile-the-performance-of-your-html5-websites-amp-apps-on-windows-phone.aspx" target="_blank">how to remotely debug and profile the performance of your HTML5 websites &amp; apps on Windows Phone</a> Next week, you’ll be able to use the same approach <strong>to debug Windows Mobile 10 and Mobile Edge</strong> with the release of the Win10 SDK Tools.</p>  <p>First, <a href="https://www.visualstudio.com/downloads/download-visual-studio-vs?CR_CC=200657563" target="_blank">download Visual Studio 2015 RTM</a> (such as the <strong>free community edition</strong>) or <a href="https://aka.ms/vsemu" target="_blank">install the Android emulators directly</a> without Visual Studio. Then please read this first introduction documentation: <a title="https://blogs.msdn.com/b/visualstudioalm/archive/2014/11/12/introducing-visual-studio-s-emulator-for-android.aspx" href="https://blogs.msdn.com/b/visualstudioalm/archive/2014/11/12/introducing-visual-studio-s-emulator-for-android.aspx" target="_blank">Introducing Visual Studio’s Emulator for Android</a> which explains how this cool emulator works and what are the features supported. </p>  <h2>WebGL testing</h2>  <p>Once installed, you can <strong>launch the tool</strong>:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5050.image_3D1CAD4C.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4401.image_thumb_4D2B7C03.png" width="402" height="157" /></a></p>  <p>And <strong>choose the image</strong> you’re interested in:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8547.image_4EEA5270.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2627.image_thumb_309F9B7A.png" width="510" height="480" /></a></p>  <p>Let’s choose “<strong>5’’ Lollipop (5.0) XXHDPI Phone</strong> – Similar to Samsung Galaxy S4” and press play. If it’s the first time you’re launching the emulator, it will configure the Hyper-V network settings for you. </p>  <p>Once started, launch the default installed browser and try for instance to navigate on <a href="https://www.babylonjs.com">https://www.babylonjs.com</a>, the best available WebGL framework to date <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Clignement d&#039;œil" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0181.wlEmoticon-winkingsmile_42EAF2ED.png" />. If you try to launch one of our scenes, you’ll see that error raised:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8055.image_4287E706.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1145.image_thumb_13C4BF15.png" width="600" height="319" /></a></p>  <p>Indeed, <strong>the default browser shipped with this Lollipop image doesn’t support WebGL</strong>. We need to <strong>install Chrome</strong> on it.</p>  <p>Search for a <strong>x86 version of the Chrome APK</strong> such as this one: <a title="https://www.apkmirror.com/apk/google-inc/chrome/chrome-43-0-2357-93-x86-android-apk-download/" href="https://www.apkmirror.com/apk/google-inc/chrome/chrome-43-0-2357-93-x86-android-apk-download/">Chrome 43.0.2357.93 (x86)</a> and <strong>drag’n’drop the APK</strong> directly into the emulator. It should install it:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7357.image_6C8D0690.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4743.image_thumb_20C12FD7.png" width="352" height="180" /></a></p>  <p>But if you’re navigating again to the same URL with Chrome, you will still have the same error. This time, this is because <strong>Chrome hasn’t enabled WebGL as the emulator is not part of his whitelist</strong>. To force it, navigate to “<strong>about:flags</strong>” and enable this option: “<strong>Override software rendering list</strong>”</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6763.image_4C788CB2.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6708.image_thumb_76E74E80.png" width="600" height="304" /></a></p>  <p>You should now be able to launch one of our scenes such our famous <strong>Espilit</strong> scene: <a href="https://www.babylonjs.com/index.html?ESPILIT">https://www.babylonjs.com/index.html?ESPILIT</a> </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6746.image_0D3CF3C6.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7610.image_thumb_2BAC5611.png" width="600" height="303" /></a></p>  <p><strong>25 fps</strong> on my first gen Lenovo X1 using a simple <strong>HD4000</strong> <strong>GPU </strong>on Windows 10! Not that bad for an emulator! Obviously, you still need a real device to benchmark performances of your WebGL code. </p>  <p>Even better, as <strong>the emulator is perfectly supporting touch</strong>, you can also test &amp; debug multi-touch inside your WebGL experiences. For instance, switch the camera to “<strong>Virtual joysticks camera</strong>”:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1373.image_6B0C9A52.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4452.image_thumb_561DA890.png" width="300" height="404" /></a></p>  <p>You can now move into the 3D scene using 2 of your fingers if by simply touching your PC screen:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0044.image_0C8E5A93.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7271.image_thumb_1B5B211C.png" width="600" height="290" /></a></p>  <p><strong><u>Note:</u></strong> for that, we’re using <a href="https://blogs.msdn.com/b/davrous/archive/2013/10/21/handling-touch-in-your-html5-apps-thanks-to-the-pointer-events-of-ie10-and-windows-8.aspx" target="_blank">Pointer Events</a> and our <a href="https://github.com/Deltakosh/handjs" target="_blank">HandJS polyfill</a> to propagate those events to <a href="https://www.w3.org/TR/touch-events/" target="_blank">Touch Events</a> as Chrome is not supporting Pointer Events yet.</p>  <p><strong>On Windows Phone/Mobile, WebGL is enabled by default in IE11 and Edge.</strong> So simply launch the Windows Phone emulator and navigate to your WebGL content. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1715.image_1AF17ED8.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3240.image_thumb_0E19B96B.png" width="600" height="304" /></a></p>  <p><strong><u>Note:</u></strong> Even <strong>Web Audio is supported by Chrome inside the Visual Studio emulator!</strong>. For instance, this demo works in it: <a title="https://www.babylonjs-playground.com/index.html?22" href="https://www.babylonjs-playground.com/index.html?22">https://www.babylonjs-playground.com/index.html?22</a></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/6708.image_205C8BE0.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/4201.image_thumb_74AE5294.png" width="600" height="300" /></a></p>  <h2>Going further with Vorlon.js</h2>  <p>We’ve made <strong>Vorlon.js </strong>initially to <strong>simplify the life of mobile web developers</strong>. If you haven’t heard of it yet, feel free to have a look to the video on our website: <a href="https://www.vorlonjs.io">https://www.vorlonjs.io</a> and check this article: <a title="https://blogs.msdn.com/b/eternalcoding/archive/2015/04/30/why-we-made-vorlon-js-and-how-to-use-it-to-debug-your-javascript-remotely.aspx" href="https://blogs.msdn.com/b/eternalcoding/archive/2015/04/30/why-we-made-vorlon-js-and-how-to-use-it-to-debug-your-javascript-remotely.aspx" target="_blank">Why we made vorlon.js and how to use it to debug your JavaScript remotely</a></p>  <p>Let’s first review how to <strong>debug your layer on Android &amp; Windows Phone emulators</strong>. For instance, I’m currently playing with <strong>Flexbox</strong> during my spare time to improve the Babylon.js website. Thanks to the <strong>Modernizr plug-in</strong>,<strong> y</strong>ou can see that Flexbox is supported by the emulator and you can even review the layout size via the <strong>DOM Explorer</strong>:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/7411.androidvorlonjs_5B4C43A7.png"><img title="androidvorlonjs" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="androidvorlonjs" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3678.androidvorlonjs_thumb_3A5B61B1.png" width="950" height="368" /></a></p>  <p>For instance, you see in the Android emulator (on the left) the <strong>“Mansion” flexbox item</strong> highlighted, its size is currently “<em>172px x 112px</em>”.</p>  <p>Let’s review the same site on the <strong>Windows Phone emulator</strong> (on the right):</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1411.windowsphonevorlonjs_79BBA5F2.png"><img title="windowsphonevorlonjs" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="windowsphonevorlonjs" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/5008.windowsphonevorlonjs_thumb_11E1A0FF.png" width="950" height="369" /></a></p>  <p>Of course, Flexbox is also supported by IE11 Mobile and this time, the same flexbox item is currently “<em>140px x 91px</em>”. </p>  <p>Another interesting feature is the <strong>interactive console</strong>. Sometime,<strong> using WebGL, it’s hard to know why your code failed on a mobile device</strong>. This is often because the mobile’s GPU is not supporting a specific feature or because a shader doesn’t compile. This is for instance the case of our “<strong>Depth of field / end</strong>” demo. The shader is too complex for Windows Phone and you can simply verify it with our tool:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1321.windowsphoneshader_7F2F37F8.png"><img title="windowsphoneshader" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="windowsphoneshader" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2678.windowsphoneshader_thumb_5C01CD46.png" width="950" height="534" /></a></p>  <p>We’ve got plenty other plugins that could help you and we’re currently working in adding new one to even go further. And who knows, we will maybe have one for babylon.js in a near future. <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Clignement d&#039;œil" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/0181.wlEmoticon-winkingsmile_42EAF2ED.png" /></p>  <p>David</p>]]></content:encoded>
    </item>
    <item>
      <title>JavaScript Open Day: vidéos &amp; contenus</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/javascript-open-day-vidos-contenus</link>
      <pubDate>Fri, 03 Apr 2015 03:07:00 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2015/04/03/javascript-open-day-vidos-contenus/</guid>
      <description><![CDATA[Le 19 mars dernier, nous avons accueilli dans les locaux de Microsoft France la 1ère édition du...]]></description>
      <content:encoded><![CDATA[<p>Le 19 mars dernier, nous avons accueilli dans les locaux de Microsoft France la 1ère édition du <a href="https://www.meetup.com/Javascript-Open-Day/events/220087351/" target="_blank">Meetup JavaScript Open Day</a>. Vous nous avez fait de nombreux retours positifs sur les réseaux sociaux et en direct, il n’est donc pas impossible qu’une 2ème édition soit programmée. ;)</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/8831.image_455AA5C9.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/2844.image_thumb_56463A25.png" width="240" height="127" /></a> </p>  <p>En attendant, je vous propose de vivre ou revivre cet évènement à travers les différentes vidéos et contenus partagés par les speakers. Voici le programme que nous vous avions concocté:</p>  <p>- Les nouveautés apportées par le nouveau moteur du projet <strong>Spartan</strong>     <br />- <strong>Polymer</strong> en prod : On a osé !     <br />- Retour d’expérience d’une migration <strong>Web to App</strong> basée sur Angular.js     <br />- <strong>Je viens du futur</strong> et voici comment on code en <strong>JavaScript</strong>     <br />- Création d’<strong>applications mobiles JS avec Cordova</strong> et les applications universelles Windows     <br />- <strong>WebRTC</strong> made simple     <br />- Expérimentation <strong>fun à base de Babylon.JS, Minecraft</strong> et Web Audio     <br />- Les <strong>performances de rendu sur mobile</strong> : astuces et stratégie&#160; <br />- Conception d’<strong>apps cross-plateformes WinJS/Cordova</strong> </p>  <p>C’est parti!</p>  <h2>Les nouveautés apportées par le nouveau moteur du projet Spartan</h2>  <p>Animé par <a href="https://twitter.com/meulta" target="_blank">Etienne Margraff</a> et <a href="https://twitter.com/davrous" target="_blank">moi-même</a>, nous vous avons fait découvrir pas mal des nouveautés apportées par notre nouveau moteur du projet Spartan. Au programme : <strong>WebGL</strong>, <strong>Web Audio</strong>, http/2, beaucoup d’<strong>ECMAScript 6</strong> et un peu de F12.</p> <iframe height="315" src="https://www.youtube.com/embed/-12yDvThcBA?start=200" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />Les slides:</p> <iframe height="355" src="https://www.slideshare.net/slideshow/embed_code/46162373" frameborder="0" width="425" allowfullscreen="allowfullscreen"> </iframe>  <div style="margin-bottom: 5px"><strong><a title="Nouveautés JavaScript dans le monde Microsoft" href="https://blogs.msdn.com//fr.slideshare.net/davrous/nouveauts-javascript-dans-le-monde-microsoft" target="_blank">Nouveautés JavaScript dans le monde Microsoft</a> </strong>from <strong><a href="https://blogs.msdn.com//www.slideshare.net/davrous" target="_blank">davrous</a></strong> </div>  <p>A noter que depuis la build de Windows 10, 10049, vous pouvez tester <strong>l’interface du Project Spartan</strong>: <a href="https://blogs.msdn.com/b/ie/archive/2015/03/30/quot-project-spartan-quot-in-the-windows-technical-preview-build-10049.aspx" target="_blank">&quot;Project Spartan&quot; in the Windows Technical Preview build 10049</a> et que depuis notre conférence, nous avons annoncé le support de <strong>simd.js</strong> en plus d’<strong>asm.js</strong>. </p>  <p>Vous pouvez tester la démo Babylon.js Web Audio du manoir ici: <a href="https://www.babylonjs.com/index.html?MANSION">https://www.babylonjs.com/index.html?MANSION</a> </p>  <h2>Polymer en prod : On a osé ! </h2>  <p>Animé par <a href="https://twitter.com/sylvainw" target="_blank">Sylvain Weber</a>, co-founder / CEO at Kontest et <a href="https://twitter.com/TinOo512" target="_blank">Etienne de Dieuleveult</a>, full-stack web developer at Kontest. Un retour d’expérience très intéressant!</p> <iframe height="315" src="https://www.youtube.com/embed/nGDtqMNPn1Y" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />Les slides:</p> <iframe height="355" src="https://www.slideshare.net/slideshow/embed_code/44048860" frameborder="0" width="425" allowfullscreen="allowfullscreen"> </iframe>  <div style="margin-bottom: 5px"><strong><a title="Polymer en production : On a osé !" href="https://blogs.msdn.com//fr.slideshare.net/Kontest/polymer-en-production-on-a-os" target="_blank">Polymer en production : On a osé !</a> </strong>from <strong><a href="https://www.slideshare.net/Kontest" target="_blank">Kontest</a></strong> </div>  <p></p>  <p></p>  <h2>Retour d’expérience d’une migration Web to App basée sur Angular.js</h2>  <p>Animé par <a href="https://blogs.infinitesquare.com/b/seb">Sébastien Ollivier</a> d’Infinite Square. Une très chouette application démontrée.</p> <iframe height="315" src="https://www.youtube.com/embed/Rfy5LAXEyrg" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />Les slides:</p> <iframe height="355" src="https://www.slideshare.net/slideshow/embed_code/46034413" frameborder="0" width="425" allowfullscreen="allowfullscreen"> </iframe>  <div style="margin-bottom: 5px"><strong><a title="JavaScript Open Day - Migration Web To App" href="https://fr.slideshare.net/sebastieno/javascript-open-day-migration-web-to-app" target="_blank">JavaScript Open Day - Migration Web To App</a> </strong>from <strong><a href="https://blogs.msdn.com//www.slideshare.net/sebastieno" target="_blank">Sébastien Ollivier</a></strong> </div>  <h2>Je viens du futur et voici comment on code en JavaScript</h2>  <p>Animé par <a href="https://twitter.com/g_marty">Guillaume Marty</a> de chez <strong>Mozilla</strong>. Une belle session où certaines fonctionnalités d’<strong>ES6</strong> sont expliquées très clairement.</p> <iframe height="315" src="https://www.youtube.com/embed/6hrM7ePXyxs" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />Les slides:</p>  <p><a href="https://t.co/5nhuiWnuXp"></a><a title="https://gmarty.github.io/2015-03-JavaScript-Open-Day-1/" href="https://gmarty.github.io/2015-03-JavaScript-Open-Day-1/">https://gmarty.github.io/2015-03-JavaScript-Open-Day-1/</a></p>  <p>Cliquez sur ES5 en haut à droite pour faire les différences entre ES5 et ES6. </p>  <h2>Création d’applications mobiles JS avec Cordova et les applications universelles Windows</h2>  <p>Animé par <a href="https://twitter.com/meulta" target="_blank">Etienne Margraff</a> et <a href="https://twitter.com/davrous" target="_blank">moi-même</a>. Nous vous avons montré comment le nouvel outillage de <strong>Visual Studio 2015</strong> simplifiait la création d’application HTML5 <strong>Cordova</strong> pour <strong>Windows Phone</strong>, <strong>Android</strong> et <strong>iOS</strong> ainsi que leur débogage! </p> <iframe height="315" src="https://www.youtube.com/embed/vKl5YFYMo8Q" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />Resource associée:</p>  <p>Mieux que des slides, un article d’Etienne sur le sujet: <a title="https://blogs.msdn.com/b/emargraff/archive/2014/11/18/7-raisons-pour-lesquelles-visual-studio-2015-est-le-meilleurs-outil-pour-d-233-velopper-une-application-cordova.aspx" href="https://blogs.msdn.com/b/emargraff/archive/2014/11/18/7-raisons-pour-lesquelles-visual-studio-2015-est-le-meilleurs-outil-pour-d-233-velopper-une-application-cordova.aspx" target="_blank">7 raisons pour lesquelles Visual Studio 2015 est le meilleur outil pour développer une application Cordova</a></p>  <h2>WebRTC made simple</h2>  <p>Animé par <a href="https://twitter.com/freelancis">Gaspard Beernaert</a> que nous avons eu la chance d’avoir via la communauté <a href="https://parisjs.org/" target="_blank">ParisJS</a>. </p> <iframe height="315" src="https://www.youtube.com/embed/dOaVAXIDP_E" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />Les slides:</p>  <p><a title="https://tag.freelancis.net/2015/webrtconf/" href="https://tag.freelancis.net/2015/webrtconf/">https://tag.freelancis.net/2015/webrtconf/</a></p>  <h2>Expérimentation fun à base de Babylon.JS, Minecraft et Web Audio </h2>  <p>Animé par <a href="https://twitter.com/meulta" target="_blank">Etienne Margraff</a> et <a href="https://twitter.com/davrous" target="_blank">moi-même</a>. La petite pause rigolote de l’après-midi avec du <strong>WebGL</strong> modélisant un décor de type <strong>Minecraft</strong>, du <strong>Web Audio</strong> animant le tout et vos <strong>tweets</strong> affichés en live dans la scène 3D.</p> <iframe height="315" src="https://www.youtube.com/embed/tbohromV7ww" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />Resource associée:</p>  <p>Toujours mieux: une partie du code utilisé dans cette démo a récemment été publié par Etienne ici: <a title="https://github.com/BabylonJS/Samples/tree/master/Scenes/BoxMonger" href="https://github.com/BabylonJS/Samples/tree/master/Scenes/BoxMonger">https://github.com/BabylonJS/Samples/tree/master/Scenes/BoxMonger</a></p>  <h2>Les performances de rendu sur mobile : astuces et stratégie</h2>  <p>Excellente session animée par <a href="https://twitter.com/theystolemynick">Jean-Pierre Vincent</a>. A vraiment regarder si vous ne comprenez pas où vous pouvez perdre de la perf dans le navigateur.</p> <iframe width="560" height="315" src="https://www.youtube.com/embed/IoBHg66bOME" frameborder="0" allowfullscreen></iframe>  <p>   <br />Les slides:</p> <iframe height="221" src="https://onedrive.live.com/embed?cid=0EE4BD0F5EA745C6&amp;resid=EE4BD0F5EA745C6%21485377&amp;authkey=&amp;em=2&amp;wdAr=1.7777777777777776" frameborder="0" width="350">Ceci est un document <a target="_blank" href="https://office.com">Microsoft Office</a> incorporé, fourni par <a target="_blank" href="https://office.com/webapps">Office Online</a>.</iframe>  <br />  <br />  <h2>Conception d’apps cross-plateformes WinJS/Cordova</h2>  <p>Animé par l’excellent Guillaume Leborgne de MCNext. Cette session se trouve être la parfaite synthèse entre la session de Jean-Pierre sur la performance et celles autour de Cordova. Une très belle application WinJS démontrée et à découvrir. </p> <iframe height="315" src="https://www.youtube.com/embed/0AGId_hRVJk" frameborder="0" width="560" allowfullscreen="allowfullscreen"></iframe>  <p>   <br />Guillaume était aussi venu lancer officiellement une nouvelle communauté française dédiée à JavaScript: frogs.js</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/1007.frogsjs_02_7FA2896E.png"><img title="frogs-js_02" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;border-top-width: 0px" border="0" alt="frogs-js_02" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/10/46/metablogapi/3162.frogsjs_02_thumb_2EF3FEF9.png" width="199" height="83" /></a> </p>  <p>Vous pouvez la rejoindre via ce groupe Facebook: <a title="https://www.facebook.com/groups/frogsjs/" href="https://www.facebook.com/groups/frogsjs/">https://www.facebook.com/groups/frogsjs/</a></p>  <p>Merci à tous pour votre participation!</p>  <p>David &amp; Etienne</p>]]></content:encoded>
    </item>
    <item>
      <title>Liste des sessions Techdays 2015 accessibles aux sourds et malentendants</title>
      <link>https://docs.microsoft.com/archive/blogs/davrous/liste-des-sessions-techdays-2015-accessibles-aux-sourds-et-malentendants</link>
      <pubDate>Tue, 03 Feb 2015 06:45:04 GMT</pubDate>
      <dc:creator><![CDATA[David Rousset]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/davrous/2015/02/03/liste-des-sessions-techdays-2015-accessibles-aux-sourds-et-malentendants/</guid>
      <description><![CDATA[Cette ann&eacute;e, je ne suis pas peu fier d&rsquo;avoir r&eacute;ussir &agrave; aider &agrave; la...]]></description>
      <content:encoded><![CDATA[Cette ann&eacute;e, je ne suis pas peu fier d&rsquo;avoir r&eacute;ussir &agrave; aider &agrave; la mise en place de la v&eacute;lotypie. Je remercie l&rsquo;&eacute;quipe organisatrice des Techdays d&rsquo;avoir jou&eacute; le jeu.

Bon, par contre, comme c&rsquo;est la 1&egrave;re fois que l&rsquo;on tente l&rsquo;aventure, nous ne sommes pas bien cal&eacute;s et long &agrave; la d&eacute;tente. 

Nous avons d&eacute;cid&eacute; de mettre en place la v&eacute;lotypie pour les 3 pl&eacute;ni&egrave;res dans l&rsquo;amphi principal de 4000 personnes ainsi que pour les sessions phares jou&eacute;es dans l&rsquo;amphi bleu de 800 places diffus&eacute; sur la Techdays TV. Comme ce sont 2 tr&egrave;s grandes salles, attention &agrave; bien venir en avance pour &eacute;viter la cohue. La v&eacute;lotypie sera retranscrite sur un &eacute;cran qui sera sur sc&egrave;ne et des places seront r&eacute;serv&eacute;es aux personnes sourdes et malentendantes au 1er rang. Si vous &ecirc;tes dans ce cas, merci de vous signaler aux h&ocirc;tesses pour qu&rsquo;elles puissent vous placer.

Voici la liste des sessions b&eacute;n&eacute;ficiant de ce nouveau m&eacute;canisme:

<table cellspacing="0" cellpadding="0" border="0"><tbody>     <tr>       <td valign="bottom" width="64">         <b>Code</b></p>       </td>        <td valign="bottom" width="736">         <p><b>Nom</b></p>       </td>        <td valign="bottom" width="145">         <p><b>Date </b></p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>KEY201</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=08273927-e7e6-4004-a492-79d16f219158" target="_blank">new Keynote() { cloudFirst=true, mobileFirst=true }.Connect();</a></p>       </td>        <td valign="bottom" width="145">         <p>10/02/2015 09:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>PFX202</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=b1afe546-5207-4274-8008-522f7f8165f9" target="_blank">Keynote .NET 2015 : une nouvelle &egrave;re</a></p>       </td>        <td valign="bottom" width="145">         <p>10/02/2015 11:00</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>APP205</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=17d0b510-16f0-4a79-8c4f-0ddc1a4b87c2" target="_blank">Keynote d&eacute;veloppement mobile : les solutions pour Windows (Phone), Android et iOS</a></p>       </td>        <td valign="bottom" width="145">         <p>10/02/2015 12:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>DEB102</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=be09a728-2643-40bc-9852-49776b18d31b" target="_blank">Demain, tous des Dev rock Stars ?</a></p>       </td>        <td valign="bottom" width="145">         <p>10/02/2015 14:00</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>PFX204</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=e7fe634e-7bc7-4419-a2c8-5a40d72562aa" target="_blank">Keynote Opensource</a></p>       </td>        <td valign="bottom" width="145">         <p>10/02/2015 15:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>DES201</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=0d643a86-e34c-4bb7-bd16-8a6fdb2f3c39" target="_blank">Savoir c&rsquo;est pr&eacute;voir. Le futur technologique des interfaces des 10 prochaines ann&eacute;es</a></p>       </td>        <td valign="bottom" width="145">         <p>10/02/2015 16:30</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>PFX211</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=6b2a4b61-2f29-49cb-b428-72e3956501a7" target="_blank">Coding4Fun</a></p>       </td>        <td valign="bottom" width="145">         <p>10/02/2015 17:45</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>KEY202</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=9eeaf6d2-9c92-45b9-8dfd-12b4764ae95c" target="_blank">Cloud &amp; mobile, venez comme vous &ecirc;tes !</a></p>       </td>        <td valign="bottom" width="145">         <p>11/02/2015 09:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>PFX105</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=079baa4e-13f8-4917-bdec-c71c1056f560" target="_blank">Keynote Azure</a></p>       </td>        <td valign="bottom" width="145">         <p>11/02/2015 11:00</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>DM119</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=4f9cd3d1-4d4f-47fa-8ff0-b71116e10ab2" target="_blank">S&eacute;curit&eacute;, cloud et donn&eacute;es priv&eacute;es : quels vrais risques, quelles vraies solutions ?</a></p>       </td>        <td valign="bottom" width="145">         <p>11/02/2015 12:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>APP103</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=e39796c7-a419-43e8-b18a-6a9ebc06a617" target="_blank">Makers+IoT : une nouvelle r&eacute;volution industrielle ?</a> </p>       </td>        <td valign="bottom" width="145">         <p>11/02/2015 14:00</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>MOB104</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=e47e27fa-35ab-49c5-93e9-bcbbc079b572" target="_blank">Quoi de neuf dans Windows 10 ?</a> </p>       </td>        <td valign="bottom" width="145">         <p>11/02/2015 15:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>INF203</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=1eb64980-fa2d-42ec-8cbc-544d2aa19cdc" target="_blank">Windows Server vNext- virtualisation et stockage</a></p>       </td>        <td valign="bottom" width="145">         <p>11/02/2015 16:30</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>INF215</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=74426b9c-3037-4d4c-b8ee-a79e510ffee9" target="_blank">Geek is in da {new} House</a></p>       </td>        <td valign="bottom" width="145">         <p>11/02/2015 17:45</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>KEY101</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=1f45b3f1-07b6-49fb-bf9d-da7fa31d5841" target="_blank">Vers une technologie invisible et une intelligence omnipr&eacute;sente ?</a></p>       </td>        <td valign="bottom" width="145">         <p>12/02/2015 09:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>DM113</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=46a8aa8c-87a0-4b56-8188-7dac3547c7a4" target="_blank">Se r&eacute;inventer &agrave; l'heure du num&eacute;rique</a></p>       </td>        <td valign="bottom" width="145">         <p>12/02/2015 11:00</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>DM122</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=b490f54b-03dd-4a93-aaf4-320e1710365f" target="_blank">La DSI doit-elle se transformer en startup ?</a></p>       </td>        <td valign="bottom" width="145">         <p>12/02/2015 12:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>DM127</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=adca1fba-a39e-4a29-8c24-c34d1639da22" target="_blank">Architecture et futur de la ville : impacts de la transformation num&eacute;rique ?</a></p>       </td>        <td valign="bottom" width="145">         <p>12/02/2015 14:00</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>DM104</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=a335d85d-721b-43b6-a3ee-a15018a79500" target="_blank">Quelle organisation pour demain ? Vers une organisation plus connect&eacute;e et moins pyramidale</a></p>       </td>        <td valign="bottom" width="145">         <p>12/02/2015 15:15</p>       </td>     </tr>      <tr>       <td valign="bottom" width="64">         <p>DEB101</p>       </td>        <td valign="bottom" width="736">         <p><a href="https://techdays.microsoft.fr/programmes/2015/fiche-session.aspx?ID=043153ad-e815-4753-9f05-be4dd48952af" target="_blank">Big Data et vie priv&eacute;e, mariage pour tous ?</a></p>       </td>        <td valign="bottom" width="145">         <p>12/02/2015 16:30</p>       </td>     </tr>   </tbody></table>

<p>Rappelons &eacute;galement que l&rsquo;accessibilit&eacute; est b&eacute;n&eacute;fique pour tous. Un probl&egrave;me de concentration, un moment d&rsquo;inattention, vous pourrez &eacute;galement profiter de la v&eacute;lotypie pour mieux suivre l&rsquo;&eacute;v&egrave;nement.

<p>David</p>]]></content:encoded>
    </item>
  </channel>
</rss>