i am trying to make an infinitive loop that stops when the video is uploaded. The function works fine, however to stop the loop does not seem to work. The error I get is:
clearImmediate is not defined
this is the loop i am trying to make:
window.setImmediate = window.setTimeout; //had to add this for it to start the loop
var videoIsUploaded = false;
var immediateId;
function loop() {
console.log('still uploading');
immediateId = setImmediate(loop);
if (videoIsUploaded == true) {
window.clearImmediate(immediateId);
HideTheUpload();
}
}
loop();
function HideTheUpload(){
document.getElementById("AddVideo").style.display = "none";
}
Once Azure has uploaded the video it sets "videoIsUploaded = true" this all works fine and the "if (videoIsUploaded..." fires