I have used a audio autoplay system in php echo. It works. But repeating it again and again. I want to make it that it will repeat only one time. How can I solve it.
if ($rowcount >= '1'){
echo '
<audio autoplay>
<source src="notification_sound.mp3">
</audio>';
}
var sound = document.getElementById('id_given_audio_tag');
setTimeout(function(){
sound.play();
setTimeout(function(){
sound.pause();
sound.currentTime = 0;
}, time_in_sec_it_takes_sound_to_play+1000);
}, time_in_sec_it_takes_the_sound_to_play);
hope it works