Audio

This HTML element embeds sound content in documents.

An audio element may contain one or more sound sources, of which the "best" one will be chosen by the browser.

MediaStreams can use this element as a destination for streamed media.

Content inside the audio tag is displayed for browsers that do not support the audio element.

Attributes

  • the global attributes
  • autoplay
  • controls
  • controlslist
  • crossorigin
  • disableremoteplayback
  • loop
  • muted
  • preload
  • src

Events

  • audioprocess
  • canplay
  • canplaythrough
  • complete
  • durationchange
  • emptied
  • ended
  • loadeddata
  • loadedmetadata
  • loadstart
  • pause
  • play
  • playing
  • ratechange
  • seeked
  • seeking
  • stalled
  • suspend
  • timeupdate
  • volumechange
  • waiting

Usage notes

Not all browsers support all audio formats; use source elements to offer options and fallbacks. The browser will choose the first one it understands.

The audio player will only display the browser's default controls if the controls attribute is present.

The HTMLMediaElement API can be used to define custom controls.

HTMLMediaElement events provide fine-tuned control over playback. This can be useful for context-sensitive interactions.

The Web Audio API can be used to create and modify audio streams using JavaScript. This can be useful as an alternative to pre-recorded audio.

Use the video tag if recent_careerSrt are desired.

See also

Learn more