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 ...@@ -248,16 +248,15 @@ var
248 248
249 if (xhr.readyState === 4) { 249 if (xhr.readyState === 4) {
250 if (xhr.status >= 400) { 250 if (xhr.status >= 400) {
251 player.error = { 251 player.hls.error = {
252 type: 'hls-missing-playlist',
253 status: xhr.status, 252 status: xhr.status,
254 message: 'HLS Missing Playlist at URL: ' + url, 253 message: 'HLS playlist request error at URL: ' + url,
255 code: (xhr.status >= 500) ? 4 : 2 254 code: (xhr.status >= 500) ? 4 : 2
256 }; 255 };
257 player.trigger('error'); 256 player.trigger('error');
258 return; 257 return;
259 } 258 }
260 259
261 // readystate DONE 260 // readystate DONE
262 parser = new videojs.m3u8.Parser(); 261 parser = new videojs.m3u8.Parser();
263 parser.push(xhr.responseText); 262 parser.push(xhr.responseText);
......
...@@ -572,8 +572,8 @@ test('playlist 404 should trigger MEDIA_ERR_NETWORK', function() { ...@@ -572,8 +572,8 @@ test('playlist 404 should trigger MEDIA_ERR_NETWORK', function() {
572 }); 572 });
573 573
574 equal(true, errorTriggered, 'Missing Playlist error event should trigger'); 574 equal(true, errorTriggered, 'Missing Playlist error event should trigger');
575 equal(2, player.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK'); 575 equal(2, player.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK');
576 equal('hls-missing-playlist', player.error.type, 'Player error type should inform user correctly'); 576 ok(player.hls.error.message, 'Player error type should inform user correctly');
577 }); 577 });
578 578
579 test('segment 404 should trigger MEDIA_ERR_NETWORK', function () { 579 test('segment 404 should trigger MEDIA_ERR_NETWORK', function () {
......