diff options
author | Hakim El Hattab | 2016-01-08 14:16:42 +0100 |
---|---|---|
committer | Hakim El Hattab | 2016-01-08 14:16:42 +0100 |
commit | 3d33d27b860bb461d91e765d058f953623f8e39d (patch) | |
tree | da80960d65263889f972fd361e8b91b8ac6e979b /js | |
parent | c0ea2cd98010d16ea90123e26578e19656d6c2dc (diff) | |
parent | ec119e79a7708931267b41d672e6022861fceeb5 (diff) |
tweak implementation of #1376
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/js/reveal.js b/js/reveal.js index c576c8c..e1d80b9 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -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 || ''; |