Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 audio tag is not working in Android

I have created a sample phone gap application for android ics . And the index.html has an audio tag like this.

<audio id="player1" controls preload><source src="media/track1.mp3" type="audio/mp3" /></audio>

I am not able to play the audio at all. I saw the stack overflow posts everywhere it's mentioned that the audio tag will work fine after froyo release. But, i am testing it in gingerbeard and in ICS and it's not working anywwhere.

like image 975
karthick Avatar asked Aug 27 '12 12:08

karthick


People also ask

Can I play audio in HTML5?

HTML5 features include native audio and video support without the need for Flash. The HTML5 <audio> and <video> tags make it simple to add media to a website. You need to set src attribute to identify the media source and include a controls attribute so the user can play and pause the media.

How do I embed audio in HTML5?

To embed audio in HTML, we use the <audio> tag. Before HTML5, audio cannot be added to web pages in the Internet Explorer era. To play audio, we used web plugins like Flash. After the release of HTML5, it is possible.


1 Answers

HTML5 Audio support is not consistent across different devices/OSes due to codec licensing issues and OS implementation/support. If you are just playing MP3 files, you can reliably handle those by using PhoneGap's Media class, which will provide consistent and reliable audio programming on all platforms.

If you want the ability to preload audio and have more advanced scenarios like polyphony or layering (like video game effects), you can use the LowLatencyAudio PhoneGap native plugin.

like image 108
Andrew Trice Avatar answered Oct 03 '22 07:10

Andrew Trice