var audio = new Audio("folder_name/audio_file.mp3");
audio.play();
<button onclick="playSound()">Play</button>
<script>
let playSound = () => new Audio("src.mp3").play();
</scirpt>
<script>
function play() {
var audio = new Audio('https://interactive-examples.mdn.mozilla.net/media/examples/t-rex-roar.mp3');
audio.play();
}
</script>
<button onclick-"play();">PLAY MY AUDIO</button>
var audio = new Audio('audio_file.mp3');
audio.play();
var bMusic = new Audio('welcome1.mp3')
bMusic.play()
//play audio with from html audio element:
document.getElementById('myAudioTagID').play();
//play audio with out html audio tag
var myAudio = new Audio('my_great_song.mp3');
myAudio.play();
function play() {
var audio = new Audio('https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3');
audio.play();
}
var audio = new Audio("folder_name/audio_file.mp3");
audio.play(); // start playing audio
audio.pause(); // pause audio
audio.currentTime = 0; // makes sure audio is played from the beginning when resumed
let myAudioElement = new Audio('audio.mp3');
myAudioElement.addEventListener("canplaythrough", event => {
/* the audio is now playable; play it if permissions allow */
myAudioElement.play();
});
const sound = require("sound-play");
sound.play("file.mp3");