0

I have an ajax call in my code, when a new message comes it plays an audio file but the audio file is playing over and over again even if i didn't set it to loop.

Here's the <audio> I used:

document.getElementById("notifsound").innerHTML = '<audio autoplay><source src="./uploads/notif.mp3" type="audio/mp3"><p></p></audio>';
Mr Lister
  • 45,515
  • 15
  • 108
  • 150

1 Answers1

0

Add loop=false as an attribute to the HTML audio tag

Igbanam
  • 5,904
  • 5
  • 44
  • 68
  • It loops more frequently now. It looped like every 2 seconds before –  Mar 14 '16 at 16:31