phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
37.11k stars 7.09k forks source link

Safari #3220

Closed pipeserrano closed 6 years ago

pipeserrano commented 6 years ago

image

All versions of Safari iOS 9, 10, 11 and MacOSX 10.10, 10.11, 10.12, 10.13

image

image

image

samme commented 6 years ago

3221

pipeserrano commented 6 years ago

I replaced all let with var and it loads but now I'm getting this in iOS when I try to load an image and create a particle emitter and sometimes I get Error: audio resources unavailable for AudioContext construction, MacOSX is working ok.

image

photonstorm commented 6 years ago

Hi, I just built a new version direct from the current master branch, and ran it on my iPad (iOS 11) and tried out a few of the examples and they all worked. Specifically I tried the animation / cubes, demoscene / chunky rasters and physics / arcade / static body. I also ran the particles / electric demo and although it was quite hard to drag the markers around, they did respond once I hit them.

I've pushed the build I just made up to the labs site, so feel free to grab it from there to test with.

pipeserrano commented 6 years ago

Thank you it works in Safari and Android with Ionic but when I try to use it with iOS and Ionic it doesn't work at all (The emitter) and It doesn't load images and it doesn't destroy the instance so everytime I load the controller 6 times it gives me:

image

Phaser 2.x works very well with this code

$scope.$on('$ionicView.beforeLeave', function() { game.destroy(); });

pavle-goloskokovic commented 6 years ago

You'll need to instantiate AudioContext yourself and reuse it by passing it to the game config every time you create a new Game instance. Here's an example showing how to accomplish that http://labs.phaser.io/edit.html?src=src\game%20config\game%20destroy.js

Or if you are not planning to use sounds you can set noAudio setting to true in the game config, take a look at any of the examples in this folder: http://labs.phaser.io/index.html?dir=audio/No%20Audio/

photonstorm commented 6 years ago

Yes, this (Ionic) is a separate issue so I'm closing this one off.