Open In App

How to add video in HTML5 ?

Last Updated : 29 May, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

In This article, we will define how to add video content using a <video> element in the document. Before HTML5 came into existence, videos could only be played in a browser using a plugin like flash, but after the release of HTML5, adding a video to a web page is easy as adding an image. The HTML5 “video” element specifies a standard way to embed a video in a web page. There are three different formats that are commonly supported by web browsers – mp4, Ogg, and WebM. The table below lists the formats supported by different browsers:

Syntax: 

<video src="" controls></video>

Example:




<!DOCTYPE html>
<html>
  
<head>
    <title>
        Define a Video or move?
    </title>
</head>
  
<body>
    <h2>
        GeeksForGeeks
    </h2>
    <h2>
        HTML5: How to define 
        a Video or Movie?
    </h2>
  
    <p>
        Adding Video on my webpage
    <p>
        <video width="400" height="350" controls>
            <source src="myvid.mp4" type="video/mp4">
            <source src="myvid.ogg" type="video/ogg">
        </video>
</body>
  
</html


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

 


Like Article
Suggest improvement
Share your thoughts in the comments