Sunday, September 4, 2011

HTML 5 audio element

HTML 5 facilitates a standard way to play audio file. As of now following audio formats are supported.
  • ogg
  • mp3
  • wav
Format:
<audio> </audio>

Attributes:

src - url of the audio file to play
autoplay - starts the audio as soon as it is ready to play
controls - whether to show controls or not
loop - repeats the play when it finishes
preload - load the audio file with page load.

Example:

<audio controls="controls">
  <source src="song.ogg" type="audio/ogg" />
  <source src="song.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>  


0 comments:

Post a Comment

 
  • Blogroll

  • Consectetuer

  • Popular

  • Comments