1.

Explain <video> in HTML.

Answer»

To embed any kind of video in the web page, <video> tag is used. We need to use <source> tag inside the <video> tag to specify which file to upload. It will then contains the src attribute. Any kind of video could be uploaded like a song video, or a short story video or an EDUCATIONAL video, etc.

The important thing to note is that the video needs to be there on your web-server, or in your local drive if testing locally.

There are many attributes to the video tag like controls, autoplay, muted, loop.

  • controls will show a basic youtube like CONTROL buttons in the media player.
  • autoplay will begin the play as soon as the page is loaded.
  • muted will play the video without volume.
  • loop will play the video in the loop and will RUN forever.
<!DOCTYPE html> <html> <head>    <title>Video Demo</title>    <style>        .grid__iframe {            DISPLAY: grid;            place-content: center;        }    </style> </head> <body>    <div class="grid__iframe">        <video controls autoplay muted loop>            <source src="flower.mp4" type="video/mp4">            <source src="flower.webm" type="video/webm">            <p>Your browser doesn't support HTML5 video.</p>        </video>    </div> </body> </html>

For the above to work, you should have a flower.webm or flower.mp4 in the same directory as demo.html



Discussion

No Comment Found