In my page i am showing a Video loaded from Sprout this way
In case , if something went wrong , means video is not loaded due to 404 , or 403 http status , how can i retry for 4 times ? (waiting for 5 seconds each time )
This is my code
<video id="video" width="200" height="200" controls>
<source id='currentVID' src="" type="video/mp4">
</video>
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);
}