video background playback
This commit is contained in:
parent
43bf882d08
commit
170aa31d6f
18
js/reveal.js
18
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(){
|
|||
|
||||
} );
|
||||
|
||||
// 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.
|
||||
if( currentBackground ) {
|
||||
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
|
||||
|
|
6
js/reveal.min.js
vendored
6
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user