This commit is contained in:
choelzl 2022-02-24 02:31:24 +01:00
parent 9a643238d8
commit 5c6d940a5a
Signed by: sora
GPG Key ID: A362EA0491E2EEA0

View File

@ -12,7 +12,7 @@ $(async function () {
$(audio).on("loadedmetadata", function() { $(audio).on("loadedmetadata", function() {
resolve(audio); resolve(audio);
}); });
audio.volume = volume/100.0; audio.volume = Math.max(1,Math.min(0,volume/100.0));
audio.src = src; audio.src = src;
audio.play().catch((err)=>{ audio.play().catch((err)=>{
if(err.toString().startsWith('NotAllowedError')){ if(err.toString().startsWith('NotAllowedError')){
@ -34,7 +34,7 @@ $(async function () {
let audio = await playAudio(music); let audio = await playAudio(music);
node.style.opacity = 1; node.style.opacity = 1;
nodeIm.style.opacity = 1; nodeIm.style.opacity = 1;
await sleep(audio.duration*1000 - 1000); await sleep(Math.max(audio.duration*1000 - 500,3000));
node.style.opacity = 0; node.style.opacity = 0;
nodeIm.style.opacity = 0; nodeIm.style.opacity = 0;
} }