Spaces:
Running
Running
Update index.html
Browse files- index.html +167 -6
index.html
CHANGED
|
@@ -13,7 +13,6 @@
|
|
| 13 |
box-shadow:0 0 18px #ff3366, 0 0 35px #ff3366, inset 0 0 12px rgba(255,255,255,0.3);
|
| 14 |
z-index:1000; cursor:pointer;
|
| 15 |
}
|
| 16 |
-
|
| 17 |
#panel {
|
| 18 |
position:fixed; bottom:88px; left:22px; width:205px;
|
| 19 |
background:rgba(20,0,10,0.12); backdrop-filter:blur(18px);
|
|
@@ -21,20 +20,16 @@
|
|
| 21 |
border-radius:16px; padding:12px; display:none; flex-direction:column; gap:8px;
|
| 22 |
z-index:1002;
|
| 23 |
}
|
| 24 |
-
|
| 25 |
button {
|
| 26 |
background:rgba(255,50,50,0.08); color:#ff99aa; border:1px solid #ff3366;
|
| 27 |
box-shadow:0 0 12px #ff3366; padding:11px 12px; border-radius:10px; font-size:15px;
|
| 28 |
}
|
| 29 |
-
|
| 30 |
#videoContainer {
|
| 31 |
position:fixed; bottom:170px; left:50%; transform:translateX(-50%);
|
| 32 |
width:380px; display:none; z-index:1000; background:rgba(0,0,0,0.85);
|
| 33 |
border-radius:12px; padding:8px;
|
| 34 |
}
|
| 35 |
-
|
| 36 |
#myVideo { width:100%; border-radius:8px; }
|
| 37 |
-
|
| 38 |
.close-btn {
|
| 39 |
position:absolute; top:12px; right:12px; color:white; font-size:24px;
|
| 40 |
background:rgba(255,60,60,0.9); width:28px; height:28px; border-radius:50%;
|
|
@@ -74,6 +69,172 @@
|
|
| 74 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
| 75 |
<input type="file" id="screenInput" accept="video/*" style="display:none;">
|
| 76 |
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
background:rgba(20,0,10,0.12); backdrop-filter:blur(18px);
|
|
|
|
| 20 |
border-radius:16px; padding:12px; display:none; flex-direction:column; gap:8px;
|
| 21 |
z-index:1002;
|
| 22 |
}
|
|
|
|
| 23 |
button {
|
| 24 |
background:rgba(255,50,50,0.08); color:#ff99aa; border:1px solid #ff3366;
|
| 25 |
box-shadow:0 0 12px #ff3366; padding:11px 12px; border-radius:10px; font-size:15px;
|
| 26 |
}
|
|
|
|
| 27 |
#videoContainer {
|
| 28 |
position:fixed; bottom:170px; left:50%; transform:translateX(-50%);
|
| 29 |
width:380px; display:none; z-index:1000; background:rgba(0,0,0,0.85);
|
| 30 |
border-radius:12px; padding:8px;
|
| 31 |
}
|
|
|
|
| 32 |
#myVideo { width:100%; border-radius:8px; }
|
|
|
|
| 33 |
.close-btn {
|
| 34 |
position:absolute; top:12px; right:12px; color:white; font-size:24px;
|
| 35 |
background:rgba(255,60,60,0.9); width:28px; height:28px; border-radius:50%;
|
|
|
|
| 69 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
| 70 |
<input type="file" id="screenInput" accept="video/*" style="display:none;">
|
| 71 |
|
| 72 |
+
<script>
|
| 73 |
+
let videos = [];
|
| 74 |
+
let skyVideo = null;
|
| 75 |
+
const screenVideo = document.getElementById('myVideo');
|
| 76 |
+
const container = document.getElementById('videoContainer');
|
| 77 |
+
|
| 78 |
+
function togglePanel() {
|
| 79 |
+
const panel = document.getElementById('panel');
|
| 80 |
+
panel.style.display = (panel.style.display === 'flex') ? 'none' : 'flex';
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
function launchSky() { document.getElementById('skyInput').click(); }
|
| 84 |
+
function addLeftScreen() {
|
| 85 |
+
document.getElementById('screenInput').click();
|
| 86 |
+
document.getElementById('screenInput').onchange = (e) => handleNewVideo(e, 'left');
|
| 87 |
+
}
|
| 88 |
+
function addRightScreen() {
|
| 89 |
+
document.getElementById('screenInput').click();
|
| 90 |
+
document.getElementById('screenInput').onchange = (e) => handleNewVideo(e, 'right');
|
| 91 |
+
}
|
| 92 |
+
function pickScreenMedia() {
|
| 93 |
+
document.getElementById('screenInput').click();
|
| 94 |
+
document.getElementById('screenInput').onchange = (e) => handleBrowserVideo(e);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
function handleNewVideo(e, side) {
|
| 98 |
+
const file = e.target.files[0];
|
| 99 |
+
if (!file || !file.type.startsWith('video/')) return;
|
| 100 |
+
|
| 101 |
+
const url = URL.createObjectURL(file);
|
| 102 |
+
const scene = document.querySelector('a-scene');
|
| 103 |
+
const xPos = side === 'left' ? -5.2 : 5.2;
|
| 104 |
+
|
| 105 |
+
const plane = document.createElement('a-plane');
|
| 106 |
+
plane.setAttribute('width', '10');
|
| 107 |
+
plane.setAttribute('height', '6');
|
| 108 |
+
plane.setAttribute('position', `${xPos} 4 -10`);
|
| 109 |
+
plane.setAttribute('material', 'shader:flat; side:double; color:#fff');
|
| 110 |
+
scene.appendChild(plane);
|
| 111 |
+
|
| 112 |
+
const video = document.createElement('video');
|
| 113 |
+
video.src = url;
|
| 114 |
+
video.loop = true;
|
| 115 |
+
video.volume = 0.7;
|
| 116 |
+
video.muted = false;
|
| 117 |
+
|
| 118 |
+
const texture = new THREE.VideoTexture(video);
|
| 119 |
+
|
| 120 |
+
video.onloadeddata = function() {
|
| 121 |
+
const mesh = plane.object3DMap.mesh;
|
| 122 |
+
if (mesh && mesh.material) {
|
| 123 |
+
mesh.material.map = texture;
|
| 124 |
+
mesh.material.needsUpdate = true;
|
| 125 |
+
}
|
| 126 |
+
video.play();
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
video.load();
|
| 130 |
+
|
| 131 |
+
const videoData = { video: video, name: file.name, side: side };
|
| 132 |
+
videos.push(videoData);
|
| 133 |
+
|
| 134 |
+
createControlButtons(videoData);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
function handleBrowserVideo(e) {
|
| 138 |
+
const file = e.target.files[0];
|
| 139 |
+
if (!file) return;
|
| 140 |
+
const url = URL.createObjectURL(file);
|
| 141 |
+
screenVideo.src = url;
|
| 142 |
+
container.style.display = 'block';
|
| 143 |
+
screenVideo.play();
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
function createControlButtons(videoData) {
|
| 147 |
+
const panel = document.getElementById('panel');
|
| 148 |
+
|
| 149 |
+
const label = document.createElement('div');
|
| 150 |
+
label.style.color = '#ff99aa';
|
| 151 |
+
label.style.fontSize = '14px';
|
| 152 |
+
label.style.padding = '4px 0 2px 0';
|
| 153 |
+
label.textContent = `${videoData.side.toUpperCase()} SCREEN`;
|
| 154 |
+
panel.appendChild(label);
|
| 155 |
+
|
| 156 |
+
const controls = document.createElement('div');
|
| 157 |
+
controls.style.display = 'flex';
|
| 158 |
+
controls.style.gap = '6px';
|
| 159 |
+
|
| 160 |
+
const playBtn = document.createElement('button');
|
| 161 |
+
playBtn.textContent = '▶️ / ⏸️';
|
| 162 |
+
playBtn.onclick = () => {
|
| 163 |
+
if (videoData.video.paused) videoData.video.play();
|
| 164 |
+
else videoData.video.pause();
|
| 165 |
+
};
|
| 166 |
+
controls.appendChild(playBtn);
|
| 167 |
+
|
| 168 |
+
const muteBtn = document.createElement('button');
|
| 169 |
+
muteBtn.textContent = '🔊 / 🔇';
|
| 170 |
+
muteBtn.onclick = () => {
|
| 171 |
+
videoData.video.muted = !videoData.video.muted;
|
| 172 |
+
};
|
| 173 |
+
controls.appendChild(muteBtn);
|
| 174 |
+
|
| 175 |
+
panel.appendChild(controls);
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
function playSky() {
|
| 179 |
+
if (skyVideo) skyVideo.play();
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
function pauseSky() {
|
| 183 |
+
if (skyVideo) skyVideo.pause();
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
function toggleSkyMute() {
|
| 187 |
+
if (skyVideo) skyVideo.muted = !skyVideo.muted;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
function closeVideo() {
|
| 191 |
+
screenVideo.pause();
|
| 192 |
+
container.style.display = 'none';
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
function openAIChat() {
|
| 196 |
+
window.location.href = "http://localhost:8000";
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// Sky Launcher
|
| 200 |
+
document.getElementById('skyInput').addEventListener('change', function(e) {
|
| 201 |
+
const file = e.target.files[0];
|
| 202 |
+
if (!file) return;
|
| 203 |
+
|
| 204 |
+
const url = URL.createObjectURL(file);
|
| 205 |
+
const isVideo = file.type.startsWith('video/');
|
| 206 |
+
|
| 207 |
+
if (isVideo) {
|
| 208 |
+
if (skyVideo) skyVideo.pause();
|
| 209 |
+
skyVideo = document.createElement('video');
|
| 210 |
+
skyVideo.src = url;
|
| 211 |
+
skyVideo.loop = true;
|
| 212 |
+
skyVideo.muted = false;
|
| 213 |
+
skyVideo.volume = 0.6;
|
| 214 |
+
|
| 215 |
+
skyVideo.onloadeddata = () => {
|
| 216 |
+
const mesh = document.getElementById('sky').getObject3D('mesh');
|
| 217 |
+
if (mesh && mesh.material) {
|
| 218 |
+
const texture = new THREE.VideoTexture(skyVideo);
|
| 219 |
+
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 220 |
+
mesh.material.map = texture;
|
| 221 |
+
mesh.material.needsUpdate = true;
|
| 222 |
+
skyVideo.play();
|
| 223 |
+
}
|
| 224 |
+
};
|
| 225 |
+
skyVideo.load();
|
| 226 |
+
} else {
|
| 227 |
+
const loader = new THREE.TextureLoader();
|
| 228 |
+
loader.load(url, function(texture) {
|
| 229 |
+
const mesh = document.getElementById('sky').getObject3D('mesh');
|
| 230 |
+
if (mesh && mesh.material) {
|
| 231 |
+
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 232 |
+
mesh.material.map = texture;
|
| 233 |
+
mesh.material.needsUpdate = true;
|
| 234 |
+
}
|
| 235 |
+
});
|
| 236 |
+
}
|
| 237 |
+
});
|
| 238 |
+
</script>
|
| 239 |
</body>
|
| 240 |
</html>
|