How do I make my app run full screen on a tap?
Thanks
How do I make my app run full screen on a tap?
Thanks
You can call the browser Fullscreen API, check here for how it works:
https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API
Thanks, so I just use
Element.requestFullscreen();
directly in PlayCanvas, or do I need to prepend something to to that line be able to access Element?
I think for that to work it has to execute as a response to user input (clicking on a button, pressing a keyboard key etc.), check the examples on the MDN site:
Note that iOS Safari doesn’t have a full screen API.
We also have an API for fullscreen too that wraps around the browser API. https://developer.playcanvas.com/en/api/pc.GraphicsDevice.html#fullscreen
I was under the impression that there was a motion to deprecate engine support for going fullscreen, and promote the usage of the browser Fullscreen API directly:
Let me know if I am wrong!
Thanks, but I really have no idea how I should be using that. The help just says:
boolean fullscreen
That doesn’t tell me anything of how I should call it using the PlayCanvas syntax.
this.app.graphicsDevice.fullscreen = true; // enter fullscreen
this.app.graphicsDevice.fullscreen = false; // exit full screen
Perfect. Thank You!
Oh wow! There’s more fullscreen code in the engine? Geez, how did that get there?
I’ll deprecate that too when I get a second. Apps should be calling the fullscreen API directly instead of PlayCanvas doing it internally.