Improvement of code. Now none flag is used, but the readyState property from video element
This commit is contained in:
parent
bcfd0aae3c
commit
92a6996754
19
js/reveal.js
19
js/reveal.js
|
@ -150,7 +150,6 @@
|
||||||
// Flags if video background is loaded
|
// Flags if video background is loaded
|
||||||
loadeddataVideo = false,
|
loadeddataVideo = false,
|
||||||
|
|
||||||
|
|
||||||
// The horizontal and vertical index of the currently active slide
|
// The horizontal and vertical index of the currently active slide
|
||||||
indexh,
|
indexh,
|
||||||
indexv,
|
indexv,
|
||||||
|
@ -2473,19 +2472,19 @@
|
||||||
|
|
||||||
if( currentBackground ) {
|
if( currentBackground ) {
|
||||||
|
|
||||||
// Start video playback
|
// Start video playback
|
||||||
var currentVideo = currentBackground.querySelector( 'video' );
|
var currentVideo = currentBackground.querySelector( 'video' );
|
||||||
if( currentVideo ) {
|
if( currentVideo ) {
|
||||||
|
if(currentVideo.readyState >1){
|
||||||
currentVideo.addEventListener("loadeddata", function() {
|
|
||||||
currentVideo.currentTime = 0;
|
currentVideo.currentTime = 0;
|
||||||
currentVideo.play();
|
currentVideo.play();
|
||||||
loadeddataVideo = true;
|
}
|
||||||
this.removeEventListener("loadeddata",function(){return false});
|
else{
|
||||||
});
|
currentVideo.addEventListener("loadeddata", function() {
|
||||||
if(loadeddataVideo === true){
|
|
||||||
currentVideo.currentTime = 0;
|
currentVideo.currentTime = 0;
|
||||||
currentVideo.play();
|
currentVideo.play();
|
||||||
|
currentVideo.removeEventListener("loadeddata",function(){return false});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue