jump

HTML 5: The Markup Language (ARIA Edition)

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 = d:string "autoplay" or d:string "" #
Instructs the UA to automatically begin playback of the audio stream as soon as it can do so without stopping.
preload = d:string "none" or d:string "metadata" or d:string "auto" or d:string "" #
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 = d:string "controls" or d:string "" #
Instructs the UA to expose a user interface for controlling playback of the audio stream.
loop = d:string "loop" or d:string "" #
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 = d:string "muted" or d:string "" #
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 {};