Reference /Pin to ProfileBookmark

The audio tag, or Embed Audio element, embeds sound content into the document, using one or more src attributes to define the audio source file. The browser will choose the first source that it supports.

Syntax

Using the src attribute in a similar manner as the img tag, the path to the media file to embed is defined. Additional optional attributes can specify such things as automatically playing and looping the media. Any content inside the audio tag is displayed as a fallback for lack of browser support.

<audio controls autoplay src="audiofile.mp3">
  <p>Your browser does not support audio files.</p>
</audio>

Attributes

autoplay
If included, the audio will immediately begin playing as soon as enough of the file is loaded. This is a Boolean value.

controls
When present, the browser renders controls for audio playback, such as volume, pause/resume, etc.

controlslist
When specified, determines what is shown when the controls attribute is present. Allowed values are nodownload, nofullscreen, and noremoteplayback.

loop
When specified, the audio will replay from the beginning every time it finishes.

muted
When specified, the audio output will be muted.

preload
This tells the browser how the audio should be loaded when the page loads. Allowed values are auto, metadata, and none.

Browser Compatibilty

Demos

Have a code example of <audio>? Submit a codepen.io demo and we'll showcase it here

to submit a demo.
HTML
×

Success!

Help @reference spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with Github
about: ({
version: 0.1.7 BETA 2.4,
whats_new: article editor v2,
up_next: tip code demos,
coming_soon: embeddable tipping,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh

version: 0.1.5,
notes: added pins + new badge

version: 0.1.4,
notes: home refresh + tools
)...
recent_tips: (
tipper: @JohnDavis,
amount: 250 SATS,
source: article

tipper: @Megan0910,
amount: 1000 SATS,
source: article

tipper: @JohnDavis,
amount: 250 SATS,
source: article
)...