Spaces:
Running
Running
Update index.html
Browse files- index.html +19 -199
index.html
CHANGED
|
@@ -21,8 +21,14 @@
|
|
| 21 |
z-index:1002;
|
| 22 |
}
|
| 23 |
button {
|
| 24 |
-
background:rgba(255,50,50,0.08);
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
#videoContainer {
|
| 28 |
position:fixed; bottom:170px; left:50%; transform:translateX(-50%);
|
|
@@ -47,16 +53,16 @@
|
|
| 47 |
<div id="bead" onclick="togglePanel()"></div>
|
| 48 |
|
| 49 |
<div id="panel">
|
| 50 |
-
<button onclick="launchSky()"> Sky Launcher</button>
|
| 51 |
-
<button onclick="Leftvideopanel()"> Add Left Screen</button>
|
| 52 |
-
<button onclick="Rightvideopanel()"> Add Right Screen</button>
|
| 53 |
-
<button onclick="playSky()"> Play Sky</button>
|
| 54 |
-
<button onclick="pauseSky()"> Pause Sky</button>
|
| 55 |
-
<button onclick="Mutesky()"> Sky Mute</button>
|
| 56 |
-
<button onclick="Mediaplayer()"> Browser Player</button>
|
| 57 |
-
<button onclick="AIChat()"> AI Chat</button>
|
| 58 |
-
<button onclick="enterVRMode()"> Enter VR Mode</button>
|
| 59 |
-
<button onclick="enterARMode()"> Enter AR Mode</button>
|
| 60 |
</div>
|
| 61 |
|
| 62 |
<div id="videoContainer">
|
|
@@ -65,190 +71,4 @@
|
|
| 65 |
</div>
|
| 66 |
|
| 67 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
| 68 |
-
<input type="file" id="screenInput" accept="video/*" style="display:none;">
|
| 69 |
-
|
| 70 |
-
<script>
|
| 71 |
-
let videos = [];
|
| 72 |
-
let skyVideo = null;
|
| 73 |
-
let screenVideo = null;
|
| 74 |
-
let container = null;
|
| 75 |
-
|
| 76 |
-
function togglePanel() {
|
| 77 |
-
const panel = document.getElementById('panel');
|
| 78 |
-
panel.style.display = (panel.style.display === 'flex') ? 'none' : 'flex';
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
function enterVRMode() {
|
| 82 |
-
const scene = document.querySelector('a-scene');
|
| 83 |
-
if (scene) scene.enterVR();
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
function enterARMode() {
|
| 87 |
-
const scene = document.querySelector('a-scene');
|
| 88 |
-
if (scene) scene.enterAR();
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
function launchSky() { document.getElementById('skyInput').click(); }
|
| 92 |
-
function addLeftScreen() {
|
| 93 |
-
document.getElementById('screenInput').click();
|
| 94 |
-
document.getElementById('screenInput').onchange = (e) => handleNewVideo(e, 'left');
|
| 95 |
-
}
|
| 96 |
-
function addRightScreen() {
|
| 97 |
-
document.getElementById('screenInput').click();
|
| 98 |
-
document.getElementById('screenInput').onchange = (e) => handleNewVideo(e, 'right');
|
| 99 |
-
}
|
| 100 |
-
function pickScreenMedia() {
|
| 101 |
-
document.getElementById('screenInput').click();
|
| 102 |
-
document.getElementById('screenInput').onchange = (e) => handleBrowserVideo(e);
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
function handleNewVideo(e, side) {
|
| 106 |
-
const file = e.target.files[0];
|
| 107 |
-
if (!file || !file.type.startsWith('video/')) return;
|
| 108 |
-
|
| 109 |
-
const url = URL.createObjectURL(file);
|
| 110 |
-
const scene = document.querySelector('a-scene');
|
| 111 |
-
const xPos = side === 'left' ? -5.2 : 5.2;
|
| 112 |
-
|
| 113 |
-
const plane = document.createElement('a-plane');
|
| 114 |
-
plane.setAttribute('width', '10');
|
| 115 |
-
plane.setAttribute('height', '6');
|
| 116 |
-
plane.setAttribute('position', `${xPos} 4 -10`);
|
| 117 |
-
plane.setAttribute('material', 'shader:flat; side:double; color:#fff');
|
| 118 |
-
scene.appendChild(plane);
|
| 119 |
-
|
| 120 |
-
const video = document.createElement('video');
|
| 121 |
-
video.src = url;
|
| 122 |
-
video.loop = true;
|
| 123 |
-
video.volume = 0.7;
|
| 124 |
-
video.muted = false;
|
| 125 |
-
|
| 126 |
-
const texture = new THREE.VideoTexture(video);
|
| 127 |
-
|
| 128 |
-
video.onloadeddata = function() {
|
| 129 |
-
const mesh = plane.object3DMap.mesh;
|
| 130 |
-
if (mesh && mesh.material) {
|
| 131 |
-
mesh.material.map = texture;
|
| 132 |
-
mesh.material.needsUpdate = true;
|
| 133 |
-
}
|
| 134 |
-
video.play();
|
| 135 |
-
};
|
| 136 |
-
|
| 137 |
-
video.load();
|
| 138 |
-
|
| 139 |
-
const videoData = { video: video, name: file.name, side: side };
|
| 140 |
-
videos.push(videoData);
|
| 141 |
-
|
| 142 |
-
createControlButtons(videoData);
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
function handleBrowserVideo(e) {
|
| 146 |
-
const file = e.target.files[0];
|
| 147 |
-
if (!file) return;
|
| 148 |
-
const url = URL.createObjectURL(file);
|
| 149 |
-
screenVideo.src = url;
|
| 150 |
-
container.style.display = 'block';
|
| 151 |
-
screenVideo.play();
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
function createControlButtons(videoData) {
|
| 155 |
-
const panel = document.getElementById('panel');
|
| 156 |
-
|
| 157 |
-
const label = document.createElement('div');
|
| 158 |
-
label.style.color = '#ff99aa';
|
| 159 |
-
label.style.fontSize = '14px';
|
| 160 |
-
label.style.padding = '4px 0 2px 0';
|
| 161 |
-
label.textContent = `${videoData.side.toUpperCase()} SCREEN`;
|
| 162 |
-
panel.appendChild(label);
|
| 163 |
-
|
| 164 |
-
const controls = document.createElement('div');
|
| 165 |
-
controls.style.display = 'flex';
|
| 166 |
-
controls.style.gap = '6px';
|
| 167 |
-
|
| 168 |
-
const playBtn = document.createElement('button');
|
| 169 |
-
playBtn.textContent = '▶️ / ⏸️';
|
| 170 |
-
playBtn.onclick = () => {
|
| 171 |
-
if (videoData.video.paused) videoData.video.play();
|
| 172 |
-
else videoData.video.pause();
|
| 173 |
-
};
|
| 174 |
-
controls.appendChild(playBtn);
|
| 175 |
-
|
| 176 |
-
const muteBtn = document.createElement('button');
|
| 177 |
-
muteBtn.textContent = '🔊 / 🔇';
|
| 178 |
-
muteBtn.onclick = () => {
|
| 179 |
-
videoData.video.muted = !videoData.video.muted;
|
| 180 |
-
};
|
| 181 |
-
controls.appendChild(muteBtn);
|
| 182 |
-
|
| 183 |
-
panel.appendChild(controls);
|
| 184 |
-
}
|
| 185 |
-
|
| 186 |
-
function playSky() {
|
| 187 |
-
if (skyVideo) skyVideo.play();
|
| 188 |
-
}
|
| 189 |
-
|
| 190 |
-
function pauseSky() {
|
| 191 |
-
if (skyVideo) skyVideo.pause();
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
function toggleSkyMute() {
|
| 195 |
-
if (skyVideo) skyVideo.muted = !skyVideo.muted;
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
function closeVideo() {
|
| 199 |
-
screenVideo.pause();
|
| 200 |
-
container.style.display = 'none';
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
function openAIChat() {
|
| 204 |
-
window.location.href = "http://localhost:8000";
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
// Sky Launcher
|
| 208 |
-
document.getElementById('skyInput').addEventListener('change', function(e) {
|
| 209 |
-
const file = e.target.files[0];
|
| 210 |
-
if (!file) return;
|
| 211 |
-
|
| 212 |
-
const url = URL.createObjectURL(file);
|
| 213 |
-
const isVideo = file.type.startsWith('video/');
|
| 214 |
-
|
| 215 |
-
if (isVideo) {
|
| 216 |
-
if (skyVideo) skyVideo.pause();
|
| 217 |
-
skyVideo = document.createElement('video');
|
| 218 |
-
skyVideo.src = url;
|
| 219 |
-
skyVideo.loop = true;
|
| 220 |
-
skyVideo.muted = false;
|
| 221 |
-
skyVideo.volume = 0.6;
|
| 222 |
-
|
| 223 |
-
skyVideo.onloadeddata = () => {
|
| 224 |
-
const mesh = document.getElementById('sky').getObject3D('mesh');
|
| 225 |
-
if (mesh && mesh.material) {
|
| 226 |
-
const texture = new THREE.VideoTexture(skyVideo);
|
| 227 |
-
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 228 |
-
mesh.material.map = texture;
|
| 229 |
-
mesh.material.needsUpdate = true;
|
| 230 |
-
skyVideo.play();
|
| 231 |
-
}
|
| 232 |
-
};
|
| 233 |
-
skyVideo.load();
|
| 234 |
-
} else {
|
| 235 |
-
const loader = new THREE.TextureLoader();
|
| 236 |
-
loader.load(url, function(texture) {
|
| 237 |
-
const mesh = document.getElementById('sky').getObject3D('mesh');
|
| 238 |
-
if (mesh && mesh.material) {
|
| 239 |
-
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 240 |
-
mesh.material.map = texture;
|
| 241 |
-
mesh.material.needsUpdate = true;
|
| 242 |
-
}
|
| 243 |
-
});
|
| 244 |
-
}
|
| 245 |
-
});
|
| 246 |
-
|
| 247 |
-
// Initialize
|
| 248 |
-
window.onload = function() {
|
| 249 |
-
screenVideo = document.getElementById('myVideo');
|
| 250 |
-
container = document.getElementById('videoContainer');
|
| 251 |
-
};
|
| 252 |
-
</script>
|
| 253 |
-
</body>
|
| 254 |
-
</html>
|
|
|
|
| 21 |
z-index:1002;
|
| 22 |
}
|
| 23 |
button {
|
| 24 |
+
background:rgba(255,50,50,0.08);
|
| 25 |
+
color:#ff99aa;
|
| 26 |
+
border:1px solid #ff3366;
|
| 27 |
+
box-shadow:0 0 12px #ff3366;
|
| 28 |
+
padding:11px 12px;
|
| 29 |
+
border-radius:10px;
|
| 30 |
+
font-size:15px;
|
| 31 |
+
text-align: left;
|
| 32 |
}
|
| 33 |
#videoContainer {
|
| 34 |
position:fixed; bottom:170px; left:50%; transform:translateX(-50%);
|
|
|
|
| 53 |
<div id="bead" onclick="togglePanel()"></div>
|
| 54 |
|
| 55 |
<div id="panel">
|
| 56 |
+
<button onclick="launchSky()">🌌 Sky Launcher</button>
|
| 57 |
+
<button onclick="Leftvideopanel()">➡️ Add Left Screen</button>
|
| 58 |
+
<button onclick="Rightvideopanel()">⬅️ Add Right Screen</button>
|
| 59 |
+
<button onclick="playSky()">▶️ Play Sky</button>
|
| 60 |
+
<button onclick="pauseSky()">⏸️ Pause Sky</button>
|
| 61 |
+
<button onclick="Mutesky()">🔇 Sky Mute</button>
|
| 62 |
+
<button onclick="Mediaplayer()">📺 Browser Player</button>
|
| 63 |
+
<button onclick="AIChat()">💬 AI Chat</button>
|
| 64 |
+
<button onclick="enterVRMode()">🥽 Enter VR Mode</button>
|
| 65 |
+
<button onclick="enterARMode()">📱 Enter AR Mode</button>
|
| 66 |
</div>
|
| 67 |
|
| 68 |
<div id="videoContainer">
|
|
|
|
| 71 |
</div>
|
| 72 |
|
| 73 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
| 74 |
+
<input type="file" id="screenInput" accept="video/*" style="display:none;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|