HTML5 <audio> tag on Android HTML5 <audio> tag on Android google-chrome google-chrome

HTML5 <audio> tag on Android


What you dug up agrees with what I've run into as well. 2.2 supports the audio tag but has no codecs to back it, this is apparently a bug that's been fixed in releases beyond Froyo:

http://code.google.com/p/android/issues/detail?id=9372

I've used the audio tag with an mp3 file on my Nexus S, it's working correctly there (for the most recent firmware release at least).


I forgot to ask first. Are you thinking on developing an Android application or just a regular web-app? Cause for this solution you would need Android code.

If you're not considering using Android code, then you can skip the rest of the message, sorry!

==================================================================================

Here it's some trick: You can use regular links to your audio files, or use javascript to redirect to one of the files (if you let Javascript do it), then override the Url loading, like this:

mWebView.getSettings().setJavaScriptEnabled(true);mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);mWebView.setWebViewClient(new WebViewClient(){    @Override    public boolean shouldOverrideUrlLoading(WebView view, String url) {        if (url.endsWith(".ogg")){            Log.d(TAG, "Reproducir archivo OGG");            Uri tempPath = Uri.parse(url);            MediaPlayer player = MediaPlayer.create(WebViewVideo.this, tempPath);            player.start();            return true;        }else{            return super.shouldOverrideUrlLoading(view, url);        }    }});

Hope this helps, it does for me!

Regards.