Sunday, 4 December 2011

Play wav file using HTML

Here I am discuss about playing an audio file with HTML.For flexibility I am only introducing   play wav files.

You can see a demo here :-

The html code:
<audio controls="controls" autoplay="auto play">
<source src="ringin.wav" type="audio/wav">

The core of this code is <audio> tag.The 'controls' attribute is to display audio controls such as play/pause
button and mute button.If we don't include this tag the browser play
the wav file but there will be nothing displayed in the screen.
'autoplay' attribute specifies whether the audio file is play when load the page.If 'autoplay' doesn't set the audio file will not play since
the play button clicked.
   The <source> tag is used to specify the file to be played.'src' attribute is specify the wav file to be played.If the file is in the same location
as the html page we need to specify the name,otherwise the files location too.
The 'type' attribute is used to specify the type of audio file ,here 'audio/wav'.

I will be explain play a video using HTML in a coming post.
Hope that this post will be helpful to you.
By Sukesh B R.

No comments:

Post a Comment

Search This Blog