Horje
How to create HTML <video> player Autoplay

To start a video automatically, use the autoplay attribute:


Example of HTML <video> player Autoplay

Follow the Example
index.html
Example: HTML
 <video width="320" height="240" autoplay>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video> 

Full Example of HTML <video> player Autoplay

Follow the Example
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<video width="320" height="240" autoplay>
  <source src="https://www.w3schools.com/html/movie.mp4" type="video/mp4">
  <source src="https://www.w3schools.com/html/movie.mp4" type="video/ogg">
  Your browser does not support the video tag.
</video>

</body>
</html>

Output should be:

Full Example of HTML <video> player Autoplay

Note: Chromium browsers do not allow autoplay in most cases. However, muted autoplay is always allowed.

Add muted after autoplay to let your video start playing automatically (but muted):
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<video width="320" height="240" autoplay muted>
  <source src="https://www.w3schools.com/html/movie.mp4" type="video/mp4">
  <source src="https://www.w3schools.com/html/movie.mp4" type="video/ogg">
  Your browser does not support the video tag.
</video>

</body>
</html>

Output should be:






Category:
Web Tutorial
Sub Category:
HTML Video
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference