how can I use html5 <audio> tag to play aac file?

user2198903 picture user2198903 · Mar 22, 2013 · Viewed 24.6k times · Source
<audio controls>
  <source src="xxx.aac" type="audio/aac">
</audio>

I can get it to work in safari but doesn't work in chrome and firefox. any solution?

Answer

Daniel Imms picture Daniel Imms · Mar 22, 2013

Only Safari and IE support .aac. Here is what each browser supports:

  • Internet Explorer 9.0+: .mp3, .aac
  • Chrome: .ogg, .mp3, .wav, .aac*
  • Firefox: .ogg, .wav
  • Safari: .mp3, .aac, .wav
  • Opera: .ogg, .wav

* Chrome seems to support .aac but it isn't included in the list of officially supported file extensions.

I suggest using both .ogg and .mp3 or .ogg and .aac to cover all bases.

References