-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
72 lines (72 loc) · 1.86 KB
/
index.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tulips</title>
<style type="text/css">
html, body, video {
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
}
body {
display: flex;
flex: 1;
flexDirection: column;
justifyContent: center;
alignItems: stretch;
background-color: #000;
}
</style>
<script>
/*
1. make auto-fullscreen
2. separate audio and video, get full audio from clip and play separately
3. mute audio if not fullscreen
*/
</script>
</head>
<body onclick="javascript: switchFullscreen()">
<video src="./tulips_video_cycle.mp4" autoplay loop>
<!--source src="./tulips_video_cycle.mp4" type="video/mp4"-->
<p>Your browser doesn't support HTML5 video. Here is a <a href="./tulips_video_cycle.mp4">link to the video</a> instead.</p>
</video>
<audio loop>
<source src="./street_hq.mp3" type="audio/mp3">
</video>
</body>
<script type="text/javascript">
function switchFullscreen(){
if(isFullscreen()){
disableFullscreen();
}else{
enableFullscreen();
}
}
function disableFullscreen(){
var cfs = document.cancelFullScreen
|| document.webkitCancelFullScreen
|| document.mozCancelFullScreen
|| document.msCancelFullScreen;
cfs && cfs.call(document);
document.querySelector('audio').muted = '1';
}
function enableFullscreen(){
var el = document.body;
var rfs = el.requestFullScreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
|| el.msRequestFullscreen;
rfs && rfs.call(el);
document.querySelector('audio').muted = '';
document.querySelector('audio').play();
}
function isFullscreen(){
return document.isFullScreen
|| document.webkitIsFullScreen
|| document.mozIsFullScreen
|| document.msIsFullScreen;
}
</script>
</html>