jump

HTML: The Markup Language (an HTML language reference)

audioaudio stream NEW # T

An audio element represents an audio stream.

Permitted contents #

Transparent, with the following specific structure:

a src attribute, or zero or more source elements followed by zero or more track elements, followed by flow content

or

a src attribute, or zero or more source elements followed by zero or more track elements, followed by phrasing content

Permitted attributes #

global attributes
Any attributes permitted globally.
autoplay = "autoplay" or "" (empty string) or empty #
Instructs the UA to automatically begin playback of the audio stream as soon as it can do so without stopping.
preload = "none" or "metadata" or "auto" or "" (empty string) or empty #
Represents a hint to the UA about whether optimistic downloading of the audio stream itself or its metadata is considered worthwhile.
  • "none": Hints to the UA that the user is not expected to need the audio stream, or that minimizing unnecessary traffic is desirable.
  • "metadata": Hints to the UA that the user is not expected to need the audio stream, but that fetching its metadata (duration and so on) is desirable.
  • "auto": Hints to the UA that optimistically downloading the entire audio stream is considered desirable.
Specifying the empty string is equivalent to specifying the value "auto".
controls = "controls" or "" (empty string) or empty #
Instructs the UA to expose a user interface for controlling playback of the audio stream.
loop = "loop" or "" (empty string) or empty #
Instructs the UA to seek back to the start of the audio stream upon reaching the end.
mediagroup = string #
Instructs the UA to link multiple videos and/or audio streams together.
muted = "muted" or "" (empty string) or empty #
Represents the default state of the audio stream, potentially overriding user preferences.
src = non-empty URL potentially surrounded by spaces #
The URL for the audio stream.

Additional constraints and admonitions #

Tag omission #

An audio element must have both a start tag and an end tag.

Permitted parent elements #

any element that can contain phrasing elements, any element that can contain flow elements

DOM interface #

[NamedConstructor=Audio(),
 NamedConstructor=Audio(DOMString src)]
interface HTMLAudioElement : HTMLMediaElement {};