Update '12/player2.js'

master
barkaiavital 5 years ago
parent efc62fc206
commit 4fc878fae6

@ -1,16 +1,21 @@
var track = document.querySelector("track"), function player(element){
track_div = document.getElementById("track"); var track = element.querySelector("track"),
track.addEventListener('cuechange', function () { track_div = element.querySelector(".track_display");
let cues = track.track.activeCues; // array of current cues track.addEventListener('cuechange', function () {
console.log("cuechange", cues, cues[0].text, cues[0].startTime, cues[0].endTime); let cues = track.track.activeCues; // array of current cues
var d = JSON.parse(cues[0].text); console.log("cuechange", cues, cues[0].text, cues[0].startTime, cues[0].endTime);
console.log("d",d); var d = JSON.parse(cues[0].text);
track_div.innerHTML = d.title; console.log("d",d);
var old = document.querySelector(".now_playing"); track_div.innerHTML = d.title;
if (old) { var old = document.querySelector(".now_playing");
old.classList.remove("now_playing"); if (old) {
} old.classList.remove("now_playing");
var playing = document.getElementById(d.title); }
playing.classList.add("now_playing"); var playing = document.getElementById(d.title);
console.log("playing",playing); playing.classList.add("now_playing");
}); console.log("playing",playing);
});
}
player(document.querySelector("#week_02");
player(document.querySelector("#week_01");
Loading…
Cancel
Save