禁用html5视频自动播放

kkg*_*jmj 31 video html5 autoplay

如何禁用html5视频自动播放?

我尝试过的:

<video width="640" height="480" controls="controls" type="video/mp4" autoplay="false" preload="none"><source src="http://mydomain.com/mytestfile.mp4">Your browser does not support the video tag.</video>
Run Code Online (Sandbox Code Playgroud)

cau*_*maz 45

我将删除autoplay属性,因为如果浏览器找到自动播放字符串,它会自动播放!

自动播放不是布尔类型.

此外,类型进入源代码,如下所示:

<video width="640" height="480" controls preload="none">
   <source src="http://example.com/mytestfile.mp4" type="video/mp4">
   Your browser does not support the video tag.
</video>
Run Code Online (Sandbox Code Playgroud)

参考:http://www.w3.org/TR/html-markup/video.html


小智 8

删除视频标记中的自动播放.使用这样的代码

<video class="embed-responsive-item"  controls>
   <source src="http://example.com/video.mp4">
   Your browser does not support the video tag.
</video>
Run Code Online (Sandbox Code Playgroud)

这是100%的工作


ani*_*ita 5

尝试添加autostart="false"到源标记.

<video width="640" height="480" controls="controls" type="video/mp4" preload="none">
<source src="http://example.com/mytestfile.mp4" autostart="false">
Your browser does not support the video tag.
</video>
Run Code Online (Sandbox Code Playgroud)

JSFiddle示例