The widget's beep is created with the following code:
function Beep(u) {
this.url = u; //url of audio file
this.stopped = false;
this.audio = new Audio(this.url);
this.start = function() {
this.stopped = false;
// -- deactivate on non-Windows; problems with sound
//if(navigator.platform.indexOf("Win") == -1) return;
//--
this.audio.loop(9999);
}
this.stop = function() {
this.stopped = true;
this.audio.stop();
}
}
The Beep is created/started/stopped with this code:
// ============= Event handlers ==========================
// Execute the script on load
window.addEventListener('load', function(ev){
//
document.getElementById('closebutton').addEventListener('click', function(ev){
window.close();
}, false);
//////
document.getElementById('stbutton').addEventListener('click', function(ev){
toggleBeep();
}, false);
// --------- init
isBeeping = false;
currentBeep=new Beep(beepfile);
}, false);
function toggleBeep() {
if (isBeeping) currentBeep.stop()
else currentBeep.start();
isBeeping = !isBeeping;
}
The Beep is started and stopped by blue triangle button's clickhandler.
Reproducing the problem: