Spaces:
Running
Running
Update index.html
Browse files- index.html +25 -89
index.html
CHANGED
|
@@ -72,6 +72,7 @@
|
|
| 72 |
<button onclick="pickScreenMedia()">📺 Browser Player</button>
|
| 73 |
<button onclick="openAIChat()">💬 AI Chat</button>
|
| 74 |
<button onclick="enterVRMode()">🕶️ Enter VR Mode</button>
|
|
|
|
| 75 |
</div>
|
| 76 |
|
| 77 |
<div id="videoContainer">
|
|
@@ -95,12 +96,12 @@
|
|
| 95 |
|
| 96 |
function enterVRMode() {
|
| 97 |
const scene = document.querySelector('a-scene');
|
| 98 |
-
if (scene)
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
}
|
| 105 |
|
| 106 |
function launchSky() { document.getElementById('skyInput').click(); }
|
|
@@ -137,98 +138,33 @@
|
|
| 137 |
video.loop = true;
|
| 138 |
video.volume = 0.7;
|
| 139 |
video.muted = false;
|
|
|
|
| 140 |
|
| 141 |
-
|
|
|
|
| 142 |
const mesh = plane.object3DMap.mesh;
|
| 143 |
if (mesh && mesh.material) {
|
| 144 |
-
const texture = new THREE.VideoTexture(video);
|
| 145 |
mesh.material.map = texture;
|
| 146 |
mesh.material.needsUpdate = true;
|
| 147 |
}
|
| 148 |
-
video.play();
|
| 149 |
};
|
| 150 |
|
| 151 |
-
video.
|
| 152 |
-
|
| 153 |
-
const videoData = { video: video, name: file.name, side: side };
|
| 154 |
videos.push(videoData);
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
function handleBrowserVideo(e) {
|
| 158 |
-
const file = e.target.files[0];
|
| 159 |
-
if (!file) return;
|
| 160 |
-
const url = URL.createObjectURL(file);
|
| 161 |
-
screenVideo.src = url;
|
| 162 |
-
container.style.display = 'block';
|
| 163 |
-
screenVideo.play();
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
function playSky() {
|
| 167 |
-
if (skyVideo) skyVideo.play();
|
| 168 |
-
}
|
| 169 |
|
| 170 |
-
|
| 171 |
-
if (skyVideo) skyVideo.pause();
|
| 172 |
}
|
| 173 |
|
| 174 |
-
function
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
// Sky Launcher
|
| 188 |
-
document.getElementById('skyInput').addEventListener('change', function(e) {
|
| 189 |
-
const file = e.target.files[0];
|
| 190 |
-
if (!file) return;
|
| 191 |
-
|
| 192 |
-
const url = URL.createObjectURL(file);
|
| 193 |
-
const isVideo = file.type.startsWith('video/');
|
| 194 |
-
|
| 195 |
-
if (isVideo) {
|
| 196 |
-
if (skyVideo) skyVideo.pause();
|
| 197 |
-
skyVideo = document.createElement('video');
|
| 198 |
-
skyVideo.src = url;
|
| 199 |
-
skyVideo.loop = true;
|
| 200 |
-
skyVideo.muted = false;
|
| 201 |
-
skyVideo.volume = 0.6;
|
| 202 |
-
|
| 203 |
-
skyVideo.onloadeddata = () => {
|
| 204 |
-
const mesh = document.getElementById('sky').getObject3D('mesh');
|
| 205 |
-
if (mesh && mesh.material) {
|
| 206 |
-
const texture = new THREE.VideoTexture(skyVideo);
|
| 207 |
-
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 208 |
-
mesh.material.map = texture;
|
| 209 |
-
mesh.material.needsUpdate = true;
|
| 210 |
-
skyVideo.play();
|
| 211 |
-
}
|
| 212 |
-
};
|
| 213 |
-
skyVideo.load();
|
| 214 |
-
} else {
|
| 215 |
-
const loader = new THREE.TextureLoader();
|
| 216 |
-
loader.load(url, function(texture) {
|
| 217 |
-
const mesh = document.getElementById('sky').getObject3D('mesh');
|
| 218 |
-
if (mesh && mesh.material) {
|
| 219 |
-
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 220 |
-
mesh.material.map = texture;
|
| 221 |
-
mesh.material.needsUpdate = true;
|
| 222 |
-
}
|
| 223 |
-
});
|
| 224 |
-
}
|
| 225 |
-
});
|
| 226 |
-
|
| 227 |
-
// Initialize
|
| 228 |
-
window.onload = function() {
|
| 229 |
-
screenVideo = document.getElementById('myVideo');
|
| 230 |
-
container = document.getElementById('videoContainer');
|
| 231 |
-
};
|
| 232 |
-
</script>
|
| 233 |
-
</body>
|
| 234 |
-
</html>
|
|
|
|
| 72 |
<button onclick="pickScreenMedia()">📺 Browser Player</button>
|
| 73 |
<button onclick="openAIChat()">💬 AI Chat</button>
|
| 74 |
<button onclick="enterVRMode()">🕶️ Enter VR Mode</button>
|
| 75 |
+
<button onclick="enterARMode()">📱 Enter AR Mode</button>
|
| 76 |
</div>
|
| 77 |
|
| 78 |
<div id="videoContainer">
|
|
|
|
| 96 |
|
| 97 |
function enterVRMode() {
|
| 98 |
const scene = document.querySelector('a-scene');
|
| 99 |
+
if (scene) scene.enterVR();
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
function enterARMode() {
|
| 103 |
+
const scene = document.querySelector('a-scene');
|
| 104 |
+
if (scene) scene.enterAR();
|
| 105 |
}
|
| 106 |
|
| 107 |
function launchSky() { document.getElementById('skyInput').click(); }
|
|
|
|
| 138 |
video.loop = true;
|
| 139 |
video.volume = 0.7;
|
| 140 |
video.muted = false;
|
| 141 |
+
video.play();
|
| 142 |
|
| 143 |
+
const texture = new THREE.VideoTexture(video);
|
| 144 |
+
video.onloadeddata = () => {
|
| 145 |
const mesh = plane.object3DMap.mesh;
|
| 146 |
if (mesh && mesh.material) {
|
|
|
|
| 147 |
mesh.material.map = texture;
|
| 148 |
mesh.material.needsUpdate = true;
|
| 149 |
}
|
|
|
|
| 150 |
};
|
| 151 |
|
| 152 |
+
const videoData = { video: video, name: file.name, side: side, plane: plane };
|
|
|
|
|
|
|
| 153 |
videos.push(videoData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
|
| 155 |
+
createControlButtons(videoData);
|
|
|
|
| 156 |
}
|
| 157 |
|
| 158 |
+
function createControlButtons(videoData) {
|
| 159 |
+
const panel = document.getElementById('panel');
|
| 160 |
+
|
| 161 |
+
const label = document.createElement('div');
|
| 162 |
+
label.style.color = '#ff99aa';
|
| 163 |
+
label.style.fontSize = '14px';
|
| 164 |
+
label.style.padding = '4px 0 2px 0';
|
| 165 |
+
label.textContent = `${videoData.side.toUpperCase()} SCREEN`;
|
| 166 |
+
panel.appendChild(label);
|
| 167 |
+
|
| 168 |
+
const controls = document.createElement('div');
|
| 169 |
+
controls.style.display = 'flex';
|
| 170 |
+
controls.style.gap =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|