Jump to content

pauseOnHide


ftguy2018
 Share

Recommended Posts

Hello,

On a web browser if we set the pauseOnHide: false and if we change the tab, should the engine stop to call update: ? Actually I can hear the music still playing but there is no update of the screen, is it the supposed behavior ? What is exactly pauseOnHide:false doing ?

Thank you, 

Link to comment
Share on other sites

When pauseOnHide is set to true (which is the default value), the engine will pause when the web page tab has been hidden. To detect this it uses visibilitychange event: https://developer.mozilla.org/en-US/docs/Web/Events/visibilitychange

Panda engine uses requestAnimationFrame function to update each frame and most browsers do not call this function if the page is hidden (https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame), so that's why even if pauseOnHide was set to false, the game won't actually update, but the music will keep playing.

 

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