How to Unpause a sound file?

There is a function to pause a playing sound file.
But, how to unpause it?
Whenever I try to play it after pausing, it plays from the beginning, instead from where I paused it, contrary to reference document of pause().
I tried below commented out code.

function mousePressed() {
  if(mySound.isPlaying()){
    mySound.pause();
    curTime = mySound.currentTime();
  } else if(mySound.isPaused()){
    // amplitude = new p5.Amplitude();
    // mySound.jump(curTime);
    //mySound.loop();
    mySound.play();
  } else{
    mySound.play();
  }
  // console.log("mou")
}

Hi! welcome to the forum!

Did you try the example in the reference that you mentioned? It does work (resumes from where it was paused) for me.

Do you have a complete sketch to simulate the issue? Can you share the sound file? What version of p5.js (sound) are you using?

1 Like

Hi! Thanks for the response.
As suggested, I also tried the example in reference. It is not working for me.

Here is the link to my sketch.js.
Sound files can be found there too.
p5.js v1.2.0

ok I just noticed that it works on firefox but not on chrome. I think it’s something to do with the implementation of web audio api. maybe you can jump to the previous position to get around this problem
https://p5js.org/reference/#/p5.SoundFile/jump

2 Likes