The below code is how I put audio in my webpage. It will play the sound when I received protocol from my slave device.
<script>
function RxProtocol()
{
var a = document.getElementById("audio1");
a.play();
}
</script>
<body>
<audio id="audio1">
<source src="audio.wav" type="audio/wav">
<source src="audio.mp3" type="audio/mpeg">
audio tag not supported.
</audio>
</body>
It is suppose to play the sound each time it received a protocol. But when I use google Chrome, it just play once only (after refresh/reloading the page) when it received the first protocol. After that it is silence when receive protocols.
Other browser like IE9 or firefox do not have this problem. Do you guys know why?