Issues with Apple devices and music

Recommended Posts

Hi guys,

i just started working with phaser, i need to make a game working with all devices (including apple's phones).

However this piece of code doesn't work with apple devices from chrome webdeveloppement tool even if it works  with android's one.

It also works after i used my mute button (i mute then unmute and it works on all devices). I made researches but i didn't find anything..

Hope you have a solution,



this.music = this.add.audio('background_music');

		//sound button
		this.soundButton = this.add.button(0,0, 'sound_icon', this.toggleMute, this);
		this.soundButton.fixedToCamera = true;
		this.muteButton = this.add.button(0,0, 'mute_button', this.toggleMute, this);
		this.muteButton.fixedToCamera = true;
		this.muteButton.visible = false;

toggleMute: function() {
    if (!this.game.sound.mute) {
        this.game.sound.mute = true;
        this.soundButton.visible = false;
        this.muteButton.visible = true;
    } else {
        this.game.sound.mute = false;
        this.soundButton.visible = true;
        this.muteButton.visible = false;    }


Share this post

Link to post
Share on other sites

There is some protection on iPhones that allows to play sound only after some user input (touch event, button click etc.). Can't help you with some workaround, but there were plenty of similar topics here.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.