audio tag support html5

html audio tag support

<audio controls="controls" src="html5.mp3"></audio>

Browser .mp3 .wav .ogg
Mozzila Firefox 3.6
Opera 10.63
Google Chrome 8.0
Apple Safari 5.0.3 (with QuickTime)
Microsoft IE 9 Beta

<audio controls="controls">
  <source src="html5.mp3" type="audio/mpeg"></source>
  <source src="html5.ogg" type="audio/ogg"></source>
</audio>

Attributes of audio

Attribute Value Description
controls *Boolean attribute 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.
autoplay *Boolean attribute If this guy exists, the browser will just play your song or your speech without asking permission from your visitor.
loop *Boolean attribute Keep repeating your music
src url The URL of your audio file
preload none | metadata | auto
This attribute was formerly known as "autobuffer" and it was an boolean attribute as "controls".


none - do not buffer audio file automatically.

metadata - only buffer the metadata of audio file.

auto - buffer audio file before it gets played.

<audio autoplay="true" controls="true" loop="true" src="html5.mp3"></audio> 

<audio autoplay="autoplay" controls="controls" loop="loop" src="html5.mp3"></audio>

<audio id="player" src="html5.mp3"></audio>
<div>
<button onclick="document.getElementById('player').play()">Play</button> 
<button onclick="document.getElementById('player').pause()">Pause</button> 
<button onclick="document.getElementById('player').volume += 0.1">Vol+ </button> 
<button onclick="document.getElementById('player').volume -= 0.1">Vol- </button> 
</div>


audio tag support html5 audio tag support html5 Reviewed by Bhaumik Patel on 11:49 PM Rating: 5