Metaprime commited on
Commit
2d8a4a0
·
verified ·
1 Parent(s): 84fec1b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +27 -4
index.html CHANGED
@@ -39,9 +39,7 @@
39
  </head>
40
  <body>
41
  <a-scene background="color: #000000" xr-mode-ui="enabled: false">
42
- <!-- This line fixes the background issue in AR -->
43
  <a-sky id="sky" src="galaxy.jpg" material="side: back" hide-on-enter-ar></a-sky>
44
-
45
  <a-light type="ambient" color="#666"></a-light>
46
  <a-light type="directional" intensity="0.6" position="5 10 5"></a-light>
47
  </a-scene>
@@ -72,14 +70,24 @@
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();
@@ -175,6 +183,15 @@
175
  panel.appendChild(controls);
176
  }
177
 
 
 
 
 
 
 
 
 
 
178
  function playSky() {
179
  if (skyVideo) skyVideo.play();
180
  }
@@ -235,6 +252,12 @@
235
  });
236
  }
237
  });
 
 
 
 
 
 
238
  </script>
239
  </body>
240
  </html>
 
39
  </head>
40
  <body>
41
  <a-scene background="color: #000000" xr-mode-ui="enabled: false">
 
42
  <a-sky id="sky" src="galaxy.jpg" material="side: back" hide-on-enter-ar></a-sky>
 
43
  <a-light type="ambient" color="#666"></a-light>
44
  <a-light type="directional" intensity="0.6" position="5 10 5"></a-light>
45
  </a-scene>
 
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();
 
183
  panel.appendChild(controls);
184
  }
185
 
186
+ function handleBrowserVideo(e) {
187
+ const file = e.target.files[0];
188
+ if (!file) return;
189
+ const url = URL.createObjectURL(file);
190
+ screenVideo.src = url;
191
+ container.style.display = 'block';
192
+ screenVideo.play();
193
+ }
194
+
195
  function playSky() {
196
  if (skyVideo) skyVideo.play();
197
  }
 
252
  });
253
  }
254
  });
255
+
256
+ // Initialize
257
+ window.onload = function() {
258
+ screenVideo = document.getElementById('myVideo');
259
+ container = document.getElementById('videoContainer');
260
+ };
261
  </script>
262
  </body>
263
  </html>