225eb805 by David LaPalomento

Put segment errors on the plugin object because error is read-only on vjs

Missed this in my last commit. Don't overwrite player.error, hang errors off the plugin object instead.
1 parent b74084e3
......@@ -372,20 +372,12 @@ var
if (this.readyState === 4) {
if (this.status >= 400) {
if(player.hls.mediaIndex<player.hls.media.segments.length-1)
{
player.hls.mediaIndex++;
segmentXhr = null;
fillBuffer();
} else {
player.error = {
type: 'hls-missing-segment',
message: 'HLS Missing Segment at index ' + player.hls.mediaIndex,
status: this.status,
code: (this.status >= 500) ? 4 : 2
player.hls.error = {
status: segmentXhr.status,
message: 'HLS segment request error at URL: ' + segmentUri,
code: (segmentXhr.status >= 500) ? 4 : 2
};
player.trigger('error');
}
return;
}
......
......@@ -603,8 +603,8 @@ test('segment 404 should trigger MEDIA_ERR_NETWORK', function () {
});
equal(true, errorTriggered, 'Missing Segment error event should trigger');
equal(2, player.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK');
equal('hls-missing-segment', player.error.type, 'Player error type should inform user correctly');
ok(player.hls.error.message, 'an error message is available');
equal(2, player.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK');
});
test('segment 500 should trigger MEDIA_ERR_ABORTED', function () {
......@@ -634,8 +634,8 @@ test('segment 500 should trigger MEDIA_ERR_ABORTED', function () {
});
equal(true, errorTriggered, 'Missing Segment error event should trigger');
equal(4, player.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_ABORTED');
equal('hls-missing-segment', player.error.type, 'Player error type should inform user correctly');
ok(player.hls.error.message, 'an error message is available');
equal(4, player.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_ABORTED');
});
module('segment controller', {
......