Update index.html
Browse files- index.html +7 -72
index.html
CHANGED
|
@@ -28,16 +28,10 @@
|
|
| 28 |
font-size:15px;
|
| 29 |
text-align:left;
|
| 30 |
}
|
| 31 |
-
|
| 32 |
-
position:fixed; bottom:
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
}
|
| 36 |
-
#myVideo { width:100%; border-radius:8px; }
|
| 37 |
-
.close-btn {
|
| 38 |
-
position:absolute; top:8px; right:8px; color:white; font-size:28px;
|
| 39 |
-
background:rgba(255,60,60,0.9); width:32px; height:32px; border-radius:50%;
|
| 40 |
-
display:flex; align-items:center; justify-content:center; z-index:1001;
|
| 41 |
}
|
| 42 |
</style>
|
| 43 |
</head>
|
|
@@ -59,54 +53,22 @@
|
|
| 59 |
<button onclick="alert('Knowledge Base - Coming soon')">📖 Knowledge</button>
|
| 60 |
</div>
|
| 61 |
|
| 62 |
-
<
|
| 63 |
-
<div class="close-btn" onclick="closeVideo()">×</div>
|
| 64 |
-
<video id="myVideo" controls loop></video>
|
| 65 |
-
</div>
|
| 66 |
-
|
| 67 |
-
<button onclick="enterVR()" style="position:fixed; bottom:30px; right:30px; padding:10px 18px; background:rgba(255,255,255,0.1); color:white; border:2px solid white; border-radius:8px; font-size:15px; z-index:1000;">VR</button>
|
| 68 |
|
| 69 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
| 70 |
-
<input type="file" id="screenInput" accept="video/*,image/*" style="display:none;">
|
| 71 |
|
| 72 |
<script>
|
| 73 |
-
let skyVideo = null;
|
| 74 |
-
const screenVideo = document.getElementById('myVideo');
|
| 75 |
-
const container = document.getElementById('videoContainer');
|
| 76 |
-
|
| 77 |
function togglePanel() {
|
| 78 |
const panel = document.getElementById('panel');
|
| 79 |
panel.style.display = panel.style.display === 'flex' ? 'none' : 'flex';
|
| 80 |
}
|
| 81 |
|
| 82 |
function launchSky() { document.getElementById('skyInput').click(); }
|
| 83 |
-
function pickScreenMedia() { document.getElementById('screenInput').click(); }
|
| 84 |
-
|
| 85 |
-
function playSky() {
|
| 86 |
-
if (skyVideo) skyVideo.play();
|
| 87 |
-
else screenVideo.play();
|
| 88 |
-
}
|
| 89 |
-
function pauseSky() {
|
| 90 |
-
if (skyVideo) skyVideo.pause();
|
| 91 |
-
else screenVideo.pause();
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
function toggleMute() {
|
| 95 |
-
if (skyVideo) skyVideo.muted = !skyVideo.muted;
|
| 96 |
-
else screenVideo.muted = !screenVideo.muted;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
function closeVideo() {
|
| 100 |
-
screenVideo.pause();
|
| 101 |
-
container.style.display = 'none';
|
| 102 |
-
}
|
| 103 |
|
| 104 |
function enterVR() {
|
| 105 |
const scene = document.querySelector('a-scene');
|
| 106 |
if (scene) {
|
| 107 |
-
scene.enterVR();
|
| 108 |
-
} else {
|
| 109 |
-
alert("VR mode not available on this device");
|
| 110 |
}
|
| 111 |
}
|
| 112 |
|
|
@@ -115,34 +77,7 @@
|
|
| 115 |
const file = e.target.files[0];
|
| 116 |
if (!file) return;
|
| 117 |
const url = URL.createObjectURL(file);
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
if (file.type.startsWith('video/')) {
|
| 121 |
-
if (skyVideo) skyVideo.pause();
|
| 122 |
-
skyVideo = document.createElement('video');
|
| 123 |
-
skyVideo.src = url;
|
| 124 |
-
skyVideo.loop = true;
|
| 125 |
-
skyVideo.muted = true;
|
| 126 |
-
skyVideo.style.display = 'none';
|
| 127 |
-
document.body.appendChild(skyVideo);
|
| 128 |
-
|
| 129 |
-
const texture = new THREE.VideoTexture(skyVideo);
|
| 130 |
-
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 131 |
-
sky.setAttribute('material', { src: texture, shader: 'flat', side: 'back' });
|
| 132 |
-
skyVideo.play();
|
| 133 |
-
} else {
|
| 134 |
-
sky.setAttribute('src', url);
|
| 135 |
-
}
|
| 136 |
-
});
|
| 137 |
-
|
| 138 |
-
// Screen Media
|
| 139 |
-
document.getElementById('screenInput').addEventListener('change', function(e) {
|
| 140 |
-
const file = e.target.files[0];
|
| 141 |
-
if (!file) return;
|
| 142 |
-
const url = URL.createObjectURL(file);
|
| 143 |
-
screenVideo.src = url;
|
| 144 |
-
container.style.display = 'block';
|
| 145 |
-
screenVideo.play();
|
| 146 |
});
|
| 147 |
</script>
|
| 148 |
</body>
|
|
|
|
| 28 |
font-size:15px;
|
| 29 |
text-align:left;
|
| 30 |
}
|
| 31 |
+
.vr-btn {
|
| 32 |
+
position:fixed; bottom:30px; right:30px; padding:10px 18px;
|
| 33 |
+
background:rgba(255,255,255,0.1); color:white; border:2px solid white;
|
| 34 |
+
border-radius:8px; font-size:15px; z-index:1010; cursor:pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
</style>
|
| 37 |
</head>
|
|
|
|
| 53 |
<button onclick="alert('Knowledge Base - Coming soon')">📖 Knowledge</button>
|
| 54 |
</div>
|
| 55 |
|
| 56 |
+
<button class="vr-btn" onclick="enterVR()">VR</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
|
|
|
| 59 |
|
| 60 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
function togglePanel() {
|
| 62 |
const panel = document.getElementById('panel');
|
| 63 |
panel.style.display = panel.style.display === 'flex' ? 'none' : 'flex';
|
| 64 |
}
|
| 65 |
|
| 66 |
function launchSky() { document.getElementById('skyInput').click(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
function enterVR() {
|
| 69 |
const scene = document.querySelector('a-scene');
|
| 70 |
if (scene) {
|
| 71 |
+
scene.enterVR().catch(() => alert("VR mode not supported on this device"));
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
}
|
| 74 |
|
|
|
|
| 77 |
const file = e.target.files[0];
|
| 78 |
if (!file) return;
|
| 79 |
const url = URL.createObjectURL(file);
|
| 80 |
+
document.getElementById('sky').setAttribute('src', url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
});
|
| 82 |
</script>
|
| 83 |
</body>
|