LeFritz
1
Phaser.AUTO works very well as render type, except that my app crashes on iOS Safari 11.
When I use Phaser.CANVAS it works.
Phaser has nice Browser detection:
https://photonstorm.github.io/phaser3-docs/Phaser.Device.html
I can’t see how to use them to force a render type because they are initialized after the game is instantiated.
Question: how can I force a render type for a specific browser?
(currently I use custom browser detection before starting the game)
Phaser.Device seems to be initialized at runtime and is not available a that point!?
Even this outputs ‘undefined’:
game.events.once('boot', () => {
console.log((<any>Phaser).Device);
I use TypeScript which is why I have to use (<any>Phaser).Device
. Maybe phaser.d.ts is not fully correct.
This works, but how to change the render type at that point?
game.events.once('boot', () => {
console.log(game.device.os.iOS);
Hi @LeFritz,
This code uses the same regex condition used by Phaser to detect iOS:
// isIos == true if the OS is iOS
var isIos = /iP[ao]d|iPhone/i.test(navigator.userAgent);
Regards.
samme
6