Attribute | HTML | JavaScript | What It Specifies |
---|---|---|---|
autoplay | autoplay | true, false | That the audio will start playing as soon as it is ready |
controls | controls | true, false | That audio controls should be displayed |
duration | N/A | Floating-point number | The length of the audio recording in seconds |
ended | N/A | true, false | Whether the playback has completed |
id | "name" | The name used to reference the audio element | |
loop | loop | true, false | That the audio will continually restart when it finishes |
muted | muted | true, false | Whether the sound of the audio should be off (muted) |
paused | N/A | true, false | Whether the sound should be temporarily stopped |
preload | auto, metadata, none | auto, metadata, none | How the audio should be loaded when the web page containing it loads |
src | "URL" | "URL" | The location of the audio file using a character string |
volume | N/A | Floating-point number | The level of sound between 0 and 1 (for example, .5) |