~/TechPurAI
~/tutorials/html-from-scratch/multimedia-audio-and-video
beginner·part 12 of 22·3 min read

Multimedia: the audio and video elements

Updated Aug 16, 2026HTML

Before HTML5, embedding video or audio required a third-party browser plugin (Flash, most commonly) — genuinely fragile, insecure, and eventually deprecated entirely. <video> and <audio> are native HTML elements that solved this properly. This part covers using them for real content, with the details that are easy to skip.

A real video: Bright Leaf Coffee's roasting process

html
<video controls width="800" height="450" poster="/images/roasting-poster.jpg">
  <source src="/videos/roasting-process.mp4" type="video/mp4" />
  <source src="/videos/roasting-process.webm" type="video/webm" />
  <track
    kind="captions"
    src="/captions/roasting-process-en.vtt"
    srclang="en"
    label="English"
    default
  />
  <p>
    Your browser doesn't support embedded video.
    <a href="/videos/roasting-process.mp4">Download the video</a> instead.
  </p>
</video>

A real audio example

html
<audio controls>
  <source src="/audio/founder-interview.mp3" type="audio/mpeg" />
  <source src="/audio/founder-interview.ogg" type="audio/ogg" />
  Your browser doesn't support embedded audio.
  <a href="/audio/founder-interview.mp3">Download the audio</a> instead.
</audio>

The same real principles apply — multiple source formats, a genuine fallback for unsupported browsers, and (for spoken audio content) a real transcript linked nearby, since <audio> has no direct captions equivalent the way <video> does with <track>.

Why it matters

Captions and transcripts aren't only for visitors who are deaf or hard of hearing — they're also what makes video and audio content genuinely indexable by search engines, which can't watch or listen to media directly. A real transcript of the founder interview above is real, crawlable text content in a way the audio file itself never can be, directly connecting back to why AI-SEO (covered in part 16) increasingly favors pages with substantive text alongside any media.

autoplay and muted: use with real restraint

html
<!-- a real, deliberately muted decorative background video -->
<video autoplay muted loop playsinline>
  <source src="/videos/coffee-pour-loop.mp4" type="video/mp4" />
</video>

Browsers block autoplaying video with sound by default — a real, deliberate anti-annoyance policy, not a bug. autoplay only reliably works when paired with muted, and should be reserved for genuinely decorative, ambient content like a silent looping product shot — never for content with real information a visitor actually needs to hear, since forcing sound on an unsuspecting visitor is a real, well-documented usability complaint. playsinline prevents the video from automatically expanding to fullscreen on mobile, appropriate for this kind of small decorative loop.

Real file size is a real performance concern

Video is, by a wide margin, the heaviest media type a page can include — an uncompressed or overly high-bitrate roasting-process video can single-handedly dominate a page's total load weight, directly undermining the Core Web Vitals concerns raised back in part 6. Real production video should be compressed appropriately for web delivery before it's ever linked from <source>, a genuine pre-upload step, not something the <video> tag itself handles.

Next: embedding third-party content — <iframe>, YouTube embeds, and the real security considerations that come with letting another site's content run inside your own page.

VK

Vijay Kumar

Founder of TechPurAI — writing hands-on tutorials and honest tool breakdowns.

LinkedIn ↗
← previous11. Forms deep dive: validation, fieldsets, and a real accessible checkout formnext →13. Embedding third-party content safely: the iframe element