如何停止视频自动播放

时间:2020-11-12 14:30:21

标签: html

我正在使用Bootstrap4。页面加载后,我的嵌入式视频会自动播放。我的代码是:

<div class="embed-responsive embed-responsive-16by9 hoverable video-1 video-align">
  <iframe class="embed-responsive-item" src="myvideo.mp4" allowfullscreen></iframe>
</div>

请问如何停止自动播放?

3 个答案:

答案 0 :(得分:2)

不要使用iframe;使用视频标签。内联框架在那里显示页面上的另一个文档,并且在页面加载时自动呈现。如果是视频,则会自动播放。

答案 1 :(得分:0)

您可以像这样使用autoplay="false"

<video width="640" height="480" controls="controls" type="video/mp4" preload="none">
<source src="myvideo.mp4" autoplay="false">
Your browser does not support the video tag.
</video>

应该的。

答案 2 :(得分:-1)

为iframe使用此附加参数:

autoplay="false"