phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Fullscreen doesn't work in mobile phone

Open ghost opened this issue 7 years ago • 8 comments

The full screen api doesn't seem to work in android phone. I used the example from https://labs.phaser.io/100.html?src=src\scalemanager\full%20screen%20game.js

ghost avatar Feb 10 '19 14:02 ghost

Which browser? and which version of Android? Support is limited on mobile. If the device + browser don't support it, there's nothing that can be done.

photonstorm avatar Feb 10 '19 15:02 photonstorm

Which browser? and which version of Android? Support is limited on mobile. If the device + browser don't support it, there's nothing that can be done.

Uh, Browser is chrome

And android versions are 6 and 8

ghost avatar Feb 10 '19 15:02 ghost

Same here.

  • Chrome version 72.0.3626.96 using emulator and Phone with Android 7
  • Phaser experimental build 3.16.2 (c8439393fba69201634940e752df4ae965d7fa88)

Console output is two-fold:

Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture

and

Uncaught (in promise) TypeError: fullscreen error

I've done some investigation and it seems to occur in the function startFullscreen (specifically line 69015 in phaser.js:

fsTarget[fullscreen.request](fullscreenOptions);

Desktop seems to work fine. I've tried setting the fullscreenTarget to document.documentElement, as well as not setting it at all. Furthermore, I'm not able to get console outputs, but iPad+Safari and Mozilla Firefox emulator don't appear to work either.

pfdtravalmatic avatar Feb 12 '19 14:02 pfdtravalmatic

iPad and iPhone work fine for me on real devices.

The Android issue is weird because it is coming from a user gesture in that demo. I could understand the error if it was being called automatically without a gesture.

photonstorm avatar Feb 12 '19 14:02 photonstorm

I'm getting the same thing.

  • iPhone 7S Plus
  • iOS version 12.1.4
  • iOS Safari
  • Fullscreen API Experimental WebKit feature enabled

Pushing the fullscreen button changes the button to the "return to fullscreen" version, but nothing actually happens. The button then goes unresponsive and you can't switch it back to the "go to fullscreen" version.

SnipersCode avatar Feb 13 '19 01:02 SnipersCode

I get this error

MESSAGE: Uncaught TypeError: Cannot read property 'isFullscreen' of undefined

ghost avatar Feb 16 '19 03:02 ghost

Looking at this today. It's interesting. If you tap anywhere on the canvas first (before tapping the fullscreen button) and THEN tap the fullscreen button, it works perfectly. If the very first thing you do is tap the fullscreen button, it errors.

So, something appears to be getting in the way of the first tap, because the code path is identical. I'm guessing maybe the web audio unlocking.

photonstorm avatar Mar 07 '19 10:03 photonstorm

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Please note the updated documentation + example regarding this feature on mobile.

photonstorm avatar Mar 07 '19 12:03 photonstorm