音频自动重复无限次 html5
Audio autoplay repeating unlimited times html5
我在 php echo 中使用了音频自动播放系统。有用。但一次又一次地重复它。我想让它只重复一次。我该如何解决。
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);
希望有用
我在 php echo 中使用了音频自动播放系统。有用。但一次又一次地重复它。我想让它只重复一次。我该如何解决。
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);
希望有用