There seems to be only one way to get media to autoplay in iOS versions greater than 4.2, as shown by user bhup here: How can I autoplay media in iOS >= 4.2.1 Mobile Safari?
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);
Using this method has one major drawback: I can't find a way to get JS interacting with the Quicktime plugin when using this method.
开发者_JS百科I have tried many things, but can't find a way to both instantiate the plugin in a way that exposes it to JS and have it autoplay. Any thoughts?
One way:
In your iFrame element, set onload="parent.someFunction();"
Then, in someFunction():
pluginElement = document.getElementById('yourIframeElementId').contentWindow.document.body.firstChild;
pluginElement.GetTime(); //Or any other function that the QT plugin exposes
精彩评论