fullscreenVideo.onended=function(){
videoPlaying=false;
fullscreenVideo.style.display="none";
mainContent.style.display="flex";
document.body.style.background="#f4f4f4";
};
window.addEventListener("resize",generateStudentLines);
generateStudentLines();
// VIDEO SLUT - GÅ TILBAGE TIL UR
fullscreenVideo.onended=function(){
videoPlaying=false;
fullscreenVideo.style.display="none";
mainContent.style.display="flex";
document.body.style.background="#f4f4f4";
pauseBtn.textContent="Pause";
};
// FEJLHÅNDTERING HVIS VIDEO IKKE FINDES
fullscreenVideo.onerror=function(){
console.log("Video kunne ikke indlæses:",fullscreenVideo.src);
videoPlaying=false;
fullscreenVideo.style.display="none";
mainContent.style.display="flex";
document.body.style.background="#f4f4f4";
};
// KLIK PÅ VIDEO = PAUSE/START
fullscreenVideo.onclick=function(){
if(fullscreenVideo.paused){
fullscreenVideo.play();
pauseBtn.textContent="Pause";
}else{
fullscreenVideo.pause();
pauseBtn.textContent="Genoptag";
}
};
// MELLEMRUMSTAST = PAUSE/START VIDEO
document.addEventListener("keydown",function(e){
if(e.code==="Space" && videoPlaying){
e.preventDefault();
if(fullscreenVideo.paused){
fullscreenVideo.play();
pauseBtn.textContent="Pause";
}else{
fullscreenVideo.pause();
pauseBtn.textContent="Genoptag";
}
}
});