The source Element

The source element provides the browser with a choice of video formats.

 
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
      <video controls width="360" height="240">
            <source src="yourVideo.webm" />
            <source src="yourVideo.ogv" />
            <source src="yourVideo.mp4" />
            Video cannot be displayed
      </video>
</body>
</html>
  
Click to view this demo.

You can provide a hint to the user by applying the type attribute to the source element, specifying the MIME type of the file.

 
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
      <video controls width="360" height="240">
            <source src="yourVideo.webm" type="video/webm" />
            <source src="yourVideo.ogv" type="video/ogg" />
            <source src="yourVideo.mp4" type="video/mp4" />
            Video cannot be displayed
      </video>
</body>
</html>
  
Click to view this demo.
Home 
  HTML CSS Book 
    HTML  

video:
  1. Using the video Element
  2. Preloading the Video
  3. Displaying a Placeholder Image
  4. Setting the Video Size
  5. Specifying the Video Source (and Format)
  6. The source Element
  7. The track Element
Related: