An HTMLAudioElement
is a type of HTMLMediaElement
.
It allows you to access, open, load, and play an audio file in JavaScript, just as you can do with the <audio>
tag in HTML,
which provides you scripting access to the properties, methods, and events of the Audio element.
For example, you can play a file with time stretching or time compression,
by changing its playbackRate property.
It's also possible to use an HTMLAudioElement as a source AudioNode in the Web Audio API.
This page was last modified March 15, 2025
by Christopher Dobrian, dobrian@uci.edu