html - Code to Start and Stop a broadcasting script on a schedule -
i new coding.
i work sports complex , have set live streaming.
currently have manually go streaming platform , click "start broadcasting" , "stop broadcasting" when want things happen.
i wondering if can add code html these functions automatically on scheduled timer specify?
thanks, jade
your code not specific, going assume have javascript functions defined somewhere can start , stop broadcasting. this:
function startbroadcasting() { // whatever takes start broadcasting } function stopbroadcasting() { // whatever takes stop broadcasting }
what need then, call, in script tag @ bottom of body, this:
var running = false; function myscheduler() { var = new date(); var dow = now.getday(); var hr = now.gethours(); var min = now.getminutes(); var sec = now.getseconds(); if (dow === 6 && hr === 7 && min === 0 && !running) { settimeout(startbroadcasting, 0); } if (dow === 9 && hr === 21 && min === 0 && running) { settimeout(stopbroadcasting, 0); } } setinterval(myscheduler, 1000);
Comments
Post a Comment