Last active
December 1, 2020 18:41
-
-
Save CrashLaker/054f5a6221c3432b0f1236fc2b8588b9 to your computer and use it in GitHub Desktop.
grafana-alerting-frontend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> | |
<script type="text/javascript"> | |
function playRadar(){ | |
let audiourl = "http://radar-sound.mp3 | |
let bgaudio = new Audio(audiourl) | |
bgaudio.play() | |
setTimeout(function(){ | |
bgaudio.play(); | |
setTimeout(function(){ | |
bgaudio.pause(); | |
//player.currentTime = 0; | |
}, 1500); | |
}, 1000); | |
} | |
$(document).ready(function (){ | |
setInterval(() => { | |
$.get('http://our-backend/send', (rs) => { | |
if (rs.data) { // If there are alerts | |
playRadar() | |
for (let alert of rs.data){ | |
let audio = new Audio(<audio from AWS Polly>) | |
} | |
} | |
}) | |
}, 60000) // Run every minute | |
</script> | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment