rossi46 Posted March 15, 2018 Share Posted March 15, 2018 i use V 4.5. I create a button in my game. When i click button I want to my game full screen in mobile. But when i click button, my console say : "Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture." that.btnSpin.on("pointerover", that.btnOver).on("pointerout", that.btnOut).on("pointerdown", that.btnSpinDown).on("touchstart", checkFullScreen).on("click", checkFullScreen).on("mousedown", checkFullScreen).on("tab", checkFullScreen); var checkFullScreen = function () { document.documentElement.requestFullscreen ? document.documentElement.requestFullscreen() : document.documentElement.msRequestFullscreen ? document.documentElement.msRequestFullscreen() : document.documentElement.mozRequestFullScreen ? document.documentElement.mozRequestFullScreen() : document.documentElement.webkitRequestFullscreen && document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); Quote Link to comment Share on other sites More sharing options...
themoonrat Posted March 18, 2018 Share Posted March 18, 2018 For mobile devices, some of those events above are not classes as valid events to unlock audio or unlock full screen API. touchstart or touchend is usually what you need Quote Link to comment Share on other sites More sharing options...
PsichiX Posted March 19, 2018 Share Posted March 19, 2018 just add some in-game button to toggle fullscreen request and you should be fine. Quote Link to comment Share on other sites More sharing options...
cypher Posted April 4, 2018 Share Posted April 4, 2018 "pointerup" worked fine for me with 4.7, "pointerdown" didn't trigger a user event in chrome-android back then. Quote Link to comment Share on other sites More sharing options...
botmaster Posted April 4, 2018 Share Posted April 4, 2018 The interaction has to be complete, a touchdown is not a complete interaction but touchup is. 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.