How to retry loading video again once it fails : <p>In my page i am showing a Video loaded from Sprout this way </p>

<p>In case , if something went wrong , means video is not loaded due to <strong>404 , or 403 http status</strong> , how can i retry for 4 times ? (waiting for 5 seconds each time )</p>

<p>This is my code</p>

<pre><code>&lt;video id="video" width="200" height="200" controls&gt;
   &lt;source id='currentVID' src="" type="video/mp4"&gt;
&lt;/video&gt;


var actualvideo = 'https://api-files.sproutvideo.com/file/7c9adbb51915e2cdf4/b6e4822661adad1aremovethis/240.mp4';
if (actualvideo !== '') {
    var video = document.getElementById('video');

    $('video source').last().on('error', function() {

    alert('something went wrong');

    });


    video.pause();
    var source = document.getElementById('currentVID');
    source.setAttribute('src', actualvideo);
    video.appendChild(source);
}
</code></pre>

<p><a href="https://jsfiddle.net/o2gxgz9r/9974/" rel="noreferrer">https://jsfiddle.net/o2gxgz9r/9974/</a></p>
