/    /  HTML Video

HTML Video

 

HTML 5 supports video tag also. The HTML video tag is used used to show a video on a web page.

Supported for HTML video tag:

  • mp4
  • WebM
  • Ogg

 

HTML Video

 

Video Tag Example:

 

Play mp4 file using HTML video tag:

 

Example:

 

<!DOCTYPE>
<html> 
<body> 
<video controls> 
 <source src="movie.mp4" type="video/mp4">
</video> 
</body>
</html>

 

OUTPUT:

 

HTML Video

 

play ogg file using HTML video tag:

 

Example:

 

<!DOCTYPE>
<html> 
<body> 
<video controls> 
 <source src="movie.ogg" type="video/ogg">   
</video> 
</body>
</html>

 

 OUTPUT:

 

HTML Video

 

Supporting Browsers:

 

Fully supports the <video> element.

 

HTML Video

 

Attributes of HTML Video Tag:

 

controls – Displayed with play/pause buttons.

height – Height of the video player.

width – Width of the video player.

poster – Displayed on the screen when the video is not played.

autoplay – Start playing as soon as it is ready.

loop – Video file will start over again, each time when it is completed.

muted – Mute the video output.

preload – Upload video file when the page loads.

src – URL of the video file.

 

Example:

 

<!DOCTYPE>
<html> 
<body> 
<video width="320" height="240" controls autoplay loop> 
 <source src="movie.mp4" type="video/mp4">
</video> 
</body>
</html>

 

 OUTPUT:

 

HTML Video

 

MIME Types for HTML Video format:

 

Video Format             MIME Type

 

mp4                             video/mp4

ogg                              video/ogg

webM                          video/webM