Open stccorp opened 7 years ago
Hello.
It sounds like device limitation.
CF. http://buzz.jaysalvat.com/documentation/sound/
"Important: In order to save bandwidth, mobile devices don't load/play sounds without user intervention (no autoplay). iPhone and iPad can only play one sound at a time and don't allow to change the volume dynamically."
Just verified on Android/Chrome:
You need at least 1 confirmation you're willing to hear a sound by clicking an element of your page like
<button id="buzz">OK to buzz</button>
Staying with your code and having jquery installed this would do the trick
$('#buzz').click(function() {
test.play();
});
buzzer = setInterval(function() { test.play(); } ,1000 * 5);
Once confirmed this way, subsequent buzzes are allowed to happen programatically.
Id like to add to this and confirm that it must be from a button or some other input element, using canvas doesn't work either, I had to rig up a styled button over my canvas to get everything working, but once you get past this limit, the sound will play.
$("#play").on("click",function(){
$("#c").show();
var laserSound = new buzz.sound("ACDC.ogg");
laserSound.play();
});
Because of this I have found a silent mini sound and had that play onload to get the ball rolling.
I am getting nothing when using this on Chrome(android phone). It works if I use a desktop browser. It also works perfect on firefox(android phone)