aboutsummaryrefslogtreecommitdiff
path: root/js/reveal.js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2013-11-26 18:22:01 -0500
committerHakim El Hattab <hakim.elhattab@gmail.com>2013-11-26 18:22:07 -0500
commit740f472ce247958eed5ae7eca0596f1745030f78 (patch)
treeb03e494652e6edf16b70c7d5e2b611d279f2ccec /js/reveal.js
parentcb9e507cd43dce2f118a7ae78a76bf8d6e2bf3ba (diff)
downloadfreenode-live-2017-presentation-740f472ce247958eed5ae7eca0596f1745030f78.tar
freenode-live-2017-presentation-740f472ce247958eed5ae7eca0596f1745030f78.tar.gz
when there is data-autoplay:ing media, prolong autoSlide to match its duration #723
Diffstat (limited to 'js/reveal.js')
-rw-r--r--js/reveal.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 743c81b..d1d8ea6 100644
--- a/js/reveal.js
+++ b/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