Html5 Audio Tag

HTML5 is provides to standard for playing audio still now never standard audio player for the web page.which audio player is use to insert audio file into a document.The audio tag can play sound files or an audio stream.

Example Code

<!DOCTYPE HTML>
<html>
<body>
<audio controls="controls">
  <source src="mp3-format.ogg" type="audio/ogg" />
  <source src="mp3-format.mp3" type="audio/mpeg" />
   Your browser does not support the audio element.
</audio>
</body>
</html>

Out Put :





Screen Shot :

The controls attribute tag is used to adding play, pause and volume controls.The audio tag allows can insert multiple source elements. Source elements can link to different audio files.

Attribute :

  • Autoplay : when you comming in this page the audio will buffer and plays immediately.
  • Controls : Adds playback controls.
  • loop : when audio is finished playing it will use to replays the audio.
  • preload : It is use to when you come to this page it audio will finish buffer but does not play the audio.
  • Src : Audio file to specifies the URL.




Content