Wednesday, 15 July 2015

HTML5 Audio Tutorial

The HTML audio tutorial is employed to defines sound or audio files, such as music or other audio streams. Almost all the major browser use this element. Audio tag is new in HTML5.
To implement the audio you should use audio tag i.e. <audio control> </audio>
Any content between the opening and closing <audio> is fallback content and this content is displayed only by browsers that don’t support the <audio> tag.

Example:

<audio controls>
<source src=”http://fullyhelp.com/tag/wp-content/uploads/2013/11/Maid-with-the-Flaxen-Hair.mp3″ type=”audio/ogg”>
<source src=”http://fullyhelp.com/tag/wp-content/uploads/2013/11/Maid-with-the-Flaxen-Hair.mp3″ type=”audio/mpeg”>
</audio>

Output:

Browser Compatibility:

Browser .mp3 .wave .ogg
Mozzila Firefox 3.6
Opera 10.6
Chrome 8
Safari 5.0

Standard Attributes:


Attribute Value Description
src url It specifies the URL of your audio file
id id It defines unique id for an element.
class classname It defines the element class name.
lang URL It Sets the language code.
control Boolean attribute It defines that you need this to make the native audio player appear. Otherwise, you would have to use DOM to control the audio element to play your music.

No comments:

Post a Comment