HTML provides <video> tag to embed any video in the webpage.
Here is a sample of video element usage that will embed a video in your web page:
<!DOCTYPE html> <html> <body> <h1>The video element</h1> <video width="320" height="240" controls> <source src="[url to your video]" type="video/mp4"> Your browser does not support the video tag. </video> </body> </html>
Autoplay video in HTML web page -
For the desktop devices you can simply autoplay attribute in the video tag to autoplay the video once the webpage is loaded.
Sometime, it can happen when our try to autoplay video in mobile browser then instead of autoplay it just shows you a blank thumbnail. In this case you will need to use muted attribute as well.
<!DOCTYPE html> <html> <body> <h1>The video element</h1> <video width="320" height="240" controls autoplay muted> <source src="[url to your video]" type="video/mp4"> Your browser does not support the video tag. </video> </body> </html>
Comments
Post a Comment