0

So I am doing a live video stream and when the video is over, I want to be able to to refresh the users page and send them to a thank you page. I tried doing it this way:

var delayInMilliseconds = 5000; //1 second

setTimeout(function() {
 location.reload();
}, delayInMilliseconds); 

Then when we are ready to switch I just upload a new page but with:

window.location.replace('example.com');

However I don't want the page to refresh all the time as it keeps restarting the video. Is there a way to check for a new page every few seconds but not actually refresh the page? or is there a better and easy method I should be doing instead?

  • 1
    AJAX... Just query the server for instructions. Or, better, have a socket connection so the server can send instructions directly to the browser. But that's more complicated. – Niet the Dark Absol Sep 30 '20 at 23:54
  • https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/ended_event – Phil Sep 30 '20 at 23:58

0 Answers0