Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent html5 video from loading before playing?

I have several html5 videos on one page and I've just realized that when you visit the page, all the videos start loading even though I haven't clicked play on any of them.

Is there a way to only load a video once you click play, to prevent unnecessary downloading?

like image 438
Will Ryan Avatar asked Jan 13 '13 02:01

Will Ryan


People also ask

How do I stop a video from loading?

The first and one of the easiest steps to disable auto-loading of images and videos is through visiting the URL chrome://chrome/settings/content, in images section, just select “do not show images” option.

How do you prevent HTML5 video from changing size when loading a new source?

If all you want is really to avoid the width/height to return to defaults (300 x 150) when the next video is loading, you just have to set your <video> 's width and height properties to the ones of the loaded video ( videoWidth and videoHeight are the real values of the media, not the ones of the element).

How do I stop automatic video play 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. To remove autoplay, the attribute needs to be removed altogether. In some browsers (e.g. Chrome 70.0) autoplay doesn't work if no muted attribute is present.


1 Answers

<!DOCTYPE html> <html> <body>  <video width="320" height="240" controls="controls" preload="none">   <source src="movie.mp4" type="video/mp4" />   <source src="movie.ogg" type="video/ogg" />   Your browser does not support the video tag. </video>  </body> </html> 

Use Preload"none"

http://diveintohtml5.info/video.html

like image 194
Timothy Radzikowski Avatar answered Oct 04 '22 08:10

Timothy Radzikowski