HTML allows playing video in the web browser by using the <video> tag. To embed the video in the webpage, we use the src element for mentioning the file address, and width and height attributes are used to define its size.
Approach: To make this feature, we are using <video> tag to add a video to the web page. The video tag uses width, height, and control attributes to set and control the video on the web page. Also, use the source tag with the src attribute to add a source of the video.
Example: In this example, we are using the above-discussed approach.
html
<!DOCTYPE html>
<html>
<body style="text-align: center">
<h1 style="color: green">GeeksforGeeks</h1>
<h2>How to insert video and play in HTML</h2>
<p>Adding Video on my Webpage</p>
<video width="500px" height="500px" controls="controls">
<source src="vid.mp4" type="video/mp4" />
</video>
</body>
</html>
|
Output:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!