Update '12/liveplayer.js'

master
murtaugh 5 years ago
parent d41bb76e96
commit 7dc71e7263

@ -1,5 +1,6 @@
function liveplayer (elt) { function liveplayer (elt) {
var last_timestamp; var last_timestamp,
DELAY_TIME_SECS = 8;
async function poll () { async function poll () {
var rows = await (await fetch("/cgi-bin/radioimplicancies.cgi")).json(); var rows = await (await fetch("/cgi-bin/radioimplicancies.cgi")).json();
@ -10,6 +11,7 @@ function liveplayer (elt) {
if (d.time && d.time != last_timestamp) { if (d.time && d.time != last_timestamp) {
last_timestamp = d.time; last_timestamp = d.time;
console.log("CURRENT METADATA", d); console.log("CURRENT METADATA", d);
window.setTimeout(function () {
var old_nowplaying = elt.querySelector(".now_playing"); var old_nowplaying = elt.querySelector(".now_playing");
if (old_nowplaying) { if (old_nowplaying) {
old_nowplaying.classList.remove("now_playing"); old_nowplaying.classList.remove("now_playing");
@ -21,6 +23,7 @@ function liveplayer (elt) {
} else { } else {
console.log("liveplayer: warning no div matching title " + d.title); console.log("liveplayer: warning no div matching title " + d.title);
} }
}, DELAY_TIME_SECS*1000);
} }
} }
} }

Loading…
Cancel
Save