【发布时间】:2014-01-27 04:14:10
【问题描述】:
我正在使用以下代码在iframe 中运行视频:
<iframe
id="videoFrame"
autoplay
seamless
width="100%"
height="90%"
src="video/abc.MP4">
<p>Your browser does not support iframes.</p>
</iframe>
使用上面的代码,视频可以在所有浏览器和 iPad 上正常运行。为了控制视频,我使用以下代码:
document.getElementById(
"videoFrame"
).contentDocument.getElementsByTagName("video")[0].pause();
它适用于所有桌面浏览器。视频在点击事件时暂停。
但在 iPad 上它返回 undefined。
所以请谁能告诉我如何在 iPad Safari 浏览器上控制 iframe 中的视频...
【问题讨论】:
-
请注意,
autoplay用于<video>标记,而不是 iframe...所以这不是有效的 html5。您更有可能忽略的是html5 does not support percentages in the width and height fields,但最好的办法可能是使用 CSS。
标签: javascript jquery html ipad iframe