diff options
author | Alex Batista <alexbatista.asb@gmail.com> | 2015-09-29 20:49:25 -0300 |
---|---|---|
committer | Alex Batista <alexbatista.asb@gmail.com> | 2015-09-29 20:49:25 -0300 |
commit | 92a69967547ca4849f4c669c0905485f7a1b4856 (patch) | |
tree | d00494ff14434f7939f10c88f4e7984dfcab00b9 /js | |
parent | bcfd0aae3c007d972ac380d72e79dfdd3a5d08e0 (diff) | |
download | perl-software-in-gnu-guix-92a69967547ca4849f4c669c0905485f7a1b4856.tar perl-software-in-gnu-guix-92a69967547ca4849f4c669c0905485f7a1b4856.tar.gz |
Improvement of code. Now none flag is used, but the readyState property from video element
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/js/reveal.js b/js/reveal.js index ae5810c..5b4a545 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}); + }); } } |