HTML5 Primer: How To Use the Audio Tag

“In our series on HTML5, we’ve discussed geolocation, link
relations, form and keyboard events, media events, mouse events,
global attributes and multimedia. This week we’re going to expand
upon our discussion on multimedia and delve further into HTML5’s
audio tag.

“The audio tag is new to HTML, like the video tag, and allows
developers to embed music on their websites (and unlike earlier
attempts to add audio to a website, it isn’t limited to
old-fashioned midi music). That said, it does have limitations on
the types of files that can be used. Currently any recent browser
that is based on Webkit, such as Chrome and Safari, supports the
use of regular .mp3 files. Others, such as Firefox, only support
the .ogg format.

“The good news is that you can either convert your files from
.mp3 to .ogg (one audio conversion tool, media.io, can be used
online) or just supply two versions of your audio file, one in each
format. When Safari, for instance, comes across the audio tag, it
will ignore the .mp3 file and move directly to the .ogg file.”


Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis