Skip to content

Commit

Permalink
tweak implementation of #1376
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Jan 8, 2016
2 parents c0ea2cd + ec119e7 commit 3d33d27
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2728,8 +2728,20 @@
// Start video playback
var currentVideo = currentBackground.querySelector( 'video' );
if( currentVideo ) {
if( currentVideo.currentTime > 0 ) currentVideo.currentTime = 0;
currentVideo.play();

var startVideo = function() {
currentVideo.currentTime = 0;
currentVideo.play();
currentVideo.removeEventListener( 'loadeddata', startVideo );
};

if( currentVideo.readyState > 1 ) {
startVideo();
}
else {
currentVideo.addEventListener( 'loadeddata', startVideo );
}

}

var backgroundImageURL = currentBackground.style.backgroundImage || '';
Expand Down

0 comments on commit 3d33d27

Please sign in to comment.