mirror of
				https://github.com/videojs/video.js.git
				synced 2025-10-31 00:08:01 +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:
		
				
					committed by
					
						 Steve Heffernan
						Steve Heffernan
					
				
			
			
				
	
			
			
			
						parent
						
							d385f8257f
						
					
				
				
					commit
					b9181ee55b
				
			| @@ -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 | ||||
|   | ||||
| @@ -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'); | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user