The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Using jQuery to stop audio

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #44795

    Hi there

    I’m working on a simple audio player with HTML5 and jQuery:

    So far this works quite fine. But I have a list of several audio cues, each with its own control button. When I start playing a new cue I’d like an other cue already playing to stop.

    Just now when I click the play button while another cue is still playing, both audio files playing together, which definitely isn’t that nice.

    Any ideas for this problem?


    Something like this?:

    When you click play add a class like “playing” to that audio cue, then if you click play again somewhere search for all the cues that have the class “playing” and pauze or stop it. Then remove the class “playing” from that cue and add it to the new cue.


    @Mottie: Thanks a lot for your code. It works like MAGIC! :-)

    , @Argeaux: Thanks for your inputs, too.


    This has been something that I’ve been looking for, however I’m still only new. Is there a way of pausing the current track without going to the next track?

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.