So far in this chapter, we’ve focused on visual media with images. Now it’s time to move on to audio media. In this section, you’ll learn how to implement an audio player with the
Prior to HTML5, end users had to install a plug-in to play sound from a web page. Now there’s no need for that. Today’s browsers include a built-in audio player that’s used in conjunction with the
audio element. Here’s a simple
audio element example:
<audio src="../audio/witchesCackle.mp3" preload="auto" controls> </audio>
Note that the
audio element requires a start tag and an end tag, even though there’s no content between the tags. Later you’ll see an example where there is content between the tags.
audio Element Attributes
In the prior ...
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.