Saturday, February 11, 2012

Play audio in HTML 5


Play audio in HTML 5
 
Until now, there has not standard for playing audio files on a web page. Today, most audio files are played through a plug-in (like flash). However, different browsers may have different plug-ins. And it’s a great problem.
HTML5 defines a new element which specifies a standard way to embed an audio file on a web the <audio> element. Till now there are three types of audio file( MP3, Wav, and Ogg) that can able to play in web.

<audio controls="controls" height="200" width="500">
  <source src="abc.ogg" type="audio/ogg" />
  <source src="xyz.mp3" type="audio/mpeg" />
</audio>

Audio tag takes one attribute that  is “controls” and display some audio control(like volume control etc)
The height width control specify height and width of audio frame.

No comments:

Post a Comment