-2

I generally deal with wordpress, and I'm not a php nor java expert.I'm searching for a script which could automatically autoplay different videos at different times of the day, like a tv channel schedule. Ex. at 9am "movie1.mp4" - at 11am "movie2.mp4" and so on for all the day. Obviously it should be responsive, and work both on Ios and on Android, other than on Windows. I need it both for a wordpress website, but also for another webpage which has not been built in WP. I suppose I could use the same javascript for both, for what I know, but I don't know exactly how to specify the date and time attributes at which autoplay should start. Thanks for any help, I hope you understood

1 Answers1

0

there are a couple possibilities, the one i would go for is that

you can preload all the videos in JS and change a video element's source.

changing source on html5 video tag

to check the time you can use

var date = new Date();
var current_hour = date.getHours(); 

combine that with a timeout and a switch/if statement and it should work to your likings.

i do however advise against autoplay in any form other than users choice.

Odinh
  • 183
  • 2
  • 15
  • 1
    I agree with you @Odinh, I don't like this autoplay . But I'm actually working on two different projects: one is for a customer which wishes a tv-like website, where movies starts automatically at certain daytimes, so that when you open the page the movie is already showing up. The other one is a project of mine, where the user can choose the channel and the program he wants to see at that time. Anyway the links you provided seem very exhaustive, I only need some time to apply them, hopefully in the next days. Thank you – John Bonzo Mar 11 '21 at 22:44