espace Posted January 8, 2018 Share Posted January 8, 2018 hi, the background music of my application is still playing when i leave the application. the back button stop the music (left button) but not the home button (middle button) here is the code of my background music : music=game.add.audio('music'); music.volume=0.4 music.play(); i try different approach but nothing works : //approach 1 // in index.html document.addEventListener("pause",onPause,false) function onPause(){ music.pause(); }; // => don't works //approach 2 //in main.js function update(){ if(game.stage.disableVisibilityChange){ music.pause() } }; // => don't works what must i add to avoid this ? thanks for your assistance. Link to comment Share on other sites More sharing options...
espace Posted January 9, 2018 Author Share Posted January 9, 2018 Nobody ? Link to comment Share on other sites More sharing options...
espace Posted January 9, 2018 Author Share Posted January 9, 2018 solved with phaser CE Link to comment Share on other sites More sharing options...
samme Posted January 9, 2018 Share Posted January 9, 2018 Probably you would use Phaser.Game#onBlur or Phaser.Game#onPause, if the browser isn't handling this already. espace 1 Link to comment Share on other sites More sharing options...
Recommended Posts