Jump to content

Audio causing crash on iPad2


charlie_says
 Share

Recommended Posts

I've got a bit of a strange issue which is definitely the audio causing my game to crash on older ios (I expect the audio is pushing the memory usage over).

I've tried separating off the loading of audio

 if(game.device.iOS){...

on ios using so it only loads m4a. This doesn't resolve the issue.

Of course, the audio doesn't cause any issue on later ios devices, so I'm disinclined to use the above to load a tiny silent audio clip for all the effects.

So, two questions:

Is there a way of making the audio *not* crash the game ?(perhaps by compressing the audio massively?) Has anyone got any tips on how best to optimise?

Or, is there a way I can just do something of the above ONLY for older ios? (this is my preference, I don't want to "penalise" newer ios users for the lower memory of older.)

Thanks!

Link to comment
Share on other sites

Compressing will not help I think, as memory of device is attacked with uncompressed data.

In one of our older games we had lot of music songs. Older devices had memory problem,so we reduced number of it if old device was detected.

If your problem is not in music, but in sound effects, try to prioritize it regarding size and importance in gameplay.

In mentioned game we did something like this before game was even started - it did not reduced only songs, but also animations, it took alternative assets, ...:

            let iPhone = navigator.userAgent.toLowerCase().indexOf("iphone") != -1;
            let iPad = navigator.userAgent.toLowerCase().indexOf('ipad') != -1;
            let iPhone4 = (iPhone && window.screen.height == 480 && window.screen.width == 320 && window.devicePixelRatio == 2);
            let nonRetinaiPad = (iPad && window.screen.height == 1024 && window.screen.width == 768 && window.devicePixelRatio == 1);

            if (iPhone4 || nonRetinaiPad) {
                Global.NO_ANIMS = true;
            }

            if (window.innerWidth * window.devicePixelRatio <= 480 || Phaser.Device.isAndroidStockBrowser() || iPhone4 || nonRetinaiPad) {
                console.log("small assets...");
                Global.LOW = true;

                Global.assetsPath = Global.smallAssetsPath;

                Global.NO_ANIMS = true;
                Global.MAX_MUSIC = 1;

                        :
                        :
            }

You can find lot of device detection code in Phaser.Device class, but most of it is ready after game instance is created. We had to make it like this, because some initialization was done before it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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