我在 iframe 标记中嵌入了一个 .mp4 视频。我不知道如何关闭自动播放。我尝试了一切:autoplay =“false”,autoplay =“0”,autoplay ='false',autoplay ='0'但似乎没有任何效果。这是我的代码:
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item behind" src='videos/cloud_computing.mp4' width='640' height='360' style='width:640px;height:360px;'></iframe>
</div>
在此之前有一个 YouTube 视频(无法自动播放),代码如下所示:
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item behind" src='https://www.youtube.com/embed/v1uyQZNg2vE?enablejsapi=1&html5=1&hd=1&wmode=transparent&controls=1&showinfo=0;rel=0;' width='640' height='360' style='width:640px;height:360px;'></iframe>
</div>
最佳答案
你需要输入<video>
标记围绕它,因为它不知道 iframe
因此是视频 autoplay
永远不会工作。尝试下面的代码。
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item behind">
<video src='videos/cloud_computing.mp4'
width='640' height='360' style='width:640px;height:360px;' autoplay="0">
</video>
</iframe>
</div>
Note
我会使用autoplay="0"
和autoplay="1"
因为 chrome 无法识别autoplay="true"
或autoplay="false"
.
关于html - 如何关闭自动播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31434077/