This is a great question, bluesm
. You were absolutely right in pointing out to Sergey K
that platform support for ogg/vorbis is NOT the same as browser support. What you are looking for is support for audio and video tag support as defined by the HTML5 spec as well as implementation of decoders specific to various media formats.
According to this page http://hpr.dogphilosophy.net/test/
Android Browser: ALL versions of Android come with built-in Ogg Vorbis
audio support, but support for the HTML5 tag wasn't added
until the "Gingerbread" release (Android 2.3). For some odd reason,
Android browser reports that it doesn't support WebM Audio, but it
actually does.
However, the default browser may not officially support the ogg format, and various javascript detection strategies might report that the browser does not support it. However, I have just performed a test on that site using the default browser on my phone, which is an Android 2.3.7 device (specs below). The ogg format DID play!!
I think the link you posted for html5test.com is a typically good reference, but in this case it seems to be wrong. Of course this will depend on exactly which version of the default is installed on a ROM by ROM basis. But in my limited test, the default browser in Android 2.3 Gingerbread DOES support ogg/vorbis.
The reason that html5test reports that the browser does not support ogg is probably related to incomplete javascript detection. The HTML5 audio element supports the canPlayType
function. You can pass it a mime type to determine whether or not the browser is likely to be able to play a specific format.
var canPlayOga = audioElement.canPlayType('audio/ogg');
var canPlayAppOgg = audioElement.canPlayType('application/ogg');
In the default browser (at least the one I am using) this returns 'Yes' for application/ogg, but 'No' for audio/ogg. So even though the browser CAN play ogg files, it reports that it cannot, if only checked for audio/ogg.
To clarify this, I should point out that application/ogg is a mime type, as is audio/ogg. The browser uses this information to know what kind of format a particular file is. In the absence of this information, the browser can use the default mime type associated with a file extension. As you may know, the <source>
tag inside an <audio>
tag can include a type
attribute with the mime type of the audio format as a hint for the browser:
<audio>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
</audio>
What my test demonstrated was that the browser might not play it with the audio/ogg type assignment, but will with the application/ogg type like this:
<audio>
<source src="horse.ogg" type="application/ogg">
</audio>
Readers can try their own devices here and leave comments about which work and which do not: http://hpr.dogphilosophy.net/test/