Add an audio element with controls.
Acceptance criteria
- 1.Add an audio element with controls.
HTML Tutorial · HTML Images and Media
These 10 tasks go with the HTML Audio chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “HTML allows you to add audio content directly to web pages using the element. You can embed music, podcasts, sound effects, or any audio file without relying on third-party plugins. The element supports multiple audio formats, offers controls, and can play automatically or loop based on your settings.” .
1.Add an audio playerexercise · easy · 10 min
Add an audio element with controls.
Passes when: Add an audio element with controls.
2.Offer two formatsexercise · easy · 10 min · practice plan
Add two source elements inside audio.
Passes when: Add two source elements inside audio.
3.Preload metadata onlyexercise · easy · 10 min · practice plan
Set preload to metadata.
Passes when: Set preload to metadata.
4.Loop the audioexercise · easy · 10 min · practice plan
Make the clip repeat.
Passes when: Make the clip repeat.
5.Add fallback textexercise · medium · 10 min · practice plan
Include a message for browsers without audio support.
Passes when: Include a message for browsers without audio support.
6.Fix the player with no controlsbug fix · easy · 8 min
Without controls the user cannot play anything.
Passes when: Without controls the user cannot play anything.
7.Fix the wrong elementbug fix · easy · 8 min · practice plan
Sound belongs in an audio element, not video.
Passes when: Sound belongs in an audio element, not video.
8.Fix the sources outside the playerbug fix · easy · 8 min · practice plan
Source elements must sit inside the audio element.
Passes when: Source elements must sit inside the audio element.
9.Fix the autoplay without controlsbug fix · easy · 8 min · practice plan
Autoplaying with no controls traps the listener.
Passes when: Autoplaying with no controls traps the listener.
10.Fix the wrong preload valuebug fix · easy · 8 min · practice plan
The value should be metadata, not meta.
Passes when: The value should be metadata, not meta.
Between them these tasks cover audio element, controls and Multiple sources.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.