xxxxxxxxxx
document.getElementById('yourAudioTag').play();
xxxxxxxxxx
<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>
xxxxxxxxxx
//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();
xxxxxxxxxx
var audio = new Audio('assets/audio.mp3');
> Play
audio.play();
> Stop
sound.pause();
> Back to start
sound.currentTime = 0;
xxxxxxxxxx
//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();
xxxxxxxxxx
function play() {
var audio = new Audio('https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3');
audio.play();
}