Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
569 views
in Technique[技术] by (71.8m points)

cordova - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...