This page might help… https://stackoverflow.com/questions/9346579/how-can-i-tell-when-an-html5-audio-element-has-finished-playing
…also… https://howlerjs.com …might be an option, which has the “onend” function… https://github.com/goldfire/howler.js#options
Searching the forums might help too. Like this…
…which shows this…
…and this…