b74084e3 by David LaPalomento

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

The error method is not writable in video.js so store error objects on the HLS plugin to be sure we don't break error notifications when the HLS plugin is not in use. Remove 'missing' from error message text since we're now using the same text for all status codes > 400.
1 parent 4c4ebe84
......@@ -248,16 +248,15 @@ var
if (xhr.readyState === 4) {
if (xhr.status >= 400) {
player.error = {
type: 'hls-missing-playlist',
player.hls.error = {
status: xhr.status,
message: 'HLS Missing Playlist at URL: ' + url,
message: 'HLS playlist request error at URL: ' + url,
code: (xhr.status >= 500) ? 4 : 2
};
player.trigger('error');
return;
}
// readystate DONE
parser = new videojs.m3u8.Parser();
parser.push(xhr.responseText);
......
......@@ -572,8 +572,8 @@ test('playlist 404 should trigger MEDIA_ERR_NETWORK', function() {
});
equal(true, errorTriggered, 'Missing Playlist error event should trigger');
equal(2, player.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK');
equal('hls-missing-playlist', player.error.type, 'Player error type should inform user correctly');
equal(2, player.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK');
ok(player.hls.error.message, 'Player error type should inform user correctly');
});
test('segment 404 should trigger MEDIA_ERR_NETWORK', function () {
......