Playing audio files
The audio element enables a simple way to play audio files in the browser. Adoption of this element had many controversial discussions mostly due to the lack of common grounds for a format. Initially Ogg Vorbis (http://www.vorbis.com/) was the format suggested in the W3C specification.
Note
Up-to-date information on browser support for different formats can be found on www.caniuse.com
.
In this recipe, we will take a look at the element and some of the basic attributes that can be applied on it.
Getting ready
In order to play an audio we need an actual audio file. You can pick one on your own or use the one that comes with the example. The file will be served from the music folder. We will use Mozart—Clarinet Concerto in A K. 622, II. Adagio by Jason Weinberger & the WCFSO available at the free music archive http://freemusicarchive.org/music/Jason_Weinberger__the_WCFSO/Jason_Weinberger__the_Waterloo-Cedar_Falls_Symphony_Orchestra/.
The file is of type .mp3
, but for the purpose...