Exercise: A Podcast Episode Page

Build the page for a bike-repair podcast's episode, with an audio player, a transcript, a captioned video and a map, and let the tests check each part.

Journeyman · HTML · Updated

By

Sam and Priya host The Bike Shed, a made-up podcast about fixing your own bike. Episode 12, Fixing a Flat in Ten Minutes, is recorded, and they filmed a short clip of the repair too. They need its page: a player for the episode, the transcript, the video with captions so anyone can follow it, and a map of the workshop where they recorded. The page's text and styles are ready. You'll add the media, and tests tell you when each part works.

Get the exercise code

Open this lesson's GitHub repository, github.com/ask-codey/exercise-html-podcast-episode-page, also linked from the Exercise box beside the lesson. Clone it into a folder of your own. In a terminal, in that folder:

git clone https://github.com/ask-codey/exercise-html-podcast-episode-page.git

Git makes a folder, exercise-html-podcast-episode-page, with the exercise code inside.

The folder holds:

  • index.html: the episode page, with its text in place and four comments that mark what to add. For you to finish.
  • media/captions.vtt: the video's captions, with the first three cues. For you to finish.
  • media/: the episode's audio (bike-shed-ep12.mp3), the repair video (flat-fix.mp4) and its poster picture (flat-fix-poster.jpg). Ready to use.
  • style.css: a ready-made stylesheet, so the page looks good as you build it. You don't need to change it.
  • page.test.js and package.json: the tests. You don't need to change these.

Open the folder in VS Code, right-click index.html and choose Open with Live Server. Use Live Server, not a double-click: the captions file won't load in a page opened straight from a file.

What to do

Each comment in index.html says what goes in its section. For example, the one in the Listen section:

<!--
    1. The audio player.
       An <audio> element with controls that plays media/bike-shed-ep12.mp3 (its type is audio/mpeg).
       Inside it, a fallback: a link that downloads media/bike-shed-ep12.mp3.
-->
  1. The audio player: the episode, with the browser's controls and a fallback download link.
  2. The transcript: the three paragraphs already on the page, in a section that stays closed until someone opens it.
  3. The video: the repair clip with controls, its poster, a width and height, a captions track in English that's on from the start, and a fallback link.
  4. The captions: media/captions.vtt has the first three cues. The README gives the words and times of the last three; add them.
  5. The map: the workshop's map in a titled iframe that loads only when someone scrolls near it, and a plain link to the full-size map under it. The README gives both addresses.

Check your work

Open a terminal in VS Code (Terminal > New Terminal). The first time, install the test tools:

npm install

Then run the tests whenever you like:

npm test

At first, seven of the nine tests fail. That's expected: each part you finish turns its test green. A failing test's message says what it looked for, for example Give the <track> a label, such as label="English", for the captions menu. The last test runs the page through an HTML validator and lists any line it finds a problem on.

Then try the page by hand in the browser. The README has a checklist: play the audio with the keyboard alone, open and close the transcript, watch all six captions appear, and scroll down to the map.

Hints

  • Boolean attributes stand alone. controls, default and the others are on when they're there. You met them in Video and Audio.
  • Order inside the video matters. <source> first, then <track>, then the fallback.
  • A cue is three parts. A number, a timing line with --> between the times, and the words, then a blank line. Look at the first three cues, and at Captions and Subtitles.
  • A period, not a comma. WebVTT writes 00:00:11.000. A comma there makes the browser skip the cue without a word.
  • Say what the map shows. The iframe's title is what a screen reader announces; Embedding Maps and Videos with iframe has an example.

When you're done

Every test is green:

✔ the page says its language and has a title
✔ the audio player has controls and plays the episode
✔ the audio has a fallback link that downloads the episode
✔ the transcript opens and closes
✔ the video has controls, a poster, a width and a height
✔ the video has a captions track with a language and a label
✔ the captions file is WebVTT with six cues
✔ the map is a titled iframe that loads lazily
✔ the page passes the HTML validator
ℹ tests 9
ℹ pass 9
ℹ fail 0

Now turn off your sound and watch the repair video with only the captions. Could you fix a flat from them? If a step is missing, a deaf viewer would miss it too.

Submit your exercise

The exercise is how you finish this lesson. When your work is done, put it on GitHub in a repo of your own, then submit that repo's address here. You don't need Git for this: you upload your files in the browser, as the lesson Put Your Work on GitHub (Module 1) shows screen by screen.

  1. On GitHub, click +, then New repository. (No account yet? Sign up at github.com: it's free.) Name it (for example exercise-html-podcast-episode-page), choose Public, turn Add README on so the upload button appears, and click Create repository. Your folder's own README replaces GitHub's when you upload it.

  2. Choose Add file, then Upload files. In your exercise folder, select everything (Ctrl+A, or Cmd+A on a Mac), then Ctrl+click (Cmd+click on a Mac) the node_modules folder to leave it out, and drag the rest onto the upload area. Drag what's inside the folder, not the folder itself, so index.html lands at the top of your repo.

    Why leave out node_modules? It isn't your work: it's the more than two thousand files npm install downloaded for the tests, far more than GitHub's upload takes at once, and npm install makes it again whenever it's needed.

  3. Under Commit changes, type a short note, such as My solution, and choose Commit changes.

  4. Paste your repo's address, such as https://github.com/your-name/exercise-html-podcast-episode-page, into Submit your exercise on this page. The site checks that the repo is public and holds your commits, and then the lesson is complete.

Changed something after you submitted? Upload the changed files again (each one replaces the file with the same name), commit, and submit again: your latest submission is the one that counts.

So what

A podcast or a video reaches more people when it has a transcript, captions and a page that loads fast. The same few elements put any recording online: a band's demo, a lecture, a product video for a shop.

Key terms

Related