-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.html
148 lines (136 loc) · 4.81 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<title>VR player</title>
<style>
* {
margin: 0;
padding: 0;
}
body {
overflow: hidden;
}
.loader {
position: absolute;
right: 0px;
bottom: 20%;
padding: 5px;
font-size: 15px;
background-color: #d4d4d4;
color: rgb(0, 0, 0);
width: 20%;
font-family: Arial, Helvetica, sans-serif;
}
.loader pre {
color: rgb(20, 63, 129);
}
.loader input {
margin-top: 5px;
width: 100%;
}
.btn {
background-color: #19abff;
border: none;
color: white;
padding: 5px;
width: 100%;
margin-top: 5px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
.loader .close {
width: 35px;
position: absolute;
top: -34px;
right: 0;
}
.open {
position: absolute;
width: 135px;
right: 0;
bottom: 25px;
font-family: Arial, Helvetica, sans-serif;
visibility: hidden;
}
footer {
position: absolute;
bottom: 0px;
right: 0px;
justify-content: center;
padding: 5px;
font-size: 12px;
height: 15px;
max-height: 15px !important;
background-color: #d4d4d4;
color: rgb(0, 0, 0);
}
</style>
<script defer src="dist/index.js"></script>
<script defer src="dist/jsonLoader.js"></script>
</head>
<body>
<div id="three_scene"></div>
<video id="video" crossorigin="anonymous" playsinline style="display: none">
<source id="video_src" src="" type="video/mp4" />
</video>
<div class="loader" id="loader">
<button class="close btn" onclick="document.getElementById('loader').style.visibility = 'hidden';document.getElementById('open_loader').style.visibility = 'visible';">X</button>
<p>
To load your file, your web server needs to return CORS headers.<br />
Install apache2 mod:
<pre>sudo a2enmod headers</pre>
<br />
Add CORS header to your videos directory (and place where json is
located if it's different):
<pre><Directory /var/www/html/videos><br>Header set Access-Control-Allow-Origin "*"<br></Directory></pre>
<input placeholder="JSON url" id="json_url" />
<input placeholder="Name" id="json_name" />
<button onclick="loadFromURL()">Load</button>
</p>
</div>
<button class="open btn" id="open_loader" onclick="document.getElementById('loader').style.visibility = 'visible';document.getElementById('open_loader').style.visibility = 'hidden';">Loader</button>
<footer>
<p>
Icons made by <a target="_blank" href="https://www.flaticon.com/authors/nawicon">nawicon</a>, <a
target="_blank" href="https://www.flaticon.com/authors/alfanz">alfanz</a>, <a target="_blank"
href="https://www.flaticon.com/authors/ayub-irawan">ayub-irawan</a>, <a target="_blank"
href="https://www.flaticon.com/authors/us-and-up">us-and-up</a>, <a target="_blank"
href="https://www.flaticon.com/authors/freepik">freepik</a>, from <a target="_blank"
href="http://www.flaticon.com/">www.flaticon.com</a>
</p>
</footer>
</body>
<script>
async function loadFromURL() {
try {
const JL = new JsonLoader(
document.getElementById("json_url").value,
true,
document.getElementById("json_name").value
);
await JL.load();
if (JL.status == "error") {
throw new Error(JL.error);
} else {
document.getElementById("json_url").value = "";
document.getElementById("json_name").value = "";
alert("Loaded, you can refresh sources.");
}
} catch (error) {
alert(error);
}
}
</script>
<script defer type="module">
try {
new JsonLoader("files.json").load();
} catch (error) {
console.warn(error);
}
</script>
</html>