aboutsummaryrefslogtreecommitdiff
path: root/js/reveal.js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-04 09:22:15 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-04 09:22:15 +0200
commit170aa31d6f78130f62bffeb1cb7cc7f342fc5966 (patch)
tree46142a543de64dcb607583450c1bf69b61c00093 /js/reveal.js
parent43bf882d0800c30f024b2c3e097d98dde65bc7c9 (diff)
downloadfosdem-2018-presentation-170aa31d6f78130f62bffeb1cb7cc7f342fc5966.tar
fosdem-2018-presentation-170aa31d6f78130f62bffeb1cb7cc7f342fc5966.tar.gz
video background playback
Diffstat (limited to 'js/reveal.js')
-rw-r--r--js/reveal.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/js/reveal.js b/js/reveal.js
index b229453..04350d0 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2001,7 +2001,7 @@ var Reveal = (function(){
}
if( includeAll || h === indexh ) {
- toArray( backgroundh.childNodes ).forEach( function( backgroundv, v ) {
+ toArray( backgroundh.querySelectorAll( 'section' ) ).forEach( function( backgroundv, v ) {
if( v < indexv ) {
backgroundv.className = 'slide-background past';
@@ -2021,9 +2021,22 @@ var Reveal = (function(){
} );
- // Don't transition between identical backgrounds. This
- // prevents unwanted flicker.
+ // Stop any currently playing video background
+ if( previousBackground ) {
+
+ var previousVideo = previousBackground.querySelector( 'video' );
+ if( previousVideo ) previousVideo.pause();
+
+ }
+
if( currentBackground ) {
+
+ // Start video playback
+ var currentVideo = currentBackground.querySelector( 'video' );
+ if( currentVideo ) currentVideo.play();
+
+ // Don't transition between identical backgrounds. This
+ // prevents unwanted flicker.
var previousBackgroundHash = previousBackground ? previousBackground.getAttribute( 'data-background-hash' ) : null;
var currentBackgroundHash = currentBackground.getAttribute( 'data-background-hash' );
if( currentBackgroundHash && currentBackgroundHash === previousBackgroundHash && currentBackground !== previousBackground ) {
@@ -2031,6 +2044,7 @@ var Reveal = (function(){
}
previousBackground = currentBackground;
+
}
// Allow the first background to apply without transition