Attribute of
<audio>
What does <audio src=""> do?
Specifies the source file for an audio element.

Code Example

<audio src="/wp-content/uploads/flamingos.mp3" controls>

src vs. <source>

If you are only going to provide a single source file format for the audio element, use the src attribute. If you wish to provide multiple source file formats, place two or more <source> elements inside the <audio> element.

Values of the src Attribute

Value Name Notes
url The URL of the audio file.

All Attributes of audio Element

Attribute name Values Notes
volume 0.0–1.0 Specifies the initial volume setting of the audio element, in a range from 0.0 to 1.0.
preload none
metadata
auto
Requests a particular preload behavior to the browser, which the browser may or may not follow.
muted Specifies that the volume on the audio player should initially be muted.
loop Specifies that the audio content should loop indefinitely once playback has begun.
controls Toggles the display of audio playback controls.
autoplay Specifies that the audio playback should begin immediately on page load.
src url Specifies the source file for an audio element.