如何在iframe中禁用本地视频的自动播放 [英] How to disable auto-play for local video in iframe
本文介绍了如何在iframe中禁用本地视频的自动播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< iframe width =465 如何在src来自本地电脑时停用视频自动播放功能? height =315src =videos / example.mp4>< / iframe>
我尝试了以下方法,但它不起作用:
-
src =videos / example.mp4?autoplay = 0
-
src =videos / example.mp4?autoplay = false
-
src =videos / example .mp4?autostart = 0
-
src =videos / example.mp4?autostart = false
解决方案
如果您使用的是HTML5,请使用视频标记适用于此目的。
您可以使用此视频标记无自动播放:
< video width =320height =240controls>
< source src =videos / example.mp4type =video / mp4>
< / video>
要启用自动播放,
< video width =320height =240controls autoplay>
< source src =videos / example.mp4type =video / mp4>
< / video>
How to disable auto-play for video when src is from my local pc?
<iframe width="465" height="315" src="videos/example.mp4"></iframe>
I have tried the following, but it doesn't work:
src="videos/example.mp4?autoplay=0"
src="videos/example.mp4?autoplay=false"
src="videos/example.mp4?autostart=0"
src="videos/example.mp4?autostart=false"
解决方案
If you are using HTML5, using the Video tag is suitable for this purpose.
You can use the Video Tag this way for no autoplay:
<video width="320" height="240" controls>
<source src="videos/example.mp4" type="video/mp4">
</video>
To enable auto-play,
<video width="320" height="240" controls autoplay>
<source src="videos/example.mp4" type="video/mp4">
</video>
这篇关于如何在iframe中禁用本地视频的自动播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文