增加备用音频

This commit is contained in:
GoEdgeLab
2023-06-09 17:28:49 +08:00
parent 52113703cd
commit 8d0fe97b5f
2 changed files with 14 additions and 0 deletions

BIN
web/public/audios/alert.ogg Normal file

Binary file not shown.

View File

@@ -1047,6 +1047,20 @@ window.teaweb = {
}
})
return isOk
},
playAlert: function () {
let audioBox = document.createElement("AUDIO")
audioBox.setAttribute("control", "")
audioBox.setAttribute("autoplay", "")
audioBox.innerHTML = "<source src=\"/audios/alert.ogg\" type=\"audio/ogg\"/>";
document.body.appendChild(audioBox);
audioBox.play().then(function () {
setTimeout(function () {
document.body.removeChild(audioBox);
}, 2000);
}).catch(function (e) {
console.log(e.message);
})
}
}