【问题标题】:Media autoplay in iOS 4.2+: How to access Quicktime through JS when using an iframe for autoplayiOS 4.2+ 中的媒体自动播放:使用 iframe 进行自动播放时如何通过 JS 访问 Quicktime
【发布时间】:2011-03-22 21:34:29
【问题描述】:

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

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

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

【问题讨论】:

    标签: javascript ios quicktime autoplay


    【解决方案1】:

    一种方式:

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

    然后,在 someFunction() 中:

    pluginElement = document.getElementById('yourIframeElementId').contentWindow.document.body.firstChild;
    pluginElement.GetTime(); //Or any other function that the QT plugin exposes
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-20
      • 2021-10-29
      • 2011-05-14
      • 2012-12-06
      • 1970-01-01
      • 1970-01-01
      • 2021-02-16
      • 1970-01-01
      相关资源
      最近更新 更多