You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
634 B
JavaScript

var track = document.querySelector("track_1"),
track_div = document.getElementById("track_1");
track_1.addEventListener('cuechange', function () {
let cues = track_1.track_1.activeCues; // array of current cues
console.log("cuechange", cues, cues[0].text, cues[0].startTime, cues[0].endTime);
var d = JSON.parse(cues[0].text);
console.log("d",d);
track_div.innerHTML = d.title;
var old = document.querySelector(".now_playing");
if (old) {
old.classList.remove("now_playing");
}
var playing = document.getElementById(d.title);
playing.classList.add("now_playing");
console.log("playing",playing);
});