The simplest solution is to just reset the audio currentTime
and ensure it’s playing using the play()
method. Checking if the audio is playing is not necessary as subsequent play()
invocations will not do anything.
audio.currentTime = 0;
audio.play();