Всем привет! Очень нужна помощь. На сайте создал 3 экземпляра аудио визуализации с помощью wavesurfer. Мне нужно, чтобы при воспроизведении одного аудио, остальные останавливались. Т.е. мне как-то надо wavesurfer.pause() передать объекту.
$(this).find("button").click(function () {
if(
this.id == 'music_btn_1'){
console.log("click_1", playing_2);
wavesurfer.playPause();
// document.getElementById("music_btn_2").click();
// document.querySelector('#music_btn_2').wavesurfer.pause();
if (playing_1 == 0) {
playing_1 = 1;
this.style.backgroundImage = "url(../img/Pause.svg)";
} else {
playing_1 = 0;
this.style.backgroundImage = "url(../img/Play.svg)";
}
}
if(
this.id == 'music_btn_2'){
console.log("click_2");
wavesurfer.playPause();
if (playing_2 == 0) {
playing_2 = 1;
this.style.backgroundImage = "url(../img/Pause.svg)";
} else {
playing_2 = 0;
this.style.backgroundImage = "url(../img/Play.svg)";
}
}
if(
this.id == 'music_btn_3'){
console.log("click_3");
wavesurfer.playPause();
if (playing_3 == 0) {
playing_3 = 1;
this.style.backgroundImage = "url(../img/Pause.svg)";
} else {
playing_3 = 0;
this.style.backgroundImage = "url(../img/Play.svg)";
}
}