Stop playback in HTML5 audio using Javascript


Read {count} times since 2020

You may wanted to stop playback of an audio playing via audio HTML5 tag.
Here is the code :

document.getElementById(‘audio’).currentTime = 0;//By ID
document.getElementsByTagName(‘audio’).currentTime = 0;//By Tag

It’s that simple. Just use currentTime = 0.

Show Comments