Skip to content

Instantly share code, notes, and snippets.

@CrashLaker
Last active December 1, 2020 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CrashLaker/054f5a6221c3432b0f1236fc2b8588b9 to your computer and use it in GitHub Desktop.
Save CrashLaker/054f5a6221c3432b0f1236fc2b8588b9 to your computer and use it in GitHub Desktop.
grafana-alerting-frontend
<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