Answers for "play audio file +js while loop"

2

how to loop audio in js

myAudio = new Audio('someSound.ogg'); 
if (typeof myAudio.loop == 'boolean')
{
    myAudio.loop = true;
}
else
{
    myAudio.addEventListener('ended', function() {
        this.currentTime = 0;
        this.play();
    }, false);
}
myAudio.play();
Posted by: Guest on May-16-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language