title: IE8 HTMLMediaElement play() shim
body: <p>The following code plays sound in IE9+ (and in Firefox and Chrome as well). Is there a library that implements/polyfills missing features (<code>audio</code> element and <code>play()</code> method) for IE8?</p>
  
  <p>I couldn't make <code>mediaelement.js</code> working, and using jQuery or putting <code>&lt;object&gt;</code> inside <code>&lt;audio&gt;</code> seems ugly. Some global initialization (like <code>shim.init(somepath)</code>) to let the shim find its flash files is fine, but per-tag code looks wrong to me as it should be possible to automate.</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript"&gt;
          function foo()
          {
              var audio = document.getElementById('foo')
              audio.play()    
          }
  
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;audio id="foo" preload="none"&gt;
          &lt;source src="foo.mp3" type="audio/mpeg"&gt;
          &lt;source src="foo.ogg" type="audio/ogg"&gt;
          Your browser does not support the audio element.
      &lt;/audio&gt;
      &lt;button onclick="foo()"&gt;Play&lt;/button&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>