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 ) {
|
if( includeAll || h === indexh ) {
|
||||||
toArray( backgroundh.childNodes ).forEach( function( backgroundv, v ) {
|
toArray( backgroundh.querySelectorAll( 'section' ) ).forEach( function( backgroundv, v ) {
|
||||||
|
|
||||||
if( v < indexv ) {
|
if( v < indexv ) {
|
||||||
backgroundv.className = 'slide-background past';
|
backgroundv.className = 'slide-background past';
|
||||||
|
@ -2021,9 +2021,22 @@ var Reveal = (function(){
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Don't transition between identical backgrounds. This
|
// Stop any currently playing video background
|
||||||
// prevents unwanted flicker.
|
if( previousBackground ) {
|
||||||
|
|
||||||
|
var previousVideo = previousBackground.querySelector( 'video' );
|
||||||
|
if( previousVideo ) previousVideo.pause();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if( currentBackground ) {
|
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 previousBackgroundHash = previousBackground ? previousBackground.getAttribute( 'data-background-hash' ) : null;
|
||||||
var currentBackgroundHash = currentBackground.getAttribute( 'data-background-hash' );
|
var currentBackgroundHash = currentBackground.getAttribute( 'data-background-hash' );
|
||||||
if( currentBackgroundHash && currentBackgroundHash === previousBackgroundHash && currentBackground !== previousBackground ) {
|
if( currentBackgroundHash && currentBackgroundHash === previousBackgroundHash && currentBackground !== previousBackground ) {
|
||||||
|
@ -2031,6 +2044,7 @@ var Reveal = (function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
previousBackground = currentBackground;
|
previousBackground = currentBackground;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the first background to apply without transition
|
// 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