---
source: https://iinventedlight.com/library/notes/html-audio-video.md
title: "HTML audio and video: embed media with controls, sources, and tracks"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (web.dev); CC-BY-3.0 (web.dev); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: web.dev, Audio and video; web.dev, Audio and video (source). CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-3.0 (https://raw.githubusercontent.com/GoogleChrome/web.dev/main/LICENSE). Copyright Google LLC. Except as otherwise noted, the content of this site is licensed under the Creative Commons Attribution 3.0 License."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: html-audio-video"
tags: [html, audio, video, track, poster]
client: Librarian
sources:
  - id: S1
    title: "Audio and video"
    publisher: web.dev
    url: https://web.dev/learn/html/audio-video
    accessed: 2026-11-26
    license: "CC-BY-4.0"
  - id: S2
    title: "Audio and video (source)"
    publisher: web.dev
    url: https://raw.githubusercontent.com/GoogleChrome/web.dev/main/src/site/content/en/learn/html/audio-video/index.md
    accessed: 2026-11-26
    license: "CC-BY-3.0"
---
# HTML audio and video: embed media with controls, sources, and tracks
**Answer:** Use video and audio to embed media. Prefer audio for sound-only files, and include controls, sources, and tracks.

## Elements and attributes

video can embed a sound file, but audio is the better element for sound-only media.

Both opening tags can take controls, autoplay, loop, mute, preload, and global attributes.

video also supports height, width, and poster.

Always include the boolean controls attribute. This makes the user controls visible. Users can control audio levels, mute the audio completely, and expand the video to fullscreen.

## Sources, posters, and tracks

Include one or more source elements, each with a src attribute to a media file, if no src attribute is included on the opening video or audio tags.

The poster attribute names an image that can show while the video is downloading.

If the video plays and is subsequently paused, the poster is not re-shown.

track elements add timed text; kind may be subtitles, captions, descriptions, chapters, or metadata.

## See also

- [html-document-structure](https://iinventedlight.com/library/notes/html-document-structure/)
- [html-dialog](https://iinventedlight.com/library/notes/html-dialog/)
- [html-forms](https://iinventedlight.com/library/notes/html-forms/)

## Claims

- id: C1
  claim: Prefer the audio element for sound files.
  source: S1
  evidence: "the <audio> element is preferable for embedding sound files."

- id: C2
  claim: Always include the controls attribute.
  source: S1
  evidence: "Always include the boolean controls attribute."

- id: C3
  claim: video also supports height, width, and poster.
  source: S2
  evidence: "width`, and `poster` attributes"

- id: C4
  claim: The track kind attribute has five enumerated values.
  source: S2
  evidence: "There are five enumerated values for the track `kind` attribute"

## Sources

- [S1] Audio and video. web.dev. https://web.dev/learn/html/audio-video . License: CC-BY-4.0. Accessed 2026-11-26.

- [S2] Audio and video (source). web.dev. https://raw.githubusercontent.com/GoogleChrome/web.dev/main/src/site/content/en/learn/html/audio-video/index.md . License: CC-BY-3.0. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: web.dev, Audio and video; web.dev, Audio and video (source). CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-3.0 (https://raw.githubusercontent.com/GoogleChrome/web.dev/main/LICENSE). Copyright Google LLC. Except as otherwise noted, the content of this site is licensed under the Creative Commons Attribution 3.0 License. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
