-
-
Save giiska/42dcbe2443c9d356e936 to your computer and use it in GitHub Desktop.
How can I autoplay media in iOS >= 4.2.1 Mobile Safari?
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
There is one way to play the video/audio file automatically on 4.2.1. Create an iframe and set its source to the media file's URL and append the iframe to the body. It'll be autoplay. | |
var ifr=document.createElement("iframe"); | |
ifr.setAttribute('src', "http://mysite.com/myvideo.mp4"); | |
ifr.setAttribute('width', '1px'); | |
ifr.setAttribute('height', '1px'); | |
ifr.setAttribute('scrolling', 'no'); | |
ifr.style.border="0px"; | |
document.body.appendChild(ifr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
source: http://stackoverflow.com/questions/4259928/how-can-i-autoplay-media-in-ios-4-2-1-mobile-safari