Hello! Tell me how to implement video transcation on a schedule? (Analog TV). Several video files will be stored on the server. They need to be broadcast to the site at a certain time, preferably with the option to put the video in a queue. What technologies can this be implemented? Maybe someone has a ready-made solution?
1 answer
Solution "on the knee": You know the beginning of the start (time x) and the duration of each video. With the help of simple mate. operations, you can determine whether to "broadcast video". Next, put a video and what time to put it on it, using js
var vid = document.getElementById("yourVideo"); vid.currentTime = 5; At the very tag video expose
<video autoplay...>...</video> controls do not expose, you can make your controls, in particular sound.
If the user loaded the page before the start of the “broadcast”, then using js you can refresh the page at the time x, or update the content via ajax
* UPD
So do not work. If you have php, then when you load the page you can check the current time and the time from which you can start the broadcast:
$timeToStart = 17; // с 17 часов можно запускать $currentTime = (int)date('G'); If($currentTime >= $timeToStart) { echo '<video autoplay src="http://www.w3schools.com/html/mov_bbb.mp4"></video>'; }
- I'm not strong in js, tell me what's wrong with this code ?:
var vid = document.getElementById("myVideo"); var currentTime = new Date(), targetTime = new Date('YYYY/MM/DD 12:45'); setTimeout(function () { vid.autoplay=true; }, targetTime - currentTime);var vid = document.getElementById("myVideo"); var currentTime = new Date(), targetTime = new Date('YYYY/MM/DD 12:45'); setTimeout(function () { vid.autoplay=true; }, targetTime - currentTime);- Daria - Tell me, what did you want to achieve with this? Then I can give you more details. - blatube.com Nov.
- Start broadcasting video at specified time
targetTime = new Date('YYYY/MM/DD 12:45');, but the video immediately starts broadcasting. I can not understand how to produce a mat. operation to calculate the start time of the video. - Daria - Posted in an update to the answer - blatube.com Nov.
- Yes, you can do it in php, but what about scrolling video up to a certain point? For example, if the video started at 17:00, and the user went to the site at 17:20, then he should watch the video from the 20th minute, how to implement it? - Daria