浏览代码

video background playback

Hakim El Hattab 11 年之前
父节点
当前提交
170aa31d6f
共有 2 个文件被更改,包括 18 次插入4 次删除
  1. 17 3
      js/reveal.js
  2. 1 1
      js/reveal.min.js

+ 17 - 3
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

文件差异内容过多而无法显示
+ 1 - 1
js/reveal.min.js


部分文件因为文件数量过多而无法显示