news Playing Sounds & Audio in iPhone Web Pages

March 20, 2009

 

Turns out that it's possible to integrate playback of audio in a webpage so that it works on iPhone without having to use flash - which of course isn't yet available.. not even in iPhone 3.0.

 

It's pretty easy and makes use of HTML EMBED tag, in combination with a little piece of Javascript.  On desktop browsers, you can make sounds play automatically when a page is loaded, but this doesn't work on the iPhone.

 

Here's an example where a button press causes a WAV sound to play..

 

Thanks to Tim K for the Javascript bit.