Parcourir la source

when there is data-autoplay:ing media, prolong autoSlide to match its duration #723

Hakim El Hattab il y a 11 ans
Parent
commit
740f472ce2
2 fichiers modifiés avec 12 ajouts et 1 suppressions
  1. 11 0
      js/reveal.js
  2. 1 1
      js/reveal.min.js

+ 11 - 0
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

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
js/reveal.min.js


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff