I'm programming a stream of youtube videos that should play on a set schedule, similar to television. If you enter the website the video stream should pick up at whatever video is up in the schedule. So rather than a playlist set by an order of videos, it's a schedule of videos.
I started coding it as a list of youtube ID codes, the length of the video, and the time the video should play. Essentially the program will check the current time, and then find the video closest to that time. Then, it will find the difference between the current time (real-world time) and the time that video should play, and thus fast forward that video 'time difference' seconds.
Is this a silly way to do it? I am writing in PHP. I feel like there's a better way to do it than to manually enter all of the info into the list. And also, is there another way to say, play this NOW and no matter who opens it, this is the current video that should be play. A cron job that updates every x minutes, checks the current video and stores it, and then plays that video?
I hope you guys could help me with this logic.
Thanks!