-
Notifications
You must be signed in to change notification settings - Fork 0
/
video.js
43 lines (37 loc) · 1.23 KB
/
video.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Opening Screen Controller */
// Loading Dots animation
var dots = window.setInterval( function() {
var wait = document.getElementById("dots");
if ( wait.innerHTML.length > 3 )
wait.innerHTML = "";
else
wait.innerHTML += ".";
}, 100);
// Detect opening video events.
let video = document.getElementById('fullscreen-bg__video');
let playButton = document.getElementsByClassName('button')[0];
let firstScreen = document.getElementById('white-background');
// let checkVideo = setInterval(() => {
// if (video.readyState >= video.HAVE_FUTURE_DATA) {
// console.log('Video Can Be Played Now!');
// clearInterval(dots);
// playButton.innerHTML = 'ARE YOU READY?';
// playButton.addEventListener('click', () => {
// video.play();
// firstScreen.remove();
// });
// clearInterval(checkVideo);
// } else {
// console.log('Video Ready State: ' + video.readyState);
// }
// }, 1500);
console.log(video);
video.addEventListener('canplay', (e) => {
console.log('Video Can Be Played Now!');
clearInterval(dots);
playButton.innerHTML = 'ARE YOU READY?';
playButton.addEventListener('click', () => {
video.play();
firstScreen.remove();
});
})