File size: 10,043 Bytes
e2688af 52c2b89 fb757cb f91c403 55dcc79 f91c403 55dcc79 467536d e19cb73 467536d 30da4d5 c60afad 467536d 30da4d5 467536d 30da4d5 467536d 30da4d5 467536d 55dcc79 fb757cb 467536d f91c403 55dcc79 c60afad 55dcc79 467536d 55dcc79 30da4d5 c0cdbcc 55dcc79 467536d 55dcc79 467536d 30da4d5 467536d cc0431b 55dcc79 ee941fa 30da4d5 55dcc79 467536d 55dcc79 30da4d5 c60afad 30da4d5 36d546c 467536d 30da4d5 55dcc79 30da4d5 467536d c0cdbcc 467536d 6ec7aee 467536d 30da4d5 6ec7aee 30da4d5 c0cdbcc 467536d 55dcc79 fb757cb 467536d | 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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Holodeck</title>
<script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
<style>
#bead {
position:fixed; bottom:35px; left:30px; width:38px; height:38px;
background:rgba(255,30,30,0.08);
border:2px solid #ff3366;
border-radius:50%;
box-shadow:0 0 18px #ff3366, 0 0 35px #ff3366, inset 0 0 12px rgba(255,255,255,0.3);
z-index:1000; cursor:pointer;
}
#panel {
position:fixed; bottom:88px; left:22px; width:205px;
background:rgba(20,0,10,0.12); backdrop-filter:blur(18px);
border:2px solid #ff3366; box-shadow:0 0 25px #ff3366, 0 0 45px #ff3366;
border-radius:16px; padding:12px; display:none; flex-direction:column; gap:8px;
z-index:1002;
}
button {
background:rgba(255,50,50,0.08);
color:#ff99aa;
border:1px solid #ff3366;
box-shadow:0 0 12px #ff3366;
padding:11px 12px;
border-radius:10px;
font-size:15px;
text-align: left;
}
#videoContainer {
position:fixed; bottom:170px; left:50%; transform:translateX(-50%);
width:380px; display:none; z-index:1000; background:rgba(0,0,0,0.85);
border-radius:12px; padding:8px;
}
#myVideo { width:100%; border-radius:8px; }
.close-btn {
position:absolute; top:12px; right:12px; color:white; font-size:24px;
background:rgba(255,60,60,0.9); width:28px; height:28px; border-radius:50%;
display:flex; align-items:center; justify-content:center; z-index:1001;
}
</style>
</head>
<body>
<a-scene background="color: #000000" xr-mode-ui="enabled: false">
<a-sky id="sky" src="galaxy.jpg" material="side: back" hide-on-enter-ar></a-sky>
<a-light type="ambient" color="#666"></a-light>
<a-light type="directional" intensity="0.6" position="5 10 5"></a-light>
</a-scene>
<div id="bead" onclick="togglePanel()"></div>
<div id="panel">
<button onclick="launchSky()">๐ Sky Launcher</button>
<button onclick="Leftvideopanel()">โฌ
๏ธ Add Left Screen</button>
<button onclick="Rightvideopanel()">โก๏ธ Add Right Screen</button>
<button onclick="playSky()">โถ๏ธ Play Sky</button>
<button onclick="pauseSky()">โธ๏ธ Pause Sky</button>
<button onclick="Mutesky()">๐ Sky Mute</button>
<button onclick="Mediaplayer()">๐บ Browser Player</button>
<button onclick="AIChat()">๐ฌ AI Chat</button>
<button onclick="setTunnelURL()">๐ Set Tunnel URL</button>
<button onclick="enterVRMode()">๐ฅฝ Enter VR Mode</button>
<button onclick="enterARMode()">๐ฑ Enter AR Mode</button>
</div>
<div id="videoContainer">
<div class="close-btn" onclick="closeVideo()">ร</div>
<video id="myVideo" controls loop></video>
</div>
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
<input type="file" id="screenInput" accept="video/*" style="display:none;">
<script>
let videos = [];
let skyVideo = null;
let screenVideo = null;
let container = null;
function togglePanel() {
const panel = document.getElementById('panel');
panel.style.display = (panel.style.display === 'flex') ? 'none' : 'flex';
}
function enterVRMode() {
const scene = document.querySelector('a-scene');
if (scene) scene.enterVR();
}
function enterARMode() {
const scene = document.querySelector('a-scene');
const sky = document.getElementById('sky');
if (!scene) return;
scene.enterAR().then(() => {
console.log("โ
Entered AR Mode");
if (sky) sky.setAttribute('visible', false);
}).catch(err => {
console.error("AR failed to start:", err);
alert("Could not start AR mode. Make sure you're on a supported device.");
});
}
function launchSky() {
document.getElementById('skyInput').click();
}
function Leftvideopanel() {
document.getElementById('screenInput').click();
document.getElementById('screenInput').onchange = (e) => handleNewVideo(e, 'left');
}
function Rightvideopanel() {
document.getElementById('screenInput').click();
document.getElementById('screenInput').onchange = (e) => handleNewVideo(e, 'right');
}
function Mediaplayer() {
document.getElementById('screenInput').click();
document.getElementById('screenInput').onchange = (e) => handleBrowserVideo(e);
}
function handleNewVideo(e, side) {
const file = e.target.files[0];
if (!file || !file.type.startsWith('video/')) return;
const url = URL.createObjectURL(file);
const scene = document.querySelector('a-scene');
const xPos = side === 'left' ? -5.2 : 5.2;
const plane = document.createElement('a-plane');
plane.setAttribute('width', '10');
plane.setAttribute('height', '6');
plane.setAttribute('position', `${xPos} 4 -10`);
plane.setAttribute('material', 'shader:flat; side:double; color:#fff');
scene.appendChild(plane);
const video = document.createElement('video');
video.src = url;
video.loop = true;
video.volume = 0.7;
video.muted = false;
const texture = new THREE.VideoTexture(video);
video.onloadeddata = function() {
const mesh = plane.object3DMap.mesh;
if (mesh && mesh.material) {
mesh.material.map = texture;
mesh.material.needsUpdate = true;
}
video.play();
};
video.load();
const videoData = { video: video, name: file.name, side: side };
videos.push(videoData);
createControlButtons(videoData);
}
function handleBrowserVideo(e) {
const file = e.target.files[0];
if (!file) return;
const url = URL.createObjectURL(file);
screenVideo.src = url;
container.style.display = 'block';
screenVideo.play();
}
function createControlButtons(videoData) {
const panel = document.getElementById('panel');
const label = document.createElement('div');
label.style.color = '#ff99aa';
label.style.fontSize = '14px';
label.style.padding = '4px 0 2px 0';
label.textContent = `${videoData.side.toUpperCase()} SCREEN`;
panel.appendChild(label);
const controls = document.createElement('div');
controls.style.display = 'flex';
controls.style.gap = '6px';
const playBtn = document.createElement('button');
playBtn.textContent = 'โถ๏ธ / โธ๏ธ';
playBtn.onclick = () => {
if (videoData.video.paused) videoData.video.play();
else videoData.video.pause();
};
controls.appendChild(playBtn);
const muteBtn = document.createElement('button');
muteBtn.textContent = '๐ / ๐';
muteBtn.onclick = () => {
videoData.video.muted = !videoData.video.muted;
};
controls.appendChild(muteBtn);
panel.appendChild(controls);
}
function playSky() {
if (skyVideo) skyVideo.play();
}
function pauseSky() {
if (skyVideo) skyVideo.pause();
}
function Mutesky() {
if (skyVideo) skyVideo.muted = !skyVideo.muted;
}
function closeVideo() {
if (screenVideo) screenVideo.pause();
if (container) container.style.display = 'none';
}
// Cloudflare Tunnel API Routing
function AIChat() {
let tunnelURL = localStorage.getItem('cf_tunnel_url');
if (!tunnelURL) {
tunnelURL = prompt("Enter your active Cloudflare Tunnel URL (e.g., https://your-tunnel-name.trycloudflare.com):");
if (tunnelURL) {
tunnelURL = tunnelURL.trim().replace(/\/$/, ""); // Format URL
localStorage.setItem('cf_tunnel_url', tunnelURL);
} else {
return;
}
}
window.location.href = tunnelURL;
}
function setTunnelURL() {
const currentURL = localStorage.getItem('cf_tunnel_url') || "";
const newURL = prompt("Update Cloudflare Tunnel URL:", currentURL);
if (newURL !== null) {
const formattedURL = newURL.trim().replace(/\/$/, "");
if (formattedURL) {
localStorage.setItem('cf_tunnel_url', formattedURL);
alert("Tunnel URL saved: " + formattedURL);
} else {
localStorage.removeItem('cf_tunnel_url');
alert("Tunnel URL cleared.");
}
}
}
// Sky Launcher Logic
document.getElementById('skyInput').addEventListener('change', function(e) {
const file = e.target.files[0];
if (!file) return;
const url = URL.createObjectURL(file);
const isVideo = file.type.startsWith('video/');
if (isVideo) {
if (skyVideo) skyVideo.pause();
skyVideo = document.createElement('video');
skyVideo.src = url;
skyVideo.loop = true;
skyVideo.muted = false;
skyVideo.volume = 0.6;
skyVideo.onloadeddata = () => {
const mesh = document.getElementById('sky').getObject3D('mesh');
if (mesh && mesh.material) {
const texture = new THREE.VideoTexture(skyVideo);
texture.mapping = THREE.EquirectangularReflectionMapping;
mesh.material.map = texture;
mesh.material.needsUpdate = true;
skyVideo.play();
}
};
skyVideo.load();
} else {
const loader = new THREE.TextureLoader();
loader.load(url, function(texture) {
const mesh = document.getElementById('sky').getObject3D('mesh');
if (mesh && mesh.material) {
texture.mapping = THREE.EquirectangularReflectionMapping;
mesh.material.map = texture;
mesh.material.needsUpdate = true;
}
});
}
});
// Initialize
window.onload = function() {
screenVideo = document.getElementById('myVideo');
container = document.getElementById('videoContainer');
};
</script>
</body>
</html>
|