Thao LÊ
Thao LÊ

Reputation: 11

mediaelement.js audio not working with IE9 and wav files

I don't find solutions in other threads/discussions.

I'm facing a problem while playing wav files with mediaelement.js in IE9. The player appears completely black without any control button.

I tried the normal way unsuccessfully

<audio id="player2" src="myFile.wav" type="audio/wav" controls="controls"></audio>

I tried HTML5shiv unsuccessfully

<!--[if IE]>
   <script src="html5shiv.js"></script>
<![endif]-->

I tried to force flash fallback unsuccessfully.

<audio id="player2" 
       controls="controls">
  <source src="myFile.wav" type="audio/wav" />
  <!-- Flash Fallback -->
  <object width="640" height="360" type="application/x-shockwave-flash" data="flashmediaelement.swf">
      <param name="audio" value="videos/build/flashmediaelement.swf" />
      <param id="flashvars-param" name="flashvars"    value="controls=falseg&file=myFile.wav" />
  </object>        
</audio>

Plus mode: 'shim' in the javascript.

This works fine in FF and Google Chrome.

Upvotes: 1

Views: 1920

Answers (1)

GamerDev
GamerDev

Reputation: 2016

It doesn't looks like IE9 will play .WMA or .WAV files using the audio tag in HTML5. I found this on Garret Wilson's blog.

IE9 HTML5 Doesn't Support WAV Files

HTML5 is turning out to be useful. Well, in theory. If it worked. See, HTML5 comes with all sorts of capabilities, like an element that plays sound. And this time around, the browsers are setting aside their instincts to be proprietary and, in the spirit of interoperability, they are implementing the same API! Microsoft even loves the element! So now can we write pages that work the same across browsers? Of course not! While they support the same API, the browsers decided they would only support certain audio codecs—meaning that there is no one audio format that will work on all browsers. As usual, Microsoft's actions here can only be considered malicious and in the spirit of preventing interoperability, not encouraging it.

Let's take MP3 as an example. IE9 supports it. Yay. What about Firefox 9? No. Mozilla claims this is because of patent risks. Well, OK, if you say so. So what does Firefox support instead? Ogg. That's an open audio standard supposedly unencumbered by patent restrictions.

So whether or not Microsoft buys Mozilla's story about MP3, in the spirit of interoperability, why doesn't IE go ahead and implement Ogg just so there will be some audio format that works on both browsers? You tell me. Maybe Microsoft would say, "MP3 is ubiquitous—why should we cater to Mozilla's issues?" That's a cop-out, but I'll let it slide. There are more devious problems afoot.

Let's skip lossy formats altogether and look at LPCM-encoded WAV files. Sure, they are bigger, but let's say I don't care and I simply want something to work across browsers. Who supports it? Firefox 4? Yes. Chrome 4? Yes. Safari 5? Yes. Opera 10.6? Yes. IE9? No!!!!

If IE9 supported WAV, then there would be at least one audio format that was supported across all the major modern browsers.

Guess who created the WAV format to begin with? Microsoft. Why don't they support it? Maybe you should start looking for the answer in the paragraph above this one.

Upvotes: 1

Related Questions