Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting nothing from chrome on android phone #114

Open
stccorp opened this issue Aug 19, 2017 · 3 comments
Open

Getting nothing from chrome on android phone #114

stccorp opened this issue Aug 19, 2017 · 3 comments

Comments

@stccorp
Copy link

stccorp commented Aug 19, 2017

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)

<script src="/assets/js/buzz.js"></script>
<script>

if (!buzz.isSupported()) {
    alert("Your browser is too old, time to update!");
}

if (!buzz.isOGGSupported()) {
    alert("Your browser doesn't support OGG Format.");
}

if (!buzz.isWAVSupported()) {
    alert("Your browser doesn't support WAV Format.");
}

if (!buzz.isMP3Supported()) {
    alert("Your browser doesn't support MP3 Format.");
}

if (!buzz.isAACSupported()) {
    alert("Your browser doesn't support AAC Format.");
}

var test = new buzz.sound("/assets/alarm2", {
    formats: [ 'ogg', 'mp3' ],
    volume: 100,
    autoplay: false,
    preload: true,
    loop: false
});

test.play();
</script>
@jaysalvat
Copy link
Owner

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

@githubertus
Copy link

githubertus commented Nov 18, 2017

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.

@mouseroot
Copy link

mouseroot commented Dec 3, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants