The <audio>
element
Creates an audio player in the web page, for playing MP3 or other audio files.
Full list of attributes
All the usual HTML global attributes are available
autoplay
- If present, indicates that the browser should start playing the sound as soon as it's ready to, without the user explicitly choosing to play it.
controls
- If there are no custom playback controls provided by JavaScript code, then this should be used to make the browser provide some controls itself.
crossorigin
- A CORS settings attribute for audio files from third party sites.
loop
- Makes the audio play in a continuous loop.
mediagroup
- Multiple
<audio>
and<video>
elements can be linked together by giving them the samemediagroup
name. The browser will synchronize their playback. muted
- If present, the audio will be muted by default.
preload
- Hint to the browser about how aggressively it should start downloading the audio file before it's actually needed.
src
- The URI of the audio file to load.