Metaprime commited on
Commit
8ef05cc
ยท
verified ยท
1 Parent(s): e19cb73

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +70 -96
index.html CHANGED
@@ -13,19 +13,13 @@
13
  }
14
  #panel {
15
  position:fixed; bottom:88px; left:22px; width:205px;
16
- background:rgba(15,0,25,0.4);
17
- backdrop-filter:blur(22px);
18
- border:2px solid #ff3366;
19
- box-shadow:0 0 30px #ff3366;
20
- border-radius:16px;
21
- padding:12px;
22
- display:none;
23
- flex-direction:column;
24
- gap:8px;
25
  z-index:1002;
26
  }
27
  button {
28
- background:rgba(255,50,50,0.15);
29
  color:#ff99aa;
30
  border:1px solid #ff3366;
31
  box-shadow:0 0 12px #ff3366;
@@ -34,37 +28,23 @@
34
  font-size:15px;
35
  text-align:left;
36
  }
37
- .media-panels {
38
- position: fixed;
39
- top: 70px;
40
- left: 50%;
41
- transform: translateX(-50%);
42
- display: flex;
43
- gap: 15px;
44
- flex-wrap: wrap;
45
- justify-content: center;
46
- z-index: 1001;
47
- max-width: 95%;
48
- }
49
- .video-wrapper {
50
- width: 210px;
51
- background: rgba(0,0,0,0.7);
52
- border: 2px solid #ff3366;
53
- border-radius: 14px;
54
- padding: 8px;
55
- position: relative;
56
- box-shadow: 0 0 25px rgba(255,51,102,0.5);
57
  }
 
58
  .close-btn {
59
- position:absolute; top:6px; right:6px; color:white; font-size:26px;
60
- background:rgba(255,60,60,0.9); width:30px; height:30px; border-radius:50%;
61
- display:flex; align-items:center; justify-content:center; z-index:10;
62
  }
63
  </style>
64
  </head>
65
  <body>
66
 
67
- <a-scene background="color: #000000">
 
68
  <a-sky id="sky" src="galaxy.jpg"></a-sky>
69
  </a-scene>
70
 
@@ -72,70 +52,55 @@
72
 
73
  <div id="panel">
74
  <button onclick="launchSky()">๐ŸŒŒ Sky Launcher</button>
75
- <button onclick="addFloatingPlayer()">๐Ÿ“บ Add Floating Player</button>
76
- <button onclick="playAll()">โ–ถ๏ธ Play All</button>
77
- <button onclick="pauseAll()">โธ๏ธ Pause All</button>
78
- <button onclick="toggleMuteAll()">๐Ÿ”‡ Mute All</button>
 
 
79
  </div>
80
 
81
- <div id="mediaPanels" class="media-panels"></div>
 
 
 
82
 
83
  <input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
 
84
 
85
  <script>
 
 
 
 
86
  function togglePanel() {
87
- const p = document.getElementById('panel');
88
- p.style.display = p.style.display === 'flex' ? 'none' : 'flex';
89
  }
90
 
91
  function launchSky() { document.getElementById('skyInput').click(); }
 
 
 
 
 
 
 
 
 
 
92
 
93
- function addFloatingPlayer() {
94
- const container = document.getElementById('mediaPanels');
95
- const wrapper = document.createElement('div');
96
- wrapper.className = 'video-wrapper';
97
-
98
- const close = document.createElement('div');
99
- close.className = 'close-btn';
100
- close.textContent = 'ร—';
101
- close.onclick = () => wrapper.remove();
102
-
103
- const video = document.createElement('video');
104
- video.controls = true;
105
- video.loop = true;
106
- video.style.width = '100%';
107
- video.style.borderRadius = '8px';
108
-
109
- wrapper.appendChild(close);
110
- wrapper.appendChild(video);
111
- container.appendChild(wrapper);
112
- container.style.display = 'flex';
113
-
114
- const input = document.createElement('input');
115
- input.type = 'file';
116
- input.accept = 'video/*,image/*';
117
- input.onchange = (e) => {
118
- const file = e.target.files[0];
119
- if (!file) return;
120
- const url = URL.createObjectURL(file);
121
- if (file.type.startsWith('video/')) {
122
- video.src = url;
123
- video.play();
124
- } else {
125
- video.outerHTML = `<img src="${url}" style="width:100%; border-radius:8px;">`;
126
- }
127
- };
128
- input.click();
129
  }
130
 
131
- function playAll() { document.querySelectorAll('video').forEach(v => v.play()); }
132
- function pauseAll() { document.querySelectorAll('video').forEach(v => v.pause()); }
133
- function toggleMuteAll() {
134
- const videos = document.querySelectorAll('video');
135
- const shouldMute = videos[0 0].muted : true;
136
- videos.forEach(v => v.muted = shouldMute);
137
  }
138
 
 
139
  document.getElementById('skyInput').addEventListener('change', function(e) {
140
  const file = e.target.files[0];
141
  if (!file) return;
@@ -143,23 +108,32 @@
143
  const sky = document.getElementById('sky');
144
 
145
  if (file.type.startsWith('video/')) {
146
- const vid = document.createElement('video');
147
- vid.src = url; vid.loop = true; vid.muted = true; vid.style.display = 'none';
148
- document.body.appendChild(vid);
149
- vid.onloadeddata = () => {
150
- const mesh = sky.getObject3D('mesh');
151
- if (mesh && mesh.material) {
152
- const texture = new THREE.VideoTexture(vid);
153
- texture.mapping = THREE.EquirectangularReflectionMapping;
154
- mesh.material.map = texture;
155
- mesh.material.needsUpdate = true;
156
- vid.play();
157
- }
158
- };
159
  } else {
160
  sky.setAttribute('src', url);
161
  }
162
  });
 
 
 
 
 
 
 
 
 
 
163
  </script>
164
  </body>
165
  </html>
 
13
  }
14
  #panel {
15
  position:fixed; bottom:88px; left:22px; width:205px;
16
+ background:rgba(20,0,10,0.85); backdrop-filter:blur(18px);
17
+ border:2px solid #ff3366; box-shadow:0 0 25px #ff3366, 0 0 45px #ff3366;
18
+ border-radius:16px; padding:12px; display:none; flex-direction:column; gap:8px;
 
 
 
 
 
 
19
  z-index:1002;
20
  }
21
  button {
22
+ background:rgba(255,50,50,0.08);
23
  color:#ff99aa;
24
  border:1px solid #ff3366;
25
  box-shadow:0 0 12px #ff3366;
 
28
  font-size:15px;
29
  text-align:left;
30
  }
31
+ #videoContainer {
32
+ position:fixed; bottom:180px; left:50%; transform:translateX(-50%);
33
+ width:90%; max-width:400px; display:none; z-index:1000;
34
+ background:rgba(0,0,0,0.85); border-radius:12px; padding:8px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
44
  <body>
45
 
46
+ <!-- This line enables A-Frame's built-in VR button -->
47
+ <a-scene background="color: #000000" vr-mode-ui="enabled: true">
48
  <a-sky id="sky" src="galaxy.jpg"></a-sky>
49
  </a-scene>
50
 
 
52
 
53
  <div id="panel">
54
  <button onclick="launchSky()">๐ŸŒŒ Sky Launcher</button>
55
+ <button onclick="pickScreenMedia()">๐Ÿ“บ Change Screen Media</button>
56
+ <button onclick="playSky()">โ–ถ๏ธ Play</button>
57
+ <button onclick="pauseSky()">โธ๏ธ Pause</button>
58
+ <button onclick="toggleMute()">๐Ÿ”‡ Mute / Unmute</button>
59
+ <button onclick="alert('AI Chat - Coming soon')">๐Ÿ’ฌ AI Chat</button>
60
+ <button onclick="alert('Knowledge Base - Coming soon')">๐Ÿ“– Knowledge</button>
61
  </div>
62
 
63
+ <div id="videoContainer">
64
+ <div class="close-btn" onclick="closeVideo()">ร—</div>
65
+ <video id="myVideo" controls loop></video>
66
+ </div>
67
 
68
  <input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
69
+ <input type="file" id="screenInput" accept="video/*,image/*" style="display:none;">
70
 
71
  <script>
72
+ let skyVideo = null;
73
+ const screenVideo = document.getElementById('myVideo');
74
+ const container = document.getElementById('videoContainer');
75
+
76
  function togglePanel() {
77
+ const panel = document.getElementById('panel');
78
+ panel.style.display = panel.style.display === 'flex' ? 'none' : 'flex';
79
  }
80
 
81
  function launchSky() { document.getElementById('skyInput').click(); }
82
+ function pickScreenMedia() { document.getElementById('screenInput').click(); }
83
+
84
+ function playSky() {
85
+ if (skyVideo) skyVideo.play();
86
+ else screenVideo.play();
87
+ }
88
+ function pauseSky() {
89
+ if (skyVideo) skyVideo.pause();
90
+ else screenVideo.pause();
91
+ }
92
 
93
+ function toggleMute() {
94
+ if (skyVideo) skyVideo.muted = !skyVideo.muted;
95
+ else screenVideo.muted = !screenVideo.muted;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
 
98
+ function closeVideo() {
99
+ screenVideo.pause();
100
+ container.style.display = 'none';
 
 
 
101
  }
102
 
103
+ // Sky Launcher
104
  document.getElementById('skyInput').addEventListener('change', function(e) {
105
  const file = e.target.files[0];
106
  if (!file) return;
 
108
  const sky = document.getElementById('sky');
109
 
110
  if (file.type.startsWith('video/')) {
111
+ if (skyVideo) skyVideo.pause();
112
+ skyVideo = document.createElement('video');
113
+ skyVideo.src = url;
114
+ skyVideo.loop = true;
115
+ skyVideo.muted = true;
116
+ skyVideo.style.display = 'none';
117
+ document.body.appendChild(skyVideo);
118
+
119
+ const texture = new THREE.VideoTexture(skyVideo);
120
+ texture.mapping = THREE.EquirectangularReflectionMapping;
121
+ sky.setAttribute('material', { src: texture, shader: 'flat', side: 'back' });
122
+ skyVideo.play();
 
123
  } else {
124
  sky.setAttribute('src', url);
125
  }
126
  });
127
+
128
+ // Screen Media
129
+ document.getElementById('screenInput').addEventListener('change', function(e) {
130
+ const file = e.target.files[0];
131
+ if (!file) return;
132
+ const url = URL.createObjectURL(file);
133
+ screenVideo.src = url;
134
+ container.style.display = 'block';
135
+ screenVideo.play();
136
+ });
137
  </script>
138
  </body>
139
  </html>