magnator Posted September 16, 2013 Share Posted September 16, 2013 Hi all Is it possible to prevent update pausing when losing focus on browser?I am trying to use a multiplayer property so that the game shouldn't get paused. Thanks Link to comment Share on other sites More sharing options...
rich Posted September 16, 2013 Share Posted September 16, 2013 game.stage.disableVisibilityChange = true; Link to comment Share on other sites More sharing options...
magnator Posted September 17, 2013 Author Share Posted September 17, 2013 Actually it doesn't work as I expected. What I want is to open 2 different browsers at the same time and see how the game is behaving in multiplayer mode. Link to comment Share on other sites More sharing options...
rich Posted September 17, 2013 Share Posted September 17, 2013 I don't see why that wouldn't work. I just added it to a test and it stopped the game from pausing at all, I opened a 2nd browser and ran the same example and they were quite happy running side by side. There must be something else going on. Link to comment Share on other sites More sharing options...
magnator Posted September 19, 2013 Author Share Posted September 19, 2013 Still doesn't work. I did something like thisgame = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });game.stage = new Phaser.Stage(game, game.width, game.height);game.stage.disableVisibilityChange = true; Link to comment Share on other sites More sharing options...
rich Posted September 19, 2013 Share Posted September 19, 2013 Ah, like this:var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });function preload() { game.stage.disableVisibilityChange = true; // the rest of your preload stuff here}You shouldn't re-create the Stage like you did in your code above, but more importantly you should put ALL phaser game code inside one of the key functions (preload, create, update) otherwise it will mostly fail to run. Flowan 1 Link to comment Share on other sites More sharing options...
magnator Posted September 19, 2013 Author Share Posted September 19, 2013 I understand now Thank you so much Link to comment Share on other sites More sharing options...
andreyko Posted December 20, 2014 Share Posted December 20, 2014 And is it possible to prevent pausing only playing sound on focus lost? Link to comment Share on other sites More sharing options...
jdnichollsc Posted May 19, 2015 Share Posted May 19, 2015 disableVisibilityChange no works with loops is paused... Link to comment Share on other sites More sharing options...
Recommended Posts