воспроизведение звукового javascript
var audio = new Audio("folder_name/audio_file.mp3");
audio.play();
как воспроизводить звук при загрузке js
<audio id="foobar" src="yoursample.ogg" preload="auto">
как воспроизводить аудио js
let myAudioElement = new Audio('audio.mp3');
myAudioElement.addEventListener("canplaythrough", event => {
/* the audio is now playable; play it if permissions allow */
myAudioElement.play();
});
html воспроизведение аудио программно
document.getElementById('yourAudioTag').play();