-1

i didn't find a easy way to explain this but i need to play videos from my hosting or youtube and make it look like a tv channel in my website .

meaning if two users for example enter at the same time from different places they will watch the same thing which could for example : the third video in the play list from the minute 30 and if they closed and back after 5 min they will start from minute 35 in the third video so far i can make a the my html5 playlist and play the videos but i'm stuck in how to programme the timing and from where a user should watch according to the timing hi started watching.

if there are any think that i'm missing or a CMS or plugging or service or api that will help me realizing this task please feel free to answer me back ,PEACE

  • You need to clarify more. You say "if two users for example enter at the same time" - enter where? A space where this is playing on a screen or do you mean accessing the webpage from different computers at the same time? Very unclear as to whether this is a single instance of the playlist or a networked playlist. – garrettlynchirl Jul 04 '18 at 18:33
  • hi @garrettlynch thank you for your response i edited my question is it clear enough now , than you ? – ADAM AJ Jul 04 '18 at 20:43

1 Answers1

1

Ok it's clearer now. Since you need the playlist on your site to be synced to the time of day you are looking at a combination of solutions to get this working. Firstly your timer will need to use a single time zone (it doesn't matter where the user is accessing from). Let's say you used GMT+0 - if two people accessed the site from the US and Europe the site would know it's the same time of day according to that timezone and deliver the same video to each user. To do this you probably need to use server side scripting, there apparently are solutions in Javascript (see here) but I'd use php's date/time functions and then pass the result to javascript. Then you need to hopefully use the youtube javascript api to compile or load your playlist and later on be able to access the videos according to time (the html5 playlist YouTube gives you on their site to embed won't be enough on it's own). Hopefully the videos you want in the playlist are all on your youtube account and/or in their own playlist and so that should be relatively straightforward. If you are doing anything more complex you will need the youtube php api instead but from what you describe that hopefully shouldn't be necessary.

Now come more questions. How are you allocating videos according to time? Are each of the videos a regular length, for example are there exactly 6 videos 10 minutes long each so 60 minutes of video that repeats every hour? Or have you some other precise formula for how the videos will be shown according to a duration of time? At the moment I can't give you code examples but I have outlined the combination of things that need to occur in order for this to work so that should give you a starting point.

garrettlynchirl
  • 790
  • 8
  • 23
  • thank you your responde you give me allot of ideas i will try to create an interface where the admin can add videos and specifies the length and choose it's position in the playlist later i will try to create a calculator wish will know wish video to play and from where i think the only problem will be is when a user paused the video – ADAM AJ Jul 05 '18 at 15:26
  • You only need an admin interface if somebody is setting this up other than you and it's going to be a tool of some sort or if the videos are going to continually change - I'm guessing this is an artwork and the videos are fixed so no need to add more complexity. Pause shouldn't be an issue, you could disable it (see solution here - https://stackoverflow.com/questions/13429884/youtube-iframe-disable-pause-video) or capture play events to shuffle to the right time in the video and resync with the time. – garrettlynchirl Jul 05 '18 at 16:15