1
0

Correct audio stopping.

This commit is contained in:
Alexander Andreev 2023-08-20 02:10:29 +04:00
parent b874b533ca
commit 3566e90b1a
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -47,13 +47,20 @@ setInterval(updateLastPlayedSong, 45000);
let audio = document.getElementsByTagName("audio")[0];
let volume = $("volume");
const audio_src = audio.childNodes[0].src;
audio.hidden = true;
audio.volume = parseFloat(volume.value) / 100.0;
document.querySelector("div.player").style.display = "flex";
$("radio").style.display = "flex";
$("play").addEventListener("click", e => {
audio.paused && audio.play() || audio.pause();
if (audio.paused) {
audio.src = audio_src;
audio.play();
} else {
audio.pause();
audio.src = "";
}
e.target.style.maskImage = audio.paused ? "url(/assets/img/play.svg)" : "url(/assets/img/stop.svg)"; });
audio.addEventListener("timeupdate", e => {