Open In App
Related Articles

How to insert video in web page and play it using HTML ?

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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 the <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 1: 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="https://media.geeksforgeeks.org/wp-
                     content/uploads/20231020155223/Full-Stack-Development-_-
                     LIVE-Classes-_-GeeksforGeeks.mp4" type="video/mp4" />
       </video>
    </body>
</html>

                    

Output:

video


Last Updated : 04 Dec, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads