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 ...@@ -372,20 +372,12 @@ var
372 372
373 if (this.readyState === 4) { 373 if (this.readyState === 4) {
374 if (this.status >= 400) { 374 if (this.status >= 400) {
375 if(player.hls.mediaIndex<player.hls.media.segments.length-1) 375 player.hls.error = {
376 { 376 status: segmentXhr.status,
377 player.hls.mediaIndex++; 377 message: 'HLS segment request error at URL: ' + segmentUri,
378 segmentXhr = null; 378 code: (segmentXhr.status >= 500) ? 4 : 2
379 fillBuffer();
380 } else {
381 player.error = {
382 type: 'hls-missing-segment',
383 message: 'HLS Missing Segment at index ' + player.hls.mediaIndex,
384 status: this.status,
385 code: (this.status >= 500) ? 4 : 2
386 }; 379 };
387 player.trigger('error'); 380 player.trigger('error');
388 }
389 return; 381 return;
390 } 382 }
391 383
......
...@@ -603,8 +603,8 @@ test('segment 404 should trigger MEDIA_ERR_NETWORK', function () { ...@@ -603,8 +603,8 @@ test('segment 404 should trigger MEDIA_ERR_NETWORK', function () {
603 }); 603 });
604 604
605 equal(true, errorTriggered, 'Missing Segment error event should trigger'); 605 equal(true, errorTriggered, 'Missing Segment error event should trigger');
606 equal(2, player.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK'); 606 ok(player.hls.error.message, 'an error message is available');
607 equal('hls-missing-segment', player.error.type, 'Player error type should inform user correctly'); 607 equal(2, player.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_NETWORK');
608 }); 608 });
609 609
610 test('segment 500 should trigger MEDIA_ERR_ABORTED', function () { 610 test('segment 500 should trigger MEDIA_ERR_ABORTED', function () {
...@@ -634,8 +634,8 @@ test('segment 500 should trigger MEDIA_ERR_ABORTED', function () { ...@@ -634,8 +634,8 @@ test('segment 500 should trigger MEDIA_ERR_ABORTED', function () {
634 }); 634 });
635 635
636 equal(true, errorTriggered, 'Missing Segment error event should trigger'); 636 equal(true, errorTriggered, 'Missing Segment error event should trigger');
637 equal(4, player.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_ABORTED'); 637 ok(player.hls.error.message, 'an error message is available');
638 equal('hls-missing-segment', player.error.type, 'Player error type should inform user correctly'); 638 equal(4, player.hls.error.code, 'Player error code should be set to MediaError.MEDIA_ERR_ABORTED');
639 }); 639 });
640 640
641 module('segment controller', { 641 module('segment controller', {
......