How to use Phaser to make a full-screen version on mobile

Viewed 1598

I saw a lot of api and try a lot of way to make my phaser can using full screen by tap some imgae.

My phaser version is v3.24.1.

I can using

this.scale.startFullscreen(); // Phaser.Scale.ScaleManager

It will success for chrome/safari desktop version but not using by phone.

I try a lot of way to make my phaser game can have a fullscreen function.

This my setting:

const config: GameConfig = {

    type: Phaser.CANVAS,
    width: 1920,
    height: 1080,
    parent: 'game',
    scale: {
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH
    },
    scene: [],
    plugins: {
        scene: [
            { key: 'SpinePlugin', plugin: window.SpinePlugin, mapping: 'spine' }
        ]
    }
};

I don't want change my screen ratio,just want the screen full on the mobile.

How can I do. please help me.

1 Answers

Chrome on can I use is not the support for the Chrome browser on iOS, they are not the same thing. If you look at Safari for iOS on can I use, it will say Safari & Chrome on iOS. It explicitly says partial support refers to ipad ONLY. Fullscreen Web API is not available on iPhone iOS, regardless of browser.

Your only solutions for fullscreen would be to embed the game in a WebView and install as an app, install the app as a PWA, or enable experimental features for fullscreen if for personal use.

Switching game engine is not going to change whether or not a web api is available for iOS.

Related