Friday, July 26, 2024

HTML Video

HTML5 provides the <video> tag for embedding video content directly into web pages. The src attribute specifies the video file's location, and additional attributes like controls, autoplay, and loop enhance user interaction and playback options. The <video> tag supports multiple video formats through nested <source> elements for cross-browser compatibility. Using <video> ensures that multimedia content is easily accessible and viewable within modern browsers.

Examples:

<video width="640" height="360" controls>

  <source src="video.mp4" type="video/mp4">

  <source src="video.webm" type="video/webm">

  Your browser does not support the video tag.

</video>

<video width="640" height="360" autoplay loop>

  <source src="video.mp4" type="video/mp4">

  <source src="video.webm" type="video/webm">

  Your browser does not support the video tag.

</video>


HTML Code:


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTML Tutorial</title>
</head>
<body>
    <h1>HTML Video</h1>
    <p>HTML5 provides a standard for embedding video content on web pages.</p>
    <pre>
        <video width="640" height="360" controls>
  <source src="video.mp4" type="video/mp4">
  <source src="video.webm" type="video/webm">
  Your browser does not support the video tag.
</video>
   
        &lt;video width="320" height="240" controls&gt;
            &lt;source src="movie.mp4" type="video/mp4"&gt;
            Your browser does not support the video tag.
        &lt;/video&gt;
    </pre>
<body>
</html>

The Output of the above code:


HTML Tutorial

HTML Video

HTML5 provides a standard for embedding video content on web pages.

        
    
        <video width="320" height="240" controls>
            <source src="movie.mp4" type="video/mp4">
            Your browser does not support the video tag.
        </video>