Pause all other audio tags on play #148

This commit is contained in:
simon987 2021-04-17 13:24:21 -04:00
parent 50771bd1dc
commit 707a570828

View File

@ -350,6 +350,14 @@ function createDocCard(hit) {
audio.setAttribute("controls", "");
audio.setAttribute("type", hit["_source"]["mime"]);
audio.setAttribute("src", "f/" + hit["_id"]);
audio.addEventListener("play", () => {
// Pause all currently playing audio tags
$("audio").each(function(){
if (this !== audio) {
this.pause();
}
});
});
docCard.appendChild(audio)
}