How to disable auto-play for local video in iframe

Taleb picture Taleb · Aug 12, 2015 · Viewed 146.7k times · Source

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"

Answer

Abhishek picture Abhishek · Aug 12, 2015

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>