1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-25 11:13:52 +02:00

Make sure the error property is set before proxying through the tech.

Some error events don't cause the error property on the video element to be set. In that case, handle the event like any other. Fixes #1465.
This commit is contained in:
David LaPalomento 2014-09-04 12:12:36 -04:00 committed by Steve Heffernan
parent d385f8257f
commit b9181ee55b
2 changed files with 11 additions and 3 deletions

View File

@ -123,9 +123,11 @@ vjs.Html5.prototype.setupTriggers = function(){
};
vjs.Html5.prototype.eventHandler = function(evt){
// In the case of an error, set the error prop on the player
// and let the player handle triggering the event.
if (evt.type == 'error') {
// In the case of an error on the video element, set the error prop
// on the player and let the player handle triggering the event. On
// some platforms, error events fire that do not cause the error
// property on the video element to be set. See #1465 for an example.
if (evt.type == 'error' && this.error()) {
this.player().error(this.error().code);
// in some cases we pass the event directly to the player

View File

@ -124,3 +124,9 @@ test('should return a maybe for mp4 on OLD ANDROID', function() {
vjs.IS_OLD_ANDROID = isOldAndroid;
vjs.Html5.unpatchCanPlayType();
});
test('error events may not set the errors property', function() {
equal(tech.error(), undefined, 'no tech-level error');
tech.trigger('error');
ok(true, 'no error was thrown');
});