video background playback
This commit is contained in:
parent
43bf882d08
commit
170aa31d6f
20
js/reveal.js
20
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
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue