Jump to content

Does the latest version of Phaser work on the iPad/iPhone?


Biggerplay
 Share

Recommended Posts

I've updated my game code from 1.1.3 to latest version of Phaser and it runs fine on desktop, but on the iPhone/iPad there are issues.


 


Firstly on the iPhone it runs to the end of the preloader and then just stops.


 


On the iPad it runs, but the music won't play.


 


This is all based upon the mobile template in the examples.


Link to comment
Share on other sites

Yes it works fine, we do nearly all our game testing against iOS (6 and 7).

 

Going to need to provide more info to nail this one down. What errors are you seeing logged? (if you don't use a Mac, the answer will be none, in which case post a URL so someone with a Mac can test it :))

Link to comment
Share on other sites

Because you can look at the errors that Safari on the iPad/iPhone must be spitting out.

 

How? and as well as that, what's throwing me is that it can work fine on Safari on the desktop but not on mobile, it even works differently from iPhone to iPad why is that? I thought it worked on one it would work on all, with perhaps just screen formatting differences between them.

Link to comment
Share on other sites

Plug you iOS device into your Mac, fire up Safari on both and remotely debug it (you have to enable it in iOS first). Then you'll see console errors, which I'm absolutely certain there will be some of.

 

It doesn't matter if it works on desktop, you're not really comparing oranges with oranges here. Desktop can do loads more than mobile - more audio codecs, WebGL support, higher GPU texture limits, more memory, etc. It's entirely possible to write a game that runs happily on desktop and falls flat on its face on mobile.

Link to comment
Share on other sites

Plug you iOS device into your Mac, fire up Safari on both and remotely debug it (you have to enable it in iOS first). Then you'll see console errors, which I'm absolutely certain there will be some of.

 

It doesn't matter if it works on desktop, you're not really comparing oranges with oranges here. Desktop can do loads more than mobile - more audio codecs, WebGL support, higher GPU texture limits, more memory, etc. It's entirely possible to write a game that runs happily on desktop and falls flat on its face on mobile.

 

Thanks, I never knew you could do that.

 

Right on the iPad/iPhone on loading there are no errors, but the music doesn't play. I just tested runpixirun and that ran fine, and their music played. The only msg I got from the iPad version was this 

 

Phaser v2.0.3 - Renderer: Canvas - Audio: WebAudio - http://phaser.io

 

 

which I presume is correct.

 

I did get this error on both versions (and desktop) when I tap the screen.

 

[Error] TypeError: 'undefined' is not an object (evaluating 'this._bindings.length')dispatch (phaser.min.js, line 6)dispatch (phaser.min.js, line 6)_releasedHandler (phaser.min.js, line 9)stop (phaser.min.js, line 8)stopPointer (phaser.min.js, line 8)onTouchEnd (phaser.min.js, line 8)_onTouchEnd (phaser.min.js, line 8)

I'm not sure what's causing that, also why the music is not being played on the iOS versions.

Link to comment
Share on other sites

Hmm I just went to the play music audio phaser example on the iPad and I'm not hearing anything, plays fine though on the mac.

 

*Update*

 

Just tried it again and now it's playing the example so I'm presuming that was a connection issue.

 

Does the iOS version play the .mp3 file or the .ogg file?

Link to comment
Share on other sites

The audio example uses a pretty hefty mp3 file which takes a while to decode on iOS (even on desktop actually), but it works fine once you've touched the screen to unlock audio playback. iOS plays the mp3 file.

I've just sent you a PM with the games URL in it.

 

I've put the audio debug on the screen. It plays and says the audio is ready on the Mac, but on iOS it doesn't and I'm not sure why that is.

Link to comment
Share on other sites

Ok I've downloaded the music.mp3 file from your game and can't get it to work on iOS at all (never mind in Phaser).

 

I suspect because it's a 128 Kbps constant bit-rate, 32-bit Stereo 44100 Hz file!

 

For iOS I'd guess that's simply too high as it can't decode it fast enough.

 

When I take your mp3 into Audition and re-export it, I can get it working perfectly with any of the following settings:

 

112 Kbps CBR Stereo

96 Kbsp CBR Stereo

 

I can also get it to work at 128 Kbps if you drop it from Stereo to Mono.

 

zip file with all my above tests in here: https://www.dropbox.com/s/sndkjjxmvllypdx/music-tests.zip

Link to comment
Share on other sites

Also it's worth adding that on several occasions your game wouldn't load at all and black screened. This was because it was loading the game source files in the 'wrong' order. You don't tend to get this happen much (if at all) when testing locally as the browser can read the source files so fast they appear in the order you specified them in your html. But from a remote web server this isn't always the case, they load in parallel, not sequentially, and sometimes I noticed the end of your game load first which was just causing it to hang. When deploying to a remote host for testing you should either use requireJS (which I personally never do), or process the source into a single file (which I always do). I use grunt for this as it can concat, uglify and deploy in one command.

Link to comment
Share on other sites

Also it's worth adding that on several occasions your game wouldn't load at all and black screened. This was because it was loading the game source files in the 'wrong' order. You don't tend to get this happen much (if at all) when testing locally as the browser can read the source files so fast they appear in the order you specified them in your html. But from a remote web server this isn't always the case, they load in parallel, not sequentially, and sometimes I noticed the end of your game load first which was just causing it to hang. When deploying to a remote host for testing you should either use requireJS (which I personally never do), or process the source into a single file (which I always do). I use grunt for this as it can concat, uglify and deploy in one command.

You mean this ? http://gruntjs.com/ ? that's looking a bit complex for me to use right now :)

Link to comment
Share on other sites

  • 2 weeks later...

I have zero game development with JS and even less with grunt (I didn't even know there is such a thing)

Weeks ago I followed this tutorial 

http://codevinsky.ghost.io/phaser-tutorial-getting-started-with-generator-phaser-official/

 

I still don't know exactly how grunt works but now I'm perfectly happy with my setup

I have live-reload enabled and all I can see is that my code is already uglified (whatever this means) and ready to deploy when my game is ready

Link to comment
Share on other sites

grunt is a tool that does jobs for you.

 

you specify what jobs it should do in the Gruntfile.js

 

(if you know "make" from the c world, or "ant" from java world, grunt is the node.js equivalent)

 

You can tell grunt to put files together (concat). (You list the files, grunt takes them and puts them into one big file in the given order).

 

You can tell grunt to uglify this one big javascript file - this means it will take out all the blanks, the comments, the linebreaks etc. (to make it as small as possible)

This is also "kind of" a copy protection. Stealing uglified code isn't fun. :) (it's not impossible.. but not fun.)

 

You can tell grunt to copy files around, this way you can generate a directory (everytime your run grunt) that only contains what you want to release.

 

 

This is what I do with all my games (by just modifying one Gruntfile.js and putting it into my game directory.)

 

To get grunt to run the first time follow one of the tutorials linked above :)

 

 

It's really usefull - after the initial setup it saves time (and as you can see by rich posting) it even resolves issues with loading the game over the web.

Link to comment
Share on other sites

  • 3 weeks later...

The audio example uses a pretty hefty mp3 file which takes a while to decode on iOS (even on desktop actually), but it works fine once you've touched the screen to unlock audio playback. iOS plays the mp3 file.

Is there a way to get around the touch to unlock the  audio playback?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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