much has been made of the ongoing fight over what will be the html5 video standard for the future. but what about audio support in html5? one might easily assume that a browser that is supposed to support html5 video, will naturally also support html5 audio, right? apparently this is not so, at least not for the android default browser.
* update, for impatient readers: i eventually verified that due to some kind of bug, the audio tag does not work in any currently available version of android, including 2.2 (froyo). the bug is reported to be solved in “post-froyo code”, which probably means android 3.0. read on for details and some info about other platforms.
in my attempt to build a webapp-version of the textopia android app, which should be available both to iphone and android users, i have come across this problem: while i can get users’ position in the same way on both platforms, i can only play sounds using the html5 audio element on iphone, not on android. trying to find out why, i set up a test page with a list of html5 audio elements with test files in different formats. testing out this page in different browsers reveals that while support varies between platforms, android stands out by simply not supporting anything at all – not even the error messages that should come up for browsers that don’t support html5 audio!
looking at desktop browsers first, w3schools.com gives the following overview over audio support:
Format | IE 8 | Firefox 3.5 | Opera 10.5 | Chrome 3.0 | Safari 3.0 |
---|---|---|---|---|---|
Ogg Vorbis | No | Yes | Yes | Yes | No |
MP3 | No | No | No | Yes | Yes |
Wav | No | Yes | Yes | No | Yes |
but what about mobile browsers? i have been searching for a while, but have not been able to find official documentation of what audio formats are supported in the different browsers. the android documentation specifies a number of audio formats supported in native apps, but these do not appear to be the same as the ones supported by the default (webkit-based) android browser. so the testpage seems to be the only way of finding out what is supported and not.
opening that page in android and iphone yielded some interesting results.
iphone: supports all the audio formats except ogg. mp3, wav, mp4, m4a, 3gp and amr all play perfectly fine.
android: supports none of the audio tags at all! for android 1.6 (tested on magic and adp1) this happens as expected – the browser displays the text between the audio tags, saying that the browser does not support html5 audio. however, on android 2.1 (tested on my htc desire) neither the text nor the audio element is displayed. why? i have no idea. it looks like the browser is trying to display the audio element, but fails somehow.
looking back at the official documentation, i am actually not able to find anywhere that states clearly that html5 audio is supported in the android browser. sure, the android 2.0 platform highlights claim the browser supports html5 video, but that doesn’t mean audio is supported, right? maybe android is just for silent movie lovers… both html5doctor and this o’reilly article claim audio is supported, but perhaps they just made the same erroneous assumption as me.
of course something could be wrong with my testpage or my test files – but the fact that they all play nicely in other browsers speak against that possibility (and the 3gp and mp4 files play fine in my native android app). which leaves us with the conclusion that unless the htc sense has anything to do with it, the audio implementation in the android browser is simply broken. very disappointing, considering google’s repeated commitment to open standards (and considering they are using the same webkit base as iphone).
for the record, i am totally open to the possibility that i may have made an error in my testing – i will be grateful for any feedback from anyone who try out the testpage in different configurations and report back their results. and i will correct and update this post to reflect that feedback. (in particular, if anyone is able to test this in mobile firefox, it would be fun to see the results! theoretically, mobile firefox should be identical to the desktop version on this, but would be nice to verify that.)
my configurations:
– iphone 3gs running iphone os 3.
– htc desire running android 2.1 (and htc sense interface).
*****
update 30 june: i filed a bug report at the android code pages. they have now responded that the issue is resolved in android 2.2 (froyo) – actually they claim that all 7 sound formats should work there, which is great if it’s true! so then all of us non-nexus owners just have to wait and see when our phones will get updated…
*****
update 7 july: finally got around to installing the android 2.2 emulator. unfortunately the test page does not work there – and another user on the android project page reports same problem on nexus one. so it looks like this issue may in fact *not* be resolved in android 2.2 after all.
*****
update 8 july: new feedback from the android project – seems this bug persists in 2.2 froyo after all. the bug is apparently fixed in whatever version comes after froyo (3.0?). so no html5 audio in android for a good while still…
*****
update 10 august: came across this nice and fairly comprehensive test page, html5test.com. opening that page in my android 2.2 browser shows that the audio element is supported, but none of the listed sound formats. incidentally, it shows the same for the video element – no support even for mpeg-4, which is supported in native apps. is there something i’m missing here, or is this completely pointless – what is the point of supporting the media elements, if no file formats are supported?
results from desktop browsers:
opera and firefox (tested both on mac os x 10.6 and windows xp): supports only the formats cited in the table above .
ie8: nothing, as cited above.
google chrome (tested on mac os x 10.6): supports aac (m4a extension) and mp4, in addition to mp3 and ogg.
safari: supports everything except ogg: mp3, wav, 3gp, aac, mp4, amr.
audio streaming:
have a look at this interesting experiment by the nrkbeta guys, testing streaming through the audio element in various browsers.
[…] This post was mentioned on Twitter by Anders Løvlie and Anders S. Løvlie, Anders Løvlie. Anders Løvlie said: browser support for html5 audio: much has been made of the ongoing fight over what will be the html5 video standar… http://bit.ly/aCZPJi […]
I’ve been working on a mobile version of a website for a podcast and have run into the same thing on my Motorola Droid running 2.1. It’s bad enough that the tag isn’t working, but it’s especially annoying that it doesn’t fall back on the text.
My nexus 1 running android 2.2 also fails to play html5 audio on every online page I have tried it on, as well as test pages I have created myself.
would be great if anyone could test this on the webkit browser of the new blackberry os 6!
guy, we are all very disapointed and frustrated with this… umh… unfeature. I guess I’ll need to transform my application into a native one which was something I wanted to avoid. If was something that had happened me with an Apple product I guess I would be shouting against them all the day…
this particular feature does work quite well in ios, so kudos to apple for that. it should be fixed in android 3, which supposedly should be out before christmas, but it will take time before that migrates out to everyone’s handsets. maybe flash could be an alternative in the meantime? don’t know if that works well or at all, just a thought…
Here is link to Google Android project, where this bug with AUDIO tag is logged. Please vote for it, so it can be fixed:
http://code.google.com/p/android/issues/detail?id=10546
I just downloaded the 2.3 sdk and tried my testpage in the emulator. All 7 sound formats worked like a dream! I haven’t been able to test that on an actual device yet, but judging by the emulator the issue appears to have been fixed.
I found your testpage today and all of the sound formats worked on the default browser and Miren Browser, too.
I’m using a custom Android 2.34 ROM on a HTC HD2.
BUT I tried some mp3 on a webpage and it didn’t work for me, I even tried the same mp3 you are using on your testpage and this one didn’t work either. The only difference I have is that I’m using https instead of http.
Is it possible for you to change your testpage to https for testing purpose?
(Yes, I know this blog post is old 😉 )
Hey,
I saw this link Anders asked the question on stackoverflow. People might find the answers interesting
http://stackoverflow.com/questions/3069124/playing-html5-audio-in-android-browser
[…] https://textopiablog.wordpress.com/2010/06/25/browser-support-for-html5-audio/ Previous post […]
ok. so what works as an web audio player, in android versions less than 2.3 w/o flash?
i am trying to embed video using html5 but only absolute path is working why relative path is not working…
see code given here…
My Video
hi
Usman
[…] https://textopiablog.wordpress.com/2010/06/25/browser-support-for-html5-audio/ […]
[…] support for the HTML5 audio element is broken in Android 2.1. Details of my testing can be found on my blog. I tested on an HTC Desire running Android 2.1 and HTC Sense, whereas Amos confirmed the same error […]
[…] https://textopiablog.wordpress.com/2010/06/25/browser-support-for-html5-audio/ […]