5

I need to play .m4a files (recorded on iPhone) in IE(9+) and Safari (iPad, iPhone). I am facing problem with setting correct MIME Type. For playing in IE10 I need to set audio/mp4 but for Safari audio/aac.
With audio/mp4 I am getting Cannot play audio file on iPad. With audio/aac I am getting Error: Unsupported audio type or invalid file path in IE

Is there a type I can set for both?

<audio controls="controls" autoplay="autoplay">
   <source src="play.aspx?filename=sound.m4a" type="audio/mp4" />
</audio>

Notes

Using an alternative player is not a solution for me.

I serve the files thorough .aspx page so I can control HTTP headers.

From observing the page HTML 5 Audio Across All Browsers using m4a, oga, mp3 and Flash it seems that possible solution is to give type="audio/mp4" and NO conten-type header. However removing HTTP header in aspx is rather too complex for problem I am trying to solve(see Removing/Hiding/Disabling excessive HTTP response headers in Azure/IIS7 without UrlScan).

2
  • Have you tried simply placing two SOURCE elements inside the AUDIO element, each with its own type but both pointed at the same SRC?
    – EricLaw
    Aug 16, 2013 at 20:26
  • @EricLaw: Yes, and it works, but I don't like it. I am going to put it as an answer when no other solution is found.
    – IvanH
    Aug 17, 2013 at 17:29

1 Answer 1

8

Audio is still in working draft, so browser experience will vary.

Having said that, the mime type that's most prevalent is audio/x-m4a. Some sites show audio/m4a-latm as a valid mime type for m4a audio but as of this writing, even Chrome doesn't recognize that mime type.

You can try this snippet in different browsers to see if it works - I verified it in IE11, Chrome (v37) and IE9 (emulated via Dev Tools).

Audio Tag sample

I've also found (personal observation) that audio recorded on iPhone doesn't play most of the time on web. Almost all browsers say the file is invalid and if you download the recorded file, it doesn't even play in media players (e.g Windows Media Player). I suspect iOS core audio is to blame here but haven't found anything conclusive yet. Audio recorded from Android works fine though.

At this point, having a flash fallback seems like the best option (won't help on iHateFlash devices though).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.