Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Multimedia – Audio and Video | HTML Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. HTML Course

Lesson 10 of 55

·HTML

Multimedia – Audio and Video

11 min

Course progress18%

What you'll learn

Keep these ideas in mind as you work through the lesson.

5 points
  • Audio and video element basics and required child `<source>` elements
  • Multiple source formats for broad compatibility
  • Native controls and attributes (`autoplay`, `muted`, `preload`)
  • Providing captions (`<track kind='captions'>`) and audio descriptions for accessibility
  • Adaptive streaming basics (HLS/DASH) for large media assets

Embedding Media

<video controls width='640'>
  <source src='movie.mp4' type='video/mp4' />
  <source src='movie.webm' type='video/webm' />
  <track kind='captions' src='captions.vtt' srclang='en' label='English' default />
  Your browser does not support the video tag.
</video>

<audio controls>
  <source src='song.ogg' type='audio/ogg' />
  <source src='song.mp3' type='audio/mpeg' />
  Your browser does not support the audio element.
</audio>

Attributes

  • controls – Adds native playback UI (play/pause, volume, timeline).
  • autoplay, loop, muted – Additional behaviours; use sparingly to avoid unexpected media playback.
  • preload – metadata (default), auto, none. Setting metadata loads only duration and dimensions.
  • <track> – Provides subtitles, captions, descriptions, chapters, or metadata for video/audio.
  • crossorigin – Required when fetching media from a different origin and you intend to use the MediaElement API.

Accessibility

  • Always supply captions for video (kind='captions').
  • Provide a textual description for audio when the content conveys essential information (e.g., a podcast).
  • Use the aria-label or <track kind='descriptions'> for describing visual content to screen readers.

Adaptive streaming (advanced)

  • Use <source> with HLS (.m3u8) or DASH (.mpd) for adaptive bitrate streaming.
  • Include multiple qualities so the browser picks the best one based on network conditions.

Quick checklist for media

  1. Captions (<track kind='captions'>) provided for video? ✅
  2. preload='metadata' used for non‑critical media? ✅
  3. Native controls present (controls attribute)? ✅
  4. Multiple source formats (mp4, webm, ogv) offered? ✅
  5. Autoplay avoided unless user‑initiated? ✅

Tip: Test with the Captions preference in the OS and ensure captions appear and sync correctly.

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from HTML CourseBrowse activities
Previous lessonAccessibility – ARIA Roles and LabelsContinue to lesson 11Embedding External Content – iframe, embed, objectBack to HTML Course curriculum