Add 'player/player2.js'

master^2
murtaugh 5 years ago
parent 45dd322c27
commit cb97baf9ee

@ -0,0 +1,16 @@
function player(element){
var track = element.querySelector("track");
track.addEventListener('cuechange', function () {
let cues = track.track.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);
var old = element.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);
});
}
Loading…
Cancel
Save