Minimum Browser Support:
HTML5 Audio
54.21%
Percentage of users who can view this feature (source: caniuse.com)
Leverages HTML5 audio for all game sounds and music.
Interactive music visualizer that leverages HTML5 audio for music playback.
if(Modernizr.audio){
//browser supports HTML5 Audio
//note the Modernizr.audio.* apis return
//"maybe", "probably" or an empty string
if(Modernizr.audio.mp3){
//browser supports the mp3 codec
}
else if(Modernizr.audio.ogg){
//browser supports the Ogg Vorbis codec
}
else if(Modernizr.audio.m4a){
//browser supports AAC codec
}
}Learn more about detecting feature support with Modernizr.
If the audio element in not supported in the browser, you can fallback to deploying the video via a plugin, such as the Adobe Flash Player. HTML5Rocks.com has a good article on implementing the HTML5 Audio tag with a Flash fallback.