aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2017-04-27 16:36:16 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2017-04-27 16:36:25 +0200
commitb19dc7fc8020491c95f92bf22277746e28da2df9 (patch)
treec928dad9b0b4b6881459c15f37594084f9be3a83
parent8e93a1ddf96f36d982a9949d7e4240ba91a123bd (diff)
downloadfreenode-live-2017-presentation-b19dc7fc8020491c95f92bf22277746e28da2df9.tar
freenode-live-2017-presentation-b19dc7fc8020491c95f92bf22277746e28da2df9.tar.gz
don't autoplay background videos in overview mode
-rw-r--r--js/reveal.js50
1 files changed, 35 insertions, 15 deletions
diff --git a/js/reveal.js b/js/reveal.js
index e36cb72..f50994f 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -3098,7 +3098,6 @@
// If the background contains media, load it
if( background.hasAttribute( 'data-loaded' ) === false ) {
- background.setAttribute( 'data-loaded', 'true' );
var backgroundImage = slide.getAttribute( 'data-background-image' ),
backgroundVideo = slide.getAttribute( 'data-background-video' ),
@@ -3108,31 +3107,43 @@
// Images
if( backgroundImage ) {
+
background.style.backgroundImage = 'url('+ backgroundImage +')';
+ background.setAttribute( 'data-loaded', 'true' );
+
}
// Videos
else if ( backgroundVideo && !isSpeakerNotes() ) {
- var video = document.createElement( 'video' );
- video.setAttribute( 'autoplay', '' );
- video.setAttribute( 'playsinline', '' );
- if( backgroundVideoLoop ) {
- video.setAttribute( 'loop', '' );
- }
+ if( !isOverview() ) {
- if( backgroundVideoMuted ) {
- video.muted = true;
- }
+ var video = document.createElement( 'video' );
+ video.setAttribute( 'autoplay', '' );
+ video.setAttribute( 'playsinline', '' );
+
+ if( backgroundVideoLoop ) {
+ video.setAttribute( 'loop', '' );
+ }
+
+ if( backgroundVideoMuted ) {
+ video.muted = true;
+ }
+
+ // Support comma separated lists of video sources
+ backgroundVideo.split( ',' ).forEach( function( source ) {
+ video.innerHTML += '<source src="'+ source +'">';
+ } );
+
+ background.appendChild( video );
- // Support comma separated lists of video sources
- backgroundVideo.split( ',' ).forEach( function( source ) {
- video.innerHTML += '<source src="'+ source +'">';
- } );
+ background.setAttribute( 'data-loaded', 'true' );
+
+ }
- background.appendChild( video );
}
// Iframes
else if( backgroundIframe ) {
+
var iframe = document.createElement( 'iframe' );
iframe.setAttribute( 'allowfullscreen', '' );
iframe.setAttribute( 'mozallowfullscreen', '' );
@@ -3153,7 +3164,16 @@
iframe.style.maxWidth = '100%';
background.appendChild( iframe );
+
+ background.setAttribute( 'data-loaded', 'true' );
+
}
+ else {
+
+ background.setAttribute( 'data-loaded', 'true' );
+
+ }
+
}
}