Play sound in HTML5 on Android

2 posts / 0 new
Last post
mclaasen
mclaasen's picture
Offline
Joined: 11 Dec 2010
Posts:
Play sound in HTML5 on Android

Hi,

I want to create an HTML5 application that plays a sound when I click on a picture.
I used the HTML5 sample of MoSync. I tested the index.htm in my IE9 on Win7 and this works ok.

The application builds the images folder in the .apk and it also runs on my Android 3.2 ASUS Transformer TF101.

But I don't hear the sounds.

Two questions:

1. I created a new subfolder below the LocalFile folder of the MoSync project for the .mp3 files that have to be played. Does the build process add the .mp3 files in the package (like the pictures which are in the \images folder)?

2. Does the Android browser support HTML5 sound tags?

Regards,

Marc Claasen

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hi Marc,

yes, the packager should include the mp3 file - check the console output when you build for confirmation.

Secondly, there are definitely some issues with the audio tag, see here http://stackoverflow.com/questions/3069124/playing-html5-audio-in-android-browser

Try this:

<video src="test.mp3" onclick="this.play();"></video>