// Closing current script section to add elements
// Closing current script section to add elements
</script>
<audio id="LM_Audio" style="display: none;"></audio>
<script type="text/javascript"> // Starting new script section after adding elements
$(function() {
var AudioTable = [
{ address:"0/0/95", url:"/scada/resources/img/click.mp3"},
{ address:"0/0/96", url:"/scada/resources/img/alarm.mp3" },
{ address:"32/2/2", url:"/user/audio3.mp3" },
];
for (var i in AudioTable) {
CreateListeners(AudioTable[i].address,AudioTable[i].url);
}
function CreateListeners(groupaddr,url){
// Make event listener to object
if (typeof grp != 'undefined') {
grp.listen(groupaddr, function(object, state) {
var value = object.value;
if (state == 'value') {
mute = Scada.encodeGroupAddress(groupaddr); // Use bit object !
var LM_snd = document.getElementById("LM_Audio");
LM_snd.src= url;
LM_snd.load();
objectStore.addListener(mute, function(obj, type) {
if(obj.value == 1){
LM_snd.play();
LM_snd.muted = false;
} else {
LM_snd.muted = true;
}
});
}
}, true);
}
}
});