1
0
Fork 0

Merge pull request #1138 from denehyg/background-video-loop

background video loop
This commit is contained in:
Hakim El Hattab 2015-02-25 15:48:48 +01:00
commit a245a87e38
2 changed files with 6 additions and 2 deletions

View File

@ -431,8 +431,8 @@ Slides are contained within a limited portion of the screen by default to allow
<section data-background="http://example.com/image.png" data-background-size="100px" data-background-repeat="repeat"> <section data-background="http://example.com/image.png" data-background-size="100px" data-background-repeat="repeat">
<h2>This background image will be sized to 100px and repeated.</h2> <h2>This background image will be sized to 100px and repeated.</h2>
</section> </section>
<section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm"> <section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm" data-background-video-loop>
<h2>Video. Multiple sources can be defined using a comma separated list.</h2> <h2>Video. Multiple sources can be defined using a comma separated list. Video will loop when the data-background-video-loop attribute is provided.</h2>
</section> </section>
<section data-background-iframe="https://slides.com"> <section data-background-iframe="https://slides.com">
<h2>Embeds a web page as a background. Note that the page won't be interactive.</h2> <h2>Embeds a web page as a background. Note that the page won't be interactive.</h2>

View File

@ -2756,6 +2756,7 @@
var backgroundImage = slide.getAttribute( 'data-background-image' ), var backgroundImage = slide.getAttribute( 'data-background-image' ),
backgroundVideo = slide.getAttribute( 'data-background-video' ), backgroundVideo = slide.getAttribute( 'data-background-video' ),
backgroundVideoLoop = slide.hasAttribute( 'data-background-video-loop' ),
backgroundIframe = slide.getAttribute( 'data-background-iframe' ); backgroundIframe = slide.getAttribute( 'data-background-iframe' );
// Images // Images
@ -2765,6 +2766,9 @@
// Videos // Videos
else if ( backgroundVideo && !isSpeakerNotes() ) { else if ( backgroundVideo && !isSpeakerNotes() ) {
var video = document.createElement( 'video' ); var video = document.createElement( 'video' );
if ( backgroundVideoLoop ) {
video.setAttribute( 'loop', '' );
}
// Support comma separated lists of video sources // Support comma separated lists of video sources
backgroundVideo.split( ',' ).forEach( function( source ) { backgroundVideo.split( ',' ).forEach( function( source ) {