Jump to content

Fullscreen with gamepad: not recognized as "user gesture".


Kosmoon
 Share

Recommended Posts

Triggering fullscreen with onDownCallback with game.input.keyboard works fine, but with game.input.gamepad i get this error: " Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture."

Is there a way to modify phaser.js to recognize the gamepad as a valid user gesture for fullscreen?

game.input.gamepad.pad1.onDownCallback = function (button) {
  if (button === 9){
    game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL;
    if (game.scale.isFullScreen) {
        game.scale.stopFullScreen();
    } else {
        game.scale.startFullScreen(false);
    }
  }
}

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...