Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable html5 video autoplay

How can I disable html5 video autoplay?

what I've tried:

<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> 
like image 515
kkgzjjmj Avatar asked Oct 29 '13 17:10

kkgzjjmj


People also ask

How do I disable HTML5 autoplay?

To deactivate a function, simply uncheck the related item from toolbar-panel. With this extension you will never have to worry about videos auto playing in the background. In addition, the video will be automatically buffered if necessary.

How do I turn off video autoplay?

Using the Android appClick the menu button at the top right of your screen. Once you're there, scroll down and tap “Settings & Privacy,” then “Settings.” Scroll down until you find “Media and Contacts” and tap on it. Tap on “Autoplay” and set it to “Never Autoplay Videos.”

What is HTML5 autoplay?

The autoplay attribute is a boolean attribute. When present, the video will automatically start playing. Note: Chromium browsers do not allow autoplay in most cases. However, muted autoplay is always allowed.

How Do I Stop Autoplay from embedded tags?

Remove autoplay if you want to disable auto playing video. Show activity on this post. Set true to turn on autoplay. Set false to turn off autoplay.


2 Answers

I'd remove the autoplay attribute, since if the browser encounters it, it autoplays!

autoplay is a HTML boolean attribute, but be aware that the values true and false are not allowed. To represent a false value, you must omit the attribute.

The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.

Also, the type goes inside the source, like this:

<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> 

References:

  • http://www.w3.org/TR/html-markup/video.html
  • HTML Spec (boolean attributes)
like image 184
caulitomaz Avatar answered Sep 28 '22 06:09

caulitomaz


remove the autoplay in video tag. use code like this

<video class="embed-responsive-item"  controls>     <source src="http://example.com/video.mp4">     Your browser does not support the video tag.  </video>

it is 100% working

like image 21
rsnr4u Avatar answered Sep 28 '22 06:09

rsnr4u