This article is Ready to Use.
The audio element (<audio>) is used for playing audio files and may display a minimal media player user interface.
Extensive documentation on manipulating the element may be found on the HTMLAudioElement page.
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 video, 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.
Instructs the UA to link multiple videos and/or audio streams together.
src= URL potentially surrounded by spaces
The URL for the audio stream.
Authors should ensure that the information and user interface components must be presentable to users in ways they can perceive (WCAG 2.0 - Principle 1: Perceivable). This includes providing alternatives for time-based media Guideline 1.2.
Formats and Codecs
The specification does not require a specific audio codec to be supported by all user agents. Using both Ogg/Vorbis and MP4/AAC seems to cover most user-agents, however. See the Audio format support on Wikipedia.
Features Chrome Firefox Internet Explorer Opera Safari Basic support autoplay attribute buffered attribute controls attribute loop attribute muted attribute played property preload attribute src attribute volume attribute
Features Android Firefox Mobile IE Mobile Opera Mobile Safari Mobile Basic support autoplay attribute buffered attribute controls attribute loop attribute muted attribute played property preload attribute src attribute volume attribute
View live exampleplay a mp3 on webpage
<audio controls src="http://freedownloads.last.fm/download/533190714/she%2Bso%2Bfly.mp3" type="audio/mp3"> </audio>
|HTML 5.1||W3C Working Draft|
|HTML 5||W3C Recommendation|