Jump to content

[1.1.3] paused problem with android galaxy devices


BunBunBun
 Share

Recommended Posts

when I tested on PC and iPad all works fine, but with android galaxy devices have a problem after the losing focus on browser.

 

I added that line in the create function of preloader:

game.stage.disableVisibilityChange = true;

I've updated also: (src/input/Pointer.js)

// Fix to stop rogue browser plugins from blocking the visibility state eventif (this.game.stage.disableVisibilityChange === false && this.game.paused && this.game.stage.scale.incorrectOrientation === false){this.game.paused = false;return this;}

also tried to comment out the check below it, don't help :(

 

probably that already fixed it in the new version, but my project 100% ready in the 1.1.3 version, and need to fix only that one.

 

+ Phaser.CANVAS render

Link to comment
Share on other sites

Have you commented out that block of code in Pointer.js? (that is what it needs). If after this + the stage line the game still pauses then it must be something Android specific, maybe it kills requestAnimationFrames automatically when the browser is minimised? What actually happens when it returns?

Link to comment
Share on other sites

Yes, I tested also the version of the build where I commented out that block.

What actually happens when it returns?

The game is freezes. Looks like game.paused === true; but no sure about it.

Are there any console log on android's browser? May I can try to log something.

That bug happens only on galaxy android-mobile, for example on my mobile sonyEricsson Walkman all okay.

Also want to note that happens only with native browser of android, if to test via chrome - all okay.

Link to comment
Share on other sites

about the console in android device - I've found that need to type in the address bar: "about:debug" an you can use console!

that helped me find that in my game: game.paused === false when it freezes.

so the game no paused by code 100% , it looks like it really freeze.

 

rich, any ideas how I can to catch the bug with console report? :)

Link to comment
Share on other sites

one developer recommend to remove requestAnimationFrame and make the other timer, Galaxy devices have troubles with requestAnimationFrame as you said! 

 

any ideas? may be something like that:

if (this.game.device.desktop){    game.requestAnimationFrameEnable = true;}else{   //mobile   game.requestAnimationFrameEnable = false; //the engine will use himself timer}
Link to comment
Share on other sites

I think I found the solution, just re-wrote the start function in \src\system\RequestAnimationFrame.js:

 

start: function () {  this.isRunning = true;  var _this = this;  if ((this.game.device.desktop)&&(window.requestAnimationFrame)){     this._isSetTimeOut = false;     this._onLoop = function (time) {         return _this.updateRAF(time);     };     this._timeOutID = window.requestAnimationFrame(this._onLoop);  }else{     this._isSetTimeOut = true;     this._onLoop = function () {         return _this.updateSetTimeout();     };     this._timeOutID = window.setTimeout(this._onLoop, 0);  }}

just disabled requestAnimationFrame timer on mobile, now works fine!

 

other way how to fix that: (haven't tested yet)

when the game losing the focus - change the timer to updateSetTimeout and then when returm - back to updateRAF.

 

rich, let me know what do you think about that. :)

Link to comment
Share on other sites

Interesting findings. I think what I'll do is add a configuration option so you can say "use setTimeout" regardless if rAf is available or not. Then it's up to the dev to enable or disable it based on device (that's not something I want to enforce from Phaser).

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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