0

似乎只有一种方法可以让媒体在高于 4.2 的 iOS 版本中自动播放,如用户 bhup 所示:如何在 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);

使用这种方法有一个主要缺点:当使用这种方法时,我找不到让 JS 与 Quicktime 插件交互的方法。

我已经尝试了很多事情,但是找不到一种方法来实例化插件以将其暴露给 JS 并让它自动播放。有什么想法吗?

4

1 回答 1

0

单程:

在您的 iFrame 元素中,设置onload="parent.someFunction();"

然后,在 someFunction() 中:

pluginElement = document.getElementById('yourIframeElementId').contentWindow.document.body.firstChild;
pluginElement.GetTime(); //Or any other function that the QT plugin exposes
于 2011-03-30T19:04:53.010 回答