I've using the Dash.js player to play MPEG-DASH videos. The videos are pulled from a server. Every now and then there will be 404 errors due to server issues, I would like to retry the stream in the background by detecting the 404 error and acting accordingly.
The problem is I cannot catch the error, it's thrown from the line
req.send();
Which is in a file called FragmentLoader.js.
I've tried the following error handling:
window.addEventListener('error', function(e) {
console.log("Item: " + e.message);
}, true);
var oReq = new XMLHttpRequest();
oReq.addEventListener("error", function (e) {
console.log("xml item: " + e.message);
}, true);
$(document).ajaxError(function (event, xhr, ajaxOptions, errorThrown) {
alert("ajax erorr");
});
However none of these conditions catch the error. Is there any way to catch these errors thrown from the dash.js player?
its been a bit since i've been in that code, but if memory serves, you should be able to determine it is a 404 by checking the status property of the error