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

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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