【问题标题】:How to stop auto play of embedded video?如何停止嵌入视频的自动播放?
【发布时间】:2017-12-14 20:42:55
【问题描述】:

这是我尝试嵌入的来自 metacafe.com 的视频剪辑:

<!DOCTYPE html>
<html>
<body>

<table>
<tr>
<td>
<iframe 
width="720" height="405" 
src="http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4$autoStart=false" 
frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen>
</iframe>
</td>
</tr>
</table>

</body>
</html>

嵌入是可以的,除了页面加载后剪辑会自动开始播放。我怎样才能在这里停止自动播放?

我尝试了以下选项,但都没有奏效:

http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4/&autoStart=false

http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4/&autoStart=0

http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4/?autoStart=false

http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4/?autoStart=0

http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4&autoStart=false

http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4&autoStart=0

http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4?autoStart=false

http://www.metacafe.com/embed/11600739/natasha-the-founder-of-easy-peasy-lemon-squeezy-forms-the-secrets-to-form-a-saas-application-mp4?autoStart=0

我也尝试在所有这些选项中使用 autoPlay 而不是 autoStart,但也没有用。

【问题讨论】:

  • 谁投票赞成关闭这个问题?为什么?
  • 我看不出有什么理由结束这个问题。

标签: html video html5-video autoplay


【解决方案1】:

作为 iFrame 源的链接是指向网页的链接,而不是指向视频的链接。

您可以通过在浏览器中加载链接然后使用开发人员工具“检查”页面来查看这一点。

然后该网页包含指向视频本身的链接和一个播放器,该播放器已设置自动播放,因此视频立即开始。

如果您可以访问视频链接,那么您可能会发现将其添加到您自己的页面更容易 - 视频看起来至少有一个版本是 HLS 文件,因此您需要 JavaScript 网络播放器或原生支持 HLS 的浏览器 - 使用播放器更安全,因为它提供更广泛的支持。

【讨论】:

  • 非常感谢。至少,现在我知道问题出在哪里了!
  • 我还应该提到视频链接也在 iframe 的“页面”中 - 当您在 iframe 本身上使用检查器工具时,您可以在页面源中看到它们。 HLS 视频链接(以 .m3u8 结尾的链接)将在任何支持 HLS 的 javascript 播放器中播放,并将在某些浏览器(例如 Mac 上的 safari)中原生播放(以 m3u8 结尾的 URL 直接粘贴到浏览器栏中进行测试)。
猜你喜欢
  • 1970-01-01
  • 2016-01-06
  • 1970-01-01
  • 1970-01-01
  • 2016-05-07
  • 1970-01-01
  • 2017-09-03
  • 2013-03-03
  • 1970-01-01
相关资源
最近更新 更多