Jump to content

Issues with Apple devices and music


Flowzer
 Share

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,

regards,

Flo

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


		//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;    }
},

 

Link to comment
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.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...