Little Web Hut

HTML5 Video Tutorial

Part 4 - Audio and Video

HTML5 Tutorial part 4

The following code is from the Video.

Audio Element <audio>

Audio can be added to a web page by using the audio element. The audio element has a start and an end tag. In this example, two source URLs are specified by using two source elements. The text that comes after the second source element will be displayed in browsers that do not support the audio element.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Example document</title>
  </head>
  <body>
    <audio controls>
      <source src="bell_audio.mp3" type="audio/mpeg">
      <source src="bell_audio.ogg" type="audio/ogg">
      Audio element not supported by your browser.
    </audio>
  </body>
</html>
Test It HTML5 Style

Video Element <video>

Video can be added to a web page by using the video element. The video element has a start and an end tag. In this example, two source URLs are specified by using two source elements. The text that comes after the second source element will be displayed in browsers that do not support the video element.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Example document</title>
  </head>
  <body>
    <video controls>
      <source src="bell_video.mp4" type="video/mp4">
      <source src="bell_video.ogg" type="video/ogg">
      Video element not supported by your browser.
    </video>
  </body>
</html>  
Test It HTML5 Style