Module media

Module media 

Source
Expand description

Attribute names for media (<audio>, <video>) elements.

§Purpose

Media elements embed audio or video content with built-in playback controls. They support multiple sources, captions, and extensive playback control.

§Common Attributes

  • src: Media resource URL
  • controls: Show browser’s default playback controls
  • autoplay: Automatically start playback (often restricted by browsers)
  • loop: Restart playback when finished
  • muted: Start muted (required for autoplay in many browsers)
  • preload: How much to preload (none, metadata, auto)

§Example

<video src="movie.mp4" controls width="640" height="360" poster="thumb.jpg">
  Your browser doesn't support video.
</video>
<audio src="music.mp3" controls loop preload="metadata"></audio>
<video controls autoplay muted loop>
  <source src="video.webm" type="video/webm">
  <source src="video.mp4" type="video/mp4">
</video>

§WHATWG Specification

Constants§

AUTOPLAY
The autoplay attribute.
CONTROLS
The controls attribute.
CROSSORIGIN
The crossorigin attribute.
HEIGHT
The height attribute.
LOOP
The loop attribute.
MUTED
The muted attribute.
POSTER
The poster attribute.
PRELOAD
The preload attribute.
SRC
The src attribute.
WIDTH
The width attribute.