Safari iOS HTML5 AAC WHY WHY WHY

0 favourites
  • 13 posts
From the Asset Store
Jump on the mole rats and see how far you can go!
  • I've written a project which uses sound effects, they are stored in the program as AAC and OGG. The sound files work in Chrome and Firefox, but fail to play when accessing my game from Safari on my iPad running iOS 5.1.

    w3schools.com/html5/tryit.asp

    This plays from my ipad, so i'm assuming it is using AAC, as AAC is supported by Safari.

    How come the audio plugin doesn't work? Actually the first time I tried it, it played some of the sound files, though it never played the music. After that, it never played the audio files again.

    I read on a previous post that mentioned you might have to first preload the sound file, and then use the play sound call, is that true?

    Many posts mention using Appmobi to export the app. Does this mean that it produces an iOS application, or is it still accessible from iOS built in web browser Safari? I'm concerned because I need my construct 2 project to remain on a server because it makes use of the Ajax plugin.

  • You shouldn't have to preload anything just to hear audio.

    Are you playing your game in the browser or via PhoneGap or appMobi? If you're just in the browser, it's very difficult to get audio to play at all on iOS: the browser blocks all HTML5 audio unless initiated by a user-input action. That's why pressing a button on the w3schools site plays the audio, but a collision event or something else won't play the sound. On top of that I think in the browser it can only play one sound at a time.

    The PhoneGap and appMobi wrappers use a native audio engine instead of the browser, which overcomes these limitations. (We only very recently added audio support for PhoneGap, since it was complicated)

    I think AJAX should still work from appMobi or PhoneGap... maybe give it a go?

  • I'm playing it in the browser, it actually looks pretty nice on my ipad, given that it's not running fullscreen, and I haven't made any special changes to accomodate for mobile platforms.

    Hmm, I was afraid that appmobi wouldn't work because the ajax call goes out to grab a file that resides in the local dropbox directory. But I'll give appMobi a go tomorrow.

    Regarding the sounds:

    Interesting, that explains why the sounds are working on the buttons, but not anywhere else in the program.

    Thanks for the assistance~~

  • Ashley

    Well, I've tried out AppMobi a little bit.

    Steps:

    1. Created a AppMobi sample project

    2. Exported as AppMobi experimental directly into the Appmobi project directory, looked okay in XDK viewer

    3. Built as a distributed webapp

    4. Copied into my dropbox folder for testing.

    My results were.... mixed to say the least.

    Sound seems to work a little better, and everything works with my ipad 1st gen as well as an ipod touch. Downside, is that it doesn't view in firefox properly, three question marks show up and nothing loads at all. Chrome loads the game but the Touch plugin with mouse control is oddly disabled.

    F5 Preview works on both browsers perfectly, and so does exporting as standard html5 and testing on a local wamp webserver, so I'm not really sure what's going on.

    Any ideas?

  • You should export separately for appMobi. Don't try to run a game exported for appMobi in a browser, it will only work with appMobi, for the other browsers you should export a second time as a standard HTML5 web site.

  • I guess that makes sense. I was just trying to make a single webapp that people could navigate to regardless of whether they're mobiles or laptops. Maybe I could do a single regular webpage that detects the platform using some javascript (navigator.platform) which redirects to the appropriate page based on that.

    As has been mentioned before, even with AppMobi support, playing sounds only works after a user interaction. (too bad there isn't a way to simulate a fake user input event for this purpose though)

    Seems like if I really want sound at this point on a mobile platform, I'm going to have to build a dedicated app for it, guess I'll have to pony up 100 bucks a year for ios development license. (sigh)

    Thanks again for your help.

  • I've been scouring the Construct boards looking for info on audio performance for iOS web-based apps and everything seems to be pointing to no / spotty audio in this case.

    You can do audio in iOS web based apps no problem. The key is to use the Sound Sprite concept and compile all your sound effects into a single audio file.

    With the first user interaction (usually "Tap to Start") load the audio and immediately pause it. Then use seekTo() to jump around to the sounds that you want to play within that file. You are still limited to one sound at a time but it works.

  • Bwakathaboom, in the latest beta release (r87) you should be able to export via PhoneGap and get good sound support, including multiple sounds at once.

  • I saw that but I'm looking for mobile games that run on the web as opposed to a compiled app.

  • You shouldn't have to preload anything just to hear audio.

    Are you playing your game in the browser or via PhoneGap or appMobi? If you're just in the browser, it's very difficult to get audio to play at all on iOS: the browser blocks all HTML5 audio unless initiated by a user-input action. That's why pressing a button on the w3schools site plays the audio, but a collision event or something else won't play the sound. On top of that I think in the browser it can only play one sound at a time.

    /QUOTE]

    Hi,

    I've recently just picked up Construct 2 and I've made some small projects to test out its features. It all seems good so far apart from the lack of audio when playing through Safari on the iPads (tested on iPad 1[5.0.1], iPad 2[5.0.1] & iPad 3 [5.1])

    I initially started out with a backing music track and a simple sound effect. I've since removed the music track to see if it was able to play the sound effect by itself, but I've still had no luck.

    The sound effect is told to play on a button On Clicked event, and the files are within the 'Sounds' folder (there is a .m4a, .ogg and .wav)

    Does anyone have any ideas? Everything seems to work fine through Safari on the iMac. Cheers.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • TomH : you need to preload the file (play it, in fact, on a user click), pause it at 0.1. Then you can start really playing it when the user do something.

  • TomH : you need to preload the file (play it, in fact, on a user click), pause it at 0.1. Then you can start really playing it when the user do something.

    Thanks. I'm preloading it now on the start of layout, but I'm not too sure what you mean by the (play it, in fact, on a user click) part. Are you able to elaborate on that for me please? Cheers.

  • Got it working through On Start of Layout -> preload, play, stop. I couldn't seem to find the 'Pause' option you mentioned. Cheers.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)