playing Audio getting overlapped on multiple ajax request

It doesn’t describe the problem statement completely but looking at the code, the behaviour is expected.
You have to add the code to que the audio instead of playing it immediately.

So, create a que and store the loaded audio in que. Instead of playing it immediately, check if any audio is already playing, if so, wait for it to finish (need to add listeners). Once that finishes, pop it from que and play the next qued item.
More code and details on the problem statement will help better.

Read more here: Source link