Ok so now I know my audio is playing, thankyou very much. But my original post eluded to another problem, for which I created that code snippet. If you'd be so kind and if you have the time maybe you could help me, because the result of actually knowing that the file is playing is even more confusing.
Code:
var birdSound = document.getElementById("player");
var coverBirds = document.getElementById("coverBirds");
var trigger = 2;
birdSound.addEventListener('timeupdate', function () {
console.log(birdSound.currentTime);
if (coverBirds.paused) {
if (birdSound.currentTime > trigger ) {
alert("eventalert");
birdSound.play
}
}
});
There is the code. It basically plays one audio element (coverBirds) at a specific time in another audio element (birdSound). It does this by checking if coverBirds is not playing, if it's not playing it checks to see if the time of birdSound has passed the allowed thresh hold set by the trigger variable. It's set up in this way so the timeupdate will not spam the sound file upon the condition being met. The problem is somewhere is the event listener
i think. I think this because I added the console.log line to see if it was firing properly and instead it fired twice and that's it. Is there something I'm doing wrong?
P.S Thanks in advance for your time, if you decide to help