Hi there!
I have a game which I’d like to run in full-screen on Chrome browser running on iOS (iPhone 6).
Referring to the documentation, I see that calling app.EnableFullscreen is the recommended route.
http://developer.playcanvas.com/en/api/pc.Application.html#enableFullscreen
I can get this to work on the PC Chrome browser, respond to a mouse-click event, as follows:
// This works on the PC Chrome browser - I click my mouse, and success - browser switches to full-screen mode.
var bdy = document.body;
bdy.addEventListener('click', function () {
console.error( 'click event - going to call app.enableFullscreen()' );
app.enableFullscreen(app.canvas, function () {
console.error('Now fullscreen');
}, function () {
console.error('Something went wrong!');
});
}, false);
Now if I add very similar code, but responding to the touchstart event, I’d hope that when I run the app on my iOS Chrome browser, it would get rid of the URL bar etc.
bdy.addEventListener('touchstart', function () {
console.error( 'touchstart event - going to call app.enableFullscreen()' );
app.enableFullscreen(app.canvas, function () {
console.error('Now fullscreen');
}, function () {
console.error('Something went wrong!');
});
}, false);
What happens on my iPhone is that “touchstart event - going to call app.enableFullscreen()” displays on the console, but there is no other TTY, and the browser doesn’t switch to fullscreen mode.
I’ve just tried running this on iOS Safari, and the same outcome - no fullscreen.
Hope that someone is able to advise me!