Reputation: 2599
i'm developping a game with HTML5 i'm trying to add sound , it works when i test it in the browser but it's a mobile game so when i test it in the emulator via PhoneGap the sound is not working .
here's my code : Html:
<audio id="buttonover">
<source src="sounds/cartoon008.ogg" ></source>
</audio>
JavaScript :
sndCollide = document.getElementById('buttonover');
sndCollide.play();
Upvotes: 0
Views: 1283
Reputation: 309
The Sound response of native audio tag is very slow in mobile browsers.
So you can use a phonegap native sound system
the javascript code for it is
src="sounds/cartoon008.ogg"
var soundObj = new Media(src,onSuccess,onError);
soundObj.play();
also kindly check that ogg files are supported in mobile.
you have to write a overriding functions for onSuccess and onnError.
Upvotes: 1