Created
October 7, 2011 09:41
-
-
Save eikes/1269911 to your computer and use it in GitHub Desktop.
Play MP3 in the background on iPhone in Safari browser
This file contains 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
var mp3 = document.createElement("audio"); | |
mp3.setAttribute('src', 'http://example.com/track.mp3'); | |
mp3.load(); | |
document.documentElement.appendChild(mp3); | |
mp3.play(); | |
// use mp3.pause() to pause :=) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment