HTML Tag: audio
Audio stream.
source
elements can be used in an audio
element to point to alternative resources.
track
elements can be used to assign text tracks, such as transcriptions.
Any additional content is treated as fallback content, that is, content that a browser will call into play if the audio fails to work (if the resource isn’t found, or if the browser is too ancient to understand the audio
element, for example).
Optional Attributes
Attribute | Description | Possible values |
---|---|---|
src |
The location of the audio file to be used. | URL. |
preload |
How much the audio file should be buffered. |
|
autoplay |
Annoys the user by automatically playing the audio on loading. | None. |
loop |
Replays the audio once it has finished. | None. |
muted |
Mutes the audio resource by default. | None. |
controls |
Instructs the browser to apply its own in-built set of user controls (to stop, play, mute, etc.). | None. |
mediagroup |
Groups together several audio and/or video elements. Those elements sharing the same mediagroup value become part of the same group. |
Text. |
crossorigin |
Used in conjunction with JavaScript to determine how Cross Origin Resource Sharing requests are handled. |
|
Global attributes |
Example
<audio src="mrMurray_downCameTheRain.mp3" controls loop>
<p>La la la. I can't hear you.</p>
</audio>