Audio and Video Tag

Now Audio and Video tags that are used very much in HTML.

  • <audio> - The audio tag is new in HTML5 and used to define sound, like a music or other audio stream. Currently file format for audio MP3, WAV and OGG are supported.
    • USAGE:-
      • <audio controls>
          <source src="hello.ogg" type="audio/ogg">
          <source src="hello.mp3" type="audio/mpeg">
          Your browser does not support the audio tag.
        </audio>
  • <video> - The video tag is used to define video, such as a part of movie or video stream. The Support file format are MP4, WebM, and Ogg.
    • USAGE:-
      • <video width="520" height="340" controls>
          <source src="hero.mp4" type="video/mp4">
          <source src="hero.ogg" type="video/ogg">
          Your browser does not support the video tag.
        </video>
  • <source> - This tag is used to define multiple media resources for media element. The <source> tag is used in Audio, Video and Picture tag.
    • USAGE:-
      • <audio controls>
          <source src="hello.wav" type="audio/wav">
          <source src="hello.mp3" type="audio/mpeg">
          Your browser does not support the audio tag.
        </audio>
  • <track> - The <track> tag is used to specify subtitles, caption files or other files containing text, that should be visible when the media is playing.
    • USAGE:-
      • <video width="320" height="240" controls>
          <source src="forrest_gump.mp4" type="video/mp4">
          <source src="forrest_gump.ogg" type="video/ogg">
          <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
          <track src="subtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">

        </video>

More you may like to read