Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable auto-play for local video in iframe

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"
like image 216
Taleb Avatar asked Aug 12 '15 04:08

Taleb


People also ask

How do I turn off autoplay on embedded videos?

Disable Autoplay Videos in Chrome on Android Android makes disabling autoplay videos simple. First, launch Chrome on your phone or tablet and go to Settings > Site Settings. Next, scroll down the menu and tap on Media, and then Autoplay and toggle the switch off.

How do I stop videos from playing automatically in HTML?

To disable video autoplay, autoplay="false" will not work; the video will autoplay if the attribute is there in the <video> tag at all.

How do I autoplay an iframe local video?

Allowing iframes to autoplay video content You should also note the need to use the allowfullscreen attribute in complement to the allow attribute in order to support browsers that do not support allow attribute. If you are using amp-iframe and autoplay you need to add allow="autoplay" to your amp-iframe element.

How do I stop Media from playing automatically?

Click Accessibility, display, and language > Data usage > Autoplay > Never, which will prevent videos and GIFs from automatically playing as you scroll. On iOS and Android, click your profile and select Settings and Privacy > Display and Sound and uncheck Media previews.


1 Answers

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> 
like image 191
Abhishek Avatar answered Sep 17 '22 14:09

Abhishek