DEV Community

Discussion on: Help with audio/.js

Collapse
 
bitdweller profile image
Pedro Pimenta

Hi there!

To begin with and for the next time, it's best if you put the actual code on a working (or failing, or semi-working, etc...) example, something like JSBin or Codepen.io, this way we can try it, change it and share our fork with you again so you can see the changes.

On to the actual question, I think the problem is you're only making audios play with audio.play(), you're never telling audios to stop playing. The only similiar thing is you're removing the class playing from the playing element, but that's only CSS and in this case has no actual effect on the audio element.

You'll need to do something like audio.pause() or audio.stop(), I'm not sure, but you'll definitely need some JS to stop the audio.

Hope it nudges you in the good direction :)

Collapse
 
paukaradagian profile image
π“Ÿπ“ͺ𝓾𝓡𝓲𝓷π“ͺβ€οΈπ“šπ“ͺ𝓻π“ͺ𝓭π“ͺ𝓰𝓲π“ͺ𝓷

Thank you for taking the time to answer me.
This is the link to codepen.
codepen.io/PauKa/pen/eYJwKxa