Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 Video Autoplay not working correctly

I'm using this code:

<video width="440px" loop="true" autoplay="true" controls> <source src="http://www.example.com/CorporateVideo.mp4" type="video/mp4" /> <source src="http://www.example.com/CorporateVideo.ogv" type="video/ogv" /> <source src="http://www.example.com/CorporateVideo.webm" type="video/webm" /> </video> 

I want the video to autoplay but when the page loads the video doesn't play. It looks like it's a buffering issue, as when I hover on the video (to show controls) the video is always 2 seconds in but then stops and doesn't continue.

Note: I just visited the site again and autoplay seemed to work, but when I try again the same issue is happening, is this a buffering issue? Anything I can do to stop this?

like image 661
NickMcB Avatar asked Jun 06 '13 14:06

NickMcB


People also ask

Why video autoplay is not working in HTML?

Chrome does not allow autoplay if the video is not muted. So to autoplay video you need to set both autoplay and muted attribute.

How do I get a video to automatically play in HTML?

The HTML autoplay Attribute is used to specify that the audio/video should automatically start playing when web page is loaded. It is a Boolean attribute. Uses It can be used with <audio> and <video> element. Example 1: Here the autoplay attribute is used with the <video> tag.

Why is my video not working in HTML5?

If your browser error "HTML5 video file not found", it means that your browser is not up to date or website pages does not have a suitable video codec. It would help if you communicated with the developer to solve the issue and install all the required codecs.

What is the correct HTML 5 element for playing video files?

<video>: The Video Embed element. The <video> HTML element embeds a media player which supports video playback into the document.


2 Answers

Try autoplay="autoplay" instead of the "true" value. That's the documented way to enable autoplay. That sounds weirdly redundant, I know.

like image 93
Multimedia Mike Avatar answered Sep 23 '22 06:09

Multimedia Mike


Chrome does not allow autoplay if the video is not muted. Try using this:

<video width="440px" loop="true" autoplay="autoplay" controls muted>   <source src="http://www.tuscorlloyds.com/CorporateVideo.mp4" type="video/mp4" />   <source src="http://www.tuscorlloyds.com/CorporateVideo.ogv" type="video/ogv" />   <source src="http://www.tuscorlloyds.com/CorporateVideo.webm" type="video/webm" /> </video> 
like image 36
StefanP Avatar answered Sep 20 '22 06:09

StefanP