I have a dashboard web application that I want to play a beep if it has a connection problem. The site’s adax code will be polled for data and will reduce its refresh rate if it cannot connect. After the server is restored, the site will continue to work.
At the same time, I would like the sound to play every time it cannot connect (so I know to check the server). Here is the code. This code works.
var error_audio = new Audio("audio/"+settings.refresh.error_audio);
error_audio.load();
function onConnectionError() {
error_audio.play();
}
However, the second time no sound is played through the function. Digging in the Chrome debugger, the attribute "played" in the audio element is set to true. Setting it to false has no results. Any ideas?