Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5 audio currentTime doesn't work

I don't know why but it doesn't work. I have this:

function stop()
{
  audio.pause();
  audio.currentTime = 0;
}

When I change the value of currentTime to 0, nothing changes...that is, currentTime continues having the previous value.

like image 321
Daniel Garcia Sanchez Avatar asked Sep 18 '25 02:09

Daniel Garcia Sanchez


1 Answers

I solved it:

audio.pause();
audio.src = audio.src;

It reload the audio tag, and set currentTime to 0

like image 59
Daniel Garcia Sanchez Avatar answered Sep 20 '25 16:09

Daniel Garcia Sanchez