From bcfd0aae3c007d972ac380d72e79dfdd3a5d08e0 Mon Sep 17 00:00:00 2001 From: Alex Batista Date: Mon, 28 Sep 2015 23:04:47 -0300 Subject: [PATCH 1/6] bug fix - when the first section has a background-video, the vido do not execute. Now, it's work --- js/reveal.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 65ac29ff..ae5810c1 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -147,6 +147,10 @@ // Flags if reveal.js is loaded (has dispatched the 'ready' event) loaded = false, + // Flags if video background is loaded + loadeddataVideo = false, + + // The horizontal and vertical index of the currently active slide indexh, indexv, @@ -2472,8 +2476,17 @@ // Start video playback var currentVideo = currentBackground.querySelector( 'video' ); if( currentVideo ) { - currentVideo.currentTime = 0; - currentVideo.play(); + + currentVideo.addEventListener("loadeddata", function() { + currentVideo.currentTime = 0; + currentVideo.play(); + loadeddataVideo = true; + this.removeEventListener("loadeddata",function(){return false}); + }); + if(loadeddataVideo === true){ + currentVideo.currentTime = 0; + currentVideo.play(); + } } // Don't transition between identical backgrounds. This From b0d6e5578f50483abff747d200146baa401de11e Mon Sep 17 00:00:00 2001 From: Alex Batista Date: Tue, 29 Sep 2015 15:18:17 -0300 Subject: [PATCH 2/6] improvement on spaces and indentation --- js/reveal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index ae5810c1..ce5c2b6a 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -150,7 +150,6 @@ // Flags if video background is loaded loadeddataVideo = false, - // The horizontal and vertical index of the currently active slide indexh, indexv, @@ -2481,8 +2480,9 @@ currentVideo.currentTime = 0; currentVideo.play(); loadeddataVideo = true; - this.removeEventListener("loadeddata",function(){return false}); + this.removeEventListener("loadeddata",function(){return false}); }); + if(loadeddataVideo === true){ currentVideo.currentTime = 0; currentVideo.play(); From 92a69967547ca4849f4c669c0905485f7a1b4856 Mon Sep 17 00:00:00 2001 From: Alex Batista Date: Tue, 29 Sep 2015 20:49:25 -0300 Subject: [PATCH 3/6] Improvement of code. Now none flag is used, but the readyState property from video element --- js/reveal.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index ae5810c1..5b4a545c 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -150,7 +150,6 @@ // Flags if video background is loaded loadeddataVideo = false, - // The horizontal and vertical index of the currently active slide indexh, indexv, @@ -2473,19 +2472,19 @@ if( currentBackground ) { - // Start video playback - var currentVideo = currentBackground.querySelector( 'video' ); - if( currentVideo ) { - - currentVideo.addEventListener("loadeddata", function() { + // Start video playback + var currentVideo = currentBackground.querySelector( 'video' ); + if( currentVideo ) { + if(currentVideo.readyState >1){ currentVideo.currentTime = 0; currentVideo.play(); - loadeddataVideo = true; - this.removeEventListener("loadeddata",function(){return false}); - }); - if(loadeddataVideo === true){ + } + else{ + currentVideo.addEventListener("loadeddata", function() { currentVideo.currentTime = 0; currentVideo.play(); + currentVideo.removeEventListener("loadeddata",function(){return false}); + }); } } From e258db0994a435075b0c94b757abb40adf90aa18 Mon Sep 17 00:00:00 2001 From: Alex Batista Date: Tue, 29 Sep 2015 21:01:50 -0300 Subject: [PATCH 4/6] UPDATED - Improvement of code. Now none flag is used, but the readyState property from video element --- js/reveal.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 5b4a545c..3758a41a 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -147,9 +147,6 @@ // Flags if reveal.js is loaded (has dispatched the 'ready' event) loaded = false, - // Flags if video background is loaded - loadeddataVideo = false, - // The horizontal and vertical index of the currently active slide indexh, indexv, From c1cb328e19c5bc95d26db0caa21e9ab16561dacc Mon Sep 17 00:00:00 2001 From: Alex Batista Date: Tue, 29 Sep 2015 21:07:02 -0300 Subject: [PATCH 5/6] UPDATED - Improvement on spaces and indentation --- js/reveal.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 3758a41a..9d4b3444 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2469,10 +2469,11 @@ if( currentBackground ) { - // Start video playback - var currentVideo = currentBackground.querySelector( 'video' ); - if( currentVideo ) { - if(currentVideo.readyState >1){ + // Start video playback + var currentVideo = currentBackground.querySelector( 'video' ); + if( currentVideo ) { + + if(currentVideo.readyState >1){ currentVideo.currentTime = 0; currentVideo.play(); } @@ -2483,6 +2484,7 @@ currentVideo.removeEventListener("loadeddata",function(){return false}); }); } + } // Don't transition between identical backgrounds. This From ec119e79a7708931267b41d672e6022861fceeb5 Mon Sep 17 00:00:00 2001 From: Alex Batista Date: Tue, 29 Sep 2015 21:09:41 -0300 Subject: [PATCH 6/6] UPDATED - Improvement on spaces and indentation --- js/reveal.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 9d4b3444..421fa2c3 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2472,19 +2472,17 @@ // Start video playback var currentVideo = currentBackground.querySelector( 'video' ); if( currentVideo ) { - - if(currentVideo.readyState >1){ + if(currentVideo.readyState > 1){ currentVideo.currentTime = 0; currentVideo.play(); } else{ currentVideo.addEventListener("loadeddata", function() { - currentVideo.currentTime = 0; - currentVideo.play(); - currentVideo.removeEventListener("loadeddata",function(){return false}); + currentVideo.currentTime = 0; + currentVideo.play(); + currentVideo.removeEventListener("loadeddata",function(){return false}); }); } - } // Don't transition between identical backgrounds. This