ftguy2018 Posted July 31, 2018 Share Posted July 31, 2018 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, Quote Link to comment Share on other sites More sharing options...
enpu Posted July 31, 2018 Share Posted July 31, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.