Created
December 21, 2011 20:04
-
-
Save gbishop/1507481 to your computer and use it in GitHub Desktop.
Play sound on the iPad from Javascript using jquery mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I keep forgetting how to do this... | |
To play audio in Safari on the iPad using javascript you have to create the audio node in response to a user event. You have to give the audio node a legal url and call load. Then reuse that same node to play sounds in the future. | |
In jquery mobile I bound to the 'tap' event on body. If I haven't already created the audio object I create it there. Then I can use it later. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brilliant, thanks - works perfect :)