From 00fa1c818dc5806297c3ab3ec68abc13911774d1 Mon Sep 17 00:00:00 2001 From: Greg Denehy Date: Thu, 19 Feb 2015 17:04:41 +1030 Subject: [PATCH] Added option to loop background videos --- README.md | 4 ++-- js/reveal.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e748ca8c..e0e8061b 100644 --- a/README.md +++ b/README.md @@ -427,8 +427,8 @@ Slides are contained within a limited portion of the screen by default to allow

This background image will be sized to 100px and repeated.

-
-

Video. Multiple sources can be defined using a comma separated list.

+
+

Video. Multiple sources can be defined using a comma separated list. Video will loop when the data-background-video-loop attribute is provided.

Embeds a web page as a background. Note that the page won't be interactive.

diff --git a/js/reveal.js b/js/reveal.js index 65ac29ff..5a3f1af1 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2590,6 +2590,7 @@ var backgroundImage = slide.getAttribute( 'data-background-image' ), backgroundVideo = slide.getAttribute( 'data-background-video' ), + backgroundVideoLoop = slide.hasAttribute( 'data-background-video-loop' ), backgroundIframe = slide.getAttribute( 'data-background-iframe' ); // Images @@ -2599,6 +2600,9 @@ // Videos else if ( backgroundVideo && !isSpeakerNotes() ) { var video = document.createElement( 'video' ); + if ( backgroundVideoLoop ) { + video.setAttribute( 'loop', '' ); + } // Support comma separated lists of video sources backgroundVideo.split( ',' ).forEach( function( source ) {