HTML5 Audio Element

The [fairly] new HTML5 spec has brought many favours to web developers – two of the most high profile additions to the HTML spec are the Audio and Video elements.  They both have caught my attention because of the simplicity they have brought to introducing rich media to any website.  For this post I will focus on the new Audio element.

Since most of us have had connection to the internet there have been many different ways to integrate audio (usually music) to websites – before Adobe Flash these used to be in the form of a proprietary plugin (e.g. Microsoft’s Windows Media Player). Thankfully this new standard removes the need for these. Now you can simply add this to your markup and have a cross browser audio track.

The browser will take the first supported source element or will otherwise display the “Fallback content” (this includes browsers that do not support the audio element). The “controls” attribute will mean user player controls are displayed. There are various other attributes worth exploring at http://www.w3schools.com/html5/html5_audio.asp.