b713aa5b by David LaPalomento

Check for request errors before checking if the request was aborted

Make sure the request did not receive an error status code (and hence the response is unavailable) before assuming it was aborted.
1 parent 9c0cac0e
......@@ -378,22 +378,22 @@ var
// the segment request is no longer outstanding
segmentXhr = null;
// stop processing if the request was aborted
if (!this.response) {
return;
}
// trigger an error if the request was not successful
if (this.status >= 400) {
player.hls.error = {
status: segmentXhr.status,
status: this.status,
message: 'HLS segment request error at URL: ' + segmentUri,
code: (segmentXhr.status >= 500) ? 4 : 2
code: (this.status >= 500) ? 4 : 2
};
player.trigger('error');
return;
}
// stop processing if the request was aborted
if (!this.response) {
return;
}
// calculate the download bandwidth
player.hls.segmentXhrTime = (+new Date()) - startTime;
player.hls.bandwidth = (this.response.byteLength / player.hls.segmentXhrTime) * 8 * 1000;
......