when there is data-autoplay:ing media, prolong autoSlide to match its duration #723
This commit is contained in:
		
							parent
							
								
									cb9e507cd4
								
							
						
					
					
						commit
						740f472ce2
					
				
					 2 changed files with 14 additions and 3 deletions
				
			
		
							
								
								
									
										11
									
								
								js/reveal.js
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								js/reveal.js
									
										
									
									
									
								
							|  | @ -2454,6 +2454,17 @@ var Reveal = (function(){ | |||
| 				autoSlide = config.autoSlide; | ||||
| 			} | ||||
| 
 | ||||
| 			// If there are media elements with data-autoplay,
 | ||||
| 			// automatically set the autoSlide duration to the
 | ||||
| 			// length of that media
 | ||||
| 			toArray( currentSlide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { | ||||
| 				if( el.hasAttribute( 'data-autoplay' ) ) { | ||||
| 					if( autoSlide && el.duration * 1000 > autoSlide ) { | ||||
| 						autoSlide = ( el.duration * 1000 ) + 1000; | ||||
| 					} | ||||
| 				} | ||||
| 			} ); | ||||
| 
 | ||||
| 			// Cue the next auto-slide if:
 | ||||
| 			// - There is an autoSlide value
 | ||||
| 			// - Auto-sliding isn't paused by the user
 | ||||
|  |  | |||
							
								
								
									
										6
									
								
								js/reveal.min.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								js/reveal.min.js
									
										
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue