Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

7 years ago by Joncom

Screenshot. See?

I've tried playing my game on the iPad both in Safari and Chrome. Both just hang and the browser thinks that it has finished loading the page.

At the very least shouldn't the Safari console display an error, because something must have gone wrong?

Edit - The entire lib, media and index.html package consists of less than 5MB of data.

7 years ago by StuartTresadern

To debug the latest Safari you need to contect it to a Mac running Safari. You shoulde be able to see the error in Chrome thats preventing the game from running.

7 years ago by Joncom

I'm using the Safari found in iOS 4.3.3 which has a built-in JavaScript console.

I can play other ImpactJS games with it, no problem.

I've used it for debugging and catching JavaScript errors before, no problem.

I'm just curious if anyone has ever encountered a game not loading (and yet without errors) before? It just seems a little strange.

7 years ago by Joncom

I installed Safari 5.1.7 for Windows and took another screenshot of me trying to play. It fails again but reports:

sound.js:13 TypeError: 'undefined' is not a constructor (evaluating 'new Audio()')

The error points to lib/impact/sound.js.

Furthermore the game and all sounds seem to work perfectly in Chrome, Firefox, and Internet Explore.

I do recall that people have had difficulty with ImpactJS games running audio in Safari in particular, but seeing as though Biolab has no problems, I am hopeful that mine can run too...

7 years ago by dominic

Safari for Windows comes without Audio support. As I understand, Safari on Mac uses the Quicktime System libraries to play Audio and Video; these are unavailable on Windows and Apple didn't care to provide an alternative, because no one actually uses Safari/Win :)

That said, Impact 1.21 includes a check that will disable Sound completely when the <Audio> element is unavailable.

Quote from Joncom
I've tried playing my game on the iPad both in Safari and Chrome. Both just hang and the browser thinks that it has finished loading the page.


Safari on iOS is a different problem. First, Chrome on iOS actually uses a "WebView" provided by iOS - under the hood it's the exact same browser as Mobile Safari. Playing Audio in Mobile Safari is close to impossible, at least for game like scenarios, where you need several different sounds.

Biolab Disaster and other games therefore disable Sound before the game begins to load. See this article.


Quote from Joncom
At the very least shouldn't the Safari console display an error, because something must have gone wrong?

Yes, it should, but it doesn't. Impact listens for the canplaythrough event on Audio files, to determine if they are loaded. However, Mobile Safari straight up denies pre-loading sound files and the event is never fired. The only way to force it to load sound files, is to attempt to play them.

If you feel adventurous, have a look at sound sprites, but be warned, it's a huge pain to implement and still sounds like ass.

You could also try playing the sounds via WebAudio - Mobile Safari is supposed to have some support for it, as of iOS6. I haven't looked into this myself, though.

7 years ago by Joncom

Quote from dominic
Impact 1.21 includes a check that will disable Sound completely when the <Audio> element is unavailable.

By using ImpactJS 1.21 instead of 1.20, and by encapsulating anything audio-related within if( ! ig.ua.mobile ) { }, my game now runs on both Safari for Windows and Safari for iPad.

Many thanks!
Page 1 of 1
« first « previous next › last »