null check to avoid occasional npe
This commit is contained in:
		
							
								
								
									
										26
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -3090,17 +3090,21 @@ | |||||||
|  |  | ||||||
| 		var iframe = event.target; | 		var iframe = event.target; | ||||||
|  |  | ||||||
| 		// YouTube postMessage API | 		if( iframe && iframe.contentWindow ) { | ||||||
| 		if( /youtube\.com\/embed\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) { |  | ||||||
| 			iframe.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' ); | 			// YouTube postMessage API | ||||||
| 		} | 			if( /youtube\.com\/embed\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) { | ||||||
| 		// Vimeo postMessage API | 				iframe.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' ); | ||||||
| 		else if( /player\.vimeo\.com\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) { | 			} | ||||||
| 			iframe.contentWindow.postMessage( '{"method":"play"}', '*' ); | 			// Vimeo postMessage API | ||||||
| 		} | 			else if( /player\.vimeo\.com\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) { | ||||||
| 		// Generic postMessage API | 				iframe.contentWindow.postMessage( '{"method":"play"}', '*' ); | ||||||
| 		else { | 			} | ||||||
| 			iframe.contentWindow.postMessage( 'slide:start', '*' ); | 			// Generic postMessage API | ||||||
|  | 			else { | ||||||
|  | 				iframe.contentWindow.postMessage( 'slide:start', '*' ); | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user