skip to Main Content

I want to run code at a certain video timestamp in JavaScript

I want to do a cool CSS background change to match with the video. I use this code: document.getElementById("video").addEventListener("playing",video,false); function video(){ if(document.getElementById('video').currentTime >= 3.466) { document.getElementById("body").style.backgroundColor = "black"; } else { document.getElementById('video').addEventListener("timeupdate", video()); } } I was hoping that when…

VIEW QUESTION
Back To Top
Search