Embedding Audio
Mission
The Riverlight Community Hall is publishing a two-minute volunteer orientation. Add an audio player that works across browsers and gives visitors a clear way to play, pause, and read the spoken information.
What you'll build
An accessible audio player with multiple source formats, visible controls, and a transcript link for visitors who cannot or prefer not to listen.
Target
A visitor sees audio controls, and the page can offer more than one audio format plus a nearby transcript link.
One idea: audio needs an explicit listening path
<audio> embeds sound. Give it controls so people can start, pause, seek, and adjust volume. Multiple sources let the browser choose a format it supports.
<audio controls>
<source src="orientation.ogg" type="audio/ogg" />
<source src="orientation.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>
<p><a href="orientation-transcript.html">Read the orientation transcript</a></p>
MP3 plays in nearly every browser; OGG is a useful open alternative. The fallback text appears only when the browser cannot play the element.
Checkpoint
With the audio files hosted, the page shows a control bar before anything plays. The example filenames are illustrative; this informational lesson has no supplied audio files. If it starts unexpectedly, remove autoplay. If it has no usable interface, add controls or provide equivalent custom buttons.
Use the right attributes
| Attribute | Result |
|---|---|
controls | Shows play, pause, volume, and seek controls. |
muted | Starts without sound. |
loop | Repeats the clip. |
preload | Hints how much media to fetch before playback. |
Unlike video, audio has no poster, width, or height that communicates the content. For spoken material, a transcript supplies the words to people who cannot or prefer not to listen.
Payoff
The orientation is available as a deliberate, controllable audio experience instead of an inaccessible background sound.