Audio Ogg Vorbis android default browser
Asked Answered
S

2

7

I wonder what is the support of audio codecs in Android devices .

Here I found that 2.3 and 4.0 support only mp3 codec:

http://html5test.com/compare/browser/android23/android40/android22.html

Although I tested android 2.3 on Galaxy S and I found that it also plays ogg vorbis format.

The same thing with 4.x phones.

Here the test I done http://twigit.pl/trash/test_mac.html

Where I could find the reliable resource regarding mobile support of audio codecs ?

Thank you very much in advance.

Satiate answered 13/3, 2013 at 12:45 Comment(0)
T
1

This is the official list of supported media formats in Android:

http://developer.android.com/guide/appendix/media-formats.html

Table 1 shows that Vorbis decoder is supported on all Android versions.

Nevertheless, media codecs that are not guaranteed to be available on all Android platform versions and on all Android devices. I.e., some OEMs can build their own Android ROMs without support of some particular codes (Vorbis or any other).

That is called a platform fragmentation.

Touraco answered 8/8, 2013 at 21:13 Comment(8)
But does support of Vorbis Ogg files in native apps = Browser Support of this audio format ?Lunulate
In native apps you can use ligogg/libvorbis directly with Android NDK. Yes, it will work.Touraco
But I've asked if Android have native support of particular audio format, will this format be supported in default browser as well ? ~ You could have on the Operating system with build-in support of Mp3 but anyway you could build the browser that doesn't support it.Lunulate
Android NDK has built-in support of OpenSL ES starting from Android 2.3. It can play OGG and MP3 out-of-box.Touraco
I don't ask about Android NDK, I ask about the browser on Android platform.Lunulate
@bluesm: then the link in my answer is your choice.Touraco
Sergey, you are missing the point. The page you linked to has nothing to do with the Browser. It doesn't matter if the platform supports a particular format (ogg vorbis in this case) or if native apps can use it. What matters is whether or not the default Browser has been built to accept ogg files in the audio tag or not. As an example, take the 2.2 Browser. Platform support DID exist for ogg, but the browser itself didn't accept ogg files in the audio tag.Discomfortable
Even as of the 2.3 Browser, ogg files are only accepted if they are sent with the application/ogg mime type. The audio/ogg mime type may actually be the more appropriate type, but the Browser doesn't accept it (even though platform support is there.)Discomfortable
D
1

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/

Discomfortable answered 15/8, 2013 at 17:2 Comment(3)
Ogg format played successfully using Browser v2.3.7 on Android v2.3.7 (CyanogenMod-7.2.0). Phone: Droid X2.Discomfortable
What is the meaning of "application/ogg" that was reported as "Yes" ?Lunulate
I clarified this in my answer. Thanks for the question.Discomfortable

© 2022 - 2024 — McMap. All rights reserved.