Category Archives: HTML5

Making HTML5 AAC audio work

Web authors may be leaping to use the simple media embedding that HTML5 offers them: but there is a problem generated by the strictness of Microsoft’s Internet Explorer 9. It is particularly fussy, far more so than Google Chrome, about the mime-type of the media file.

As an example, a web page that includes this code:

<audio src="" controls="true">

won’t play on Internet Explorer 9 when the file is served by an off-the-shelf Apache server running on Red Hat or Centos. The expected audio controls are replaced by a red cross. However, IE9 has the tools to analyse the problem (and, for that matter, so does Google Chrome, though the audio played first time). By pressing F12 and selecting the Console tab, one may query the Document Object Model for the error held by the audio object:


One may need to adjust the index following ‘audio’ if the tag in question is not the first <audio> tag on the page. The error codes returned mean this:

    The fetching process for the media resource was aborted by the user.
    An error has occurred in the decoding of the media resource, after the resource was established to be usable.
    A network error has caused the user agent to stop fetching the media resource, after the resource was established to be usable
    The media resource specified by the ‘src’ parameter was not usable.
The stock Apache server on Red Hat or Centos generates error 4 on an mp4 AAC audio file, and further investigation, again entirely within Internet Explorer 9, reveals the problem to be the server not sending the mime-type header which IE9 expects. Other browsers look at the file itself, but not IE9. Again, within the F12 debugging window, one may select the ‘Network’ tab, click the ‘Start Capture’ button, and reload the page to see the mime-types actually sent by the server. If the audio file doesn’t have type ‘audio/mp4’, the server’s mime-types file needs to be reconfigured to send it.
On the server, one needs to add this line to mime-types:
audio/mp4                       mp4

then restart the Apache server

service httpd restart

This cured the problem here.

Acknowledgement for this information is gladly given to the following blog from Microsoft: