My catindex.htmlGrey cat0:000:001<!DOCTYPE html>2<title>My cat</title>3<img src="cat.jpg" alt="Grey cat">4<audio src="purr.mp3" controls>5</audio>6<video src="cat.mp4" controls>7</video>cat.jpgJPEGpurr.mp3MP3<imgelement namesrc="cat.jpg"source: which filealt="Grey cat">text if no image<audioelement namesrc="purr.mp3"source: which filecontrols>no value: oncat.mp4MP4cat.jpgpurr.mp3cat.mp4controls
Front: the HTML file (text only) and the three media files it points atBack: the browser, which loads each file and draws it on the pageChips: a file's name travelling to its file, then the file travelling into the pageFront left: index.html, seven lines of HTML on a card, and one media tag taken apart. Front right: three separate media files, cat.jpg, purr.mp3 and cat.mp4. Back: a web browser. For each media line a name chip hops from the line to its file, then the file hops into the browser and appears where its tag stands: a picture, an audio player, a video player. When play is pressed, the rest of cat.mp4 keeps arriving in small pieces while the video runs. The figure loads one file per step so you can follow it. A real browser starts loading each media file as soon as it reads the tag, often all three at nearly the same time.

Media are files

  1. An HTML file holds only text. Pictures, sounds and videos are called media, and each one is a separate file: here cat.jpg, purr.mp3 and cat.mp4, saved in the same folder as index.html. The HTML says which file goes where.

Pictures

Sound and video

What happens

;; step 1/9 · media-files
index.html   text: 7 lines of HTML
cat.jpg    image, its own file
purr.mp3   sound, its own file
cat.mp4    video, its own file
folder     all four files side by side
the HTML   points at each media file by name

The figure loads one file per step so you can follow it. A real browser starts loading each media file as soon as it reads the tag, often all three at nearly the same time. Images, audio and video sit in a line like very large words, so the picture and the audio player share a row until there is no room left. CSS can change that.