How to use Audio In HTML5
In this article I have described the Audio in HTML5
INTRODUCTION
HTML5 the <audio> element enabling audio playback within the browser. Implementation of audio in web page or HTML page. When audio tag is not used, browser asks for plug-in or script for playing audio or music. It is a paired tag. We can take advantage of this now as nearly all of the major browsers it currently support Firefox, Google Chrome 6, Internet Explorer 9, Safari and Opera support the <audio> element.
Audio Formats and Browser Support:
Browser |
.MP3 |
.Wav |
.Ogg |
Firefox |
N |
Y |
Y |
Chrome |
Y |
Y |
Y |
Internet Explorer 9 |
Y |
N |
N |
Opera |
N |
Y |
Y |
Safari |
Y |
Y |
N |
There are following attributes in audio tag:
Autoplay : A boolean specifying whether the file should play as soon as it can..
Autobuffer : Attribute that specifies the start and end time of the buffered part of the file.
Controls : A boolean specifying whether the browser should display its default media controls.
Src : Specifying the content source.
Simple Example of Audio tag in HTML5
<html >
<head>
<title>Audio Tag </title>
</head>
<body>
<audio controls="controls">
<audio src="C:\Documents and Settings\All Users\Documents\My Music\Sample Music\New Stories (Highway Blues).wma" type="audio/ogg" />
</audio>
</body>
</html>
|
OUTPUT

play() — plays the audio
pause() — pauses the audio