don't autoplay background videos in overview mode
This commit is contained in:
parent
8e93a1ddf9
commit
b19dc7fc80
1 changed files with 36 additions and 16 deletions
22
js/reveal.js
22
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,10 +3107,16 @@
|
|||
|
||||
// Images
|
||||
if( backgroundImage ) {
|
||||
|
||||
background.style.backgroundImage = 'url('+ backgroundImage +')';
|
||||
background.setAttribute( 'data-loaded', 'true' );
|
||||
|
||||
}
|
||||
// Videos
|
||||
else if ( backgroundVideo && !isSpeakerNotes() ) {
|
||||
|
||||
if( !isOverview() ) {
|
||||
|
||||
var video = document.createElement( 'video' );
|
||||
video.setAttribute( 'autoplay', '' );
|
||||
video.setAttribute( 'playsinline', '' );
|
||||
|
@ -3130,9 +3135,15 @@
|
|||
} );
|
||||
|
||||
background.appendChild( video );
|
||||
|
||||
background.setAttribute( 'data-loaded', 'true' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 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' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue