Colleagues. The problem is as follows.
There is a music site .
One-button player to the left of each song. Everything is perfectly reproduced.
There is a button "Load more songs." Through Ajax, 20 more songs are loaded .
If you start playing a song from a new loaded block, two songs will be played simultaneously , although the one that was playing should stop.
If you stop everything and turn on the song again - it will start playing twice , i.e. for example, "ve-ve-ter with mo-mo-a-ri-doo-dul, na-gon-nyal be-be-du-du-du".
Then if you load another 20 songs, the player is initialized again and the song will be played three times at the same time!
The wiretap becomes impossible! The same song overlaps itself several times.
Please help sort out. How to tame this script? The player is called ubaPlayer I attach a screenshot of the code. Highlights commented 