Playing audio with HTML5 in Android browser
Solution 1
I found the solution here Embed Background Audio in Android >= 2.3 Browser
<audio id="audio1" controls="controls" loop="loop" autoplay="autoplay" >
<source src="scene1.mp3" type="audio/mpeg" />
<source src="scene1.ogg" type="audio/ogg" />
</audio>
it's work for me :)
Solution 2
I did a quick search and found this issue report on google code. It seems the tag is unsupported. However, the tag is and can play mp3 files. The down side is (if I read it correctly) that the controls are not available. Give it a read and let us know how you make out.
I found another question that has lots of different possible solutions: Check it out
Saad Lamarti
Updated on June 12, 2022Comments
-
Saad Lamarti almost 2 years
I want to play audio in the Android browser, using the html5
<audio>
tag. It works fine in the iPhone browser, but not in Android. I'm using Android Virtual Device 4.0.3.Does anyone know why?
The Android source:
webView.loadUrl("file:///android_asset/www/test.html");
The HTML file:
<audio controls="controls" format="mp3"> <source src="achievement.mp3" /> </audio>
(i couldn't hear the audio with
<embed>
and<object>
tags either)