Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Video I can actually live with. People seem to be willing to click something in order for a video to start playing, regardless of what the app in question is doing.

It's Audio that is the killer oversight. Just like Video, Audio can only be played on iOS Safari as the result of a user click. They don't have to click the play button specifically, but they have to click something.

That means you simply can't write a video game that has sound. Every clip needs to be "prepared" with a user action that you convert behind the scenes to a .load() so that it can .play() when you want it to. And if you "prepare" a different clip, you can no longer play the first one, except as the result of a new user interaction.

Add to that the bonus that you can only play one clip at a time. And that iOS tosses them out of memory every time you load a new one, and suddenly your rich, interactive presentation, game, or whatever is reduced to a boggy buffering-screen-having mess.

I wish we could hope for them to fix it in future versions, but the opposite is the case in practice. Up until iOS 4.2.1, there was a nice workaround that got your audio/video clips playing in some cases. iOS 4.2.1 specifically addressed that loophole.



You can use audio sprites to work around the "Every clip needs to be prepared" issue. It's pretty ugly:

http://remysharp.com/2010/12/23/audio-sprites/

The state of audio on iOS and Android is really sad. HTML5 games would benefit so much from working audio but for now, it's completely disabled in Impact (my game engine) on those devices.


Pure awesome.

That article nicely documented the work I (and presumably everybody else trying to get Audio to work on iOS Safari) went through a couple months back. This would have saved me a lot of headache.

I like the sprite idea for playing one clip at a time in a sane way. I might give it a go.

Thanks for the tip, and it's good to see that there are other people out there battling this same stuff!


I understand where they're coming from - browsers shouldn't let websites just play sound automatically because it is annoying as hell. I hate Flash sites that do that. So drawing the line somehow is tough, I guess.


So why not ask the user for permission to play audio? It's already being done with geo-location and storage.


Submit feature request.


Yeah, unfortunately there's no way for the browser to know whether it's looking at a website (which should never play audio at you) or a Web Application (which might need to play audio with impunity).

It's the same with every other browser trick that gets abused on people's MySpace pages. There's a real reason to use that stuff, but only some of the time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: