Metaprime commited on
Commit
bb68d97
ยท
verified ยท
1 Parent(s): 65a0fb9

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +55 -4
index.html CHANGED
@@ -38,6 +38,8 @@
38
  <input type="file" id="mediaInput" accept="video/*" style="display:none;">
39
 
40
  <script>
 
 
41
  function togglePanel() {
42
  const p = document.getElementById('panel');
43
  p.style.display = p.style.display === 'flex' ? 'none' : 'flex';
@@ -52,8 +54,6 @@
52
 
53
  const url = URL.createObjectURL(file);
54
  const scene = document.querySelector('a-scene');
55
-
56
- // Very close together โ€” edges nearly touching
57
  const xPos = side === 'left' ? -5.2 : 5.2;
58
 
59
  const plane = document.createElement('a-plane');
@@ -61,13 +61,13 @@
61
  plane.setAttribute('height', '6');
62
  plane.setAttribute('position', `${xPos} 4 -10`);
63
  plane.setAttribute('material', 'shader:flat; side:double; color:#fff');
64
-
65
  scene.appendChild(plane);
66
 
67
  const video = document.createElement('video');
68
  video.src = url;
69
  video.loop = true;
70
  video.volume = 0.7;
 
71
 
72
  const texture = new THREE.VideoTexture(video);
73
 
@@ -82,9 +82,60 @@
82
 
83
  video.load();
84
 
85
- alert(`โœ… ${side.toUpperCase()} screen loaded`);
 
 
86
  };
87
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  </script>
89
  </body>
90
  </html>
 
38
  <input type="file" id="mediaInput" accept="video/*" style="display:none;">
39
 
40
  <script>
41
+ let allVideos = [];
42
+
43
  function togglePanel() {
44
  const p = document.getElementById('panel');
45
  p.style.display = p.style.display === 'flex' ? 'none' : 'flex';
 
54
 
55
  const url = URL.createObjectURL(file);
56
  const scene = document.querySelector('a-scene');
 
 
57
  const xPos = side === 'left' ? -5.2 : 5.2;
58
 
59
  const plane = document.createElement('a-plane');
 
61
  plane.setAttribute('height', '6');
62
  plane.setAttribute('position', `${xPos} 4 -10`);
63
  plane.setAttribute('material', 'shader:flat; side:double; color:#fff');
 
64
  scene.appendChild(plane);
65
 
66
  const video = document.createElement('video');
67
  video.src = url;
68
  video.loop = true;
69
  video.volume = 0.7;
70
+ video.muted = false;
71
 
72
  const texture = new THREE.VideoTexture(video);
73
 
 
82
 
83
  video.load();
84
 
85
+ allVideos.push({video: video, plane: plane, name: file.name});
86
+
87
+ alert(`โœ… ${side.toUpperCase()} screen loaded\n\nTap the red bead to control`);
88
  };
89
  }
90
+
91
+ function togglePause(video) {
92
+ if (video.paused) {
93
+ video.play();
94
+ alert("โ–ถ๏ธ Playing");
95
+ } else {
96
+ video.pause();
97
+ alert("โธ๏ธ Paused");
98
+ }
99
+ }
100
+
101
+ function toggleMute(video) {
102
+ video.muted = !video.muted;
103
+ alert(video.muted ? "๐Ÿ”‡ Muted" : "๐Ÿ”Š Unmuted");
104
+ }
105
+
106
+ // Add global controls to the panel
107
+ window.showControls = function() {
108
+ if (allVideos.length === 0) {
109
+ alert("No videos yet. Add some screens first.");
110
+ return;
111
+ }
112
+
113
+ let message = "๐ŸŽฅ Video Controls:\n\n";
114
+ allVideos.forEach((v, i) => {
115
+ message += `${i+1}. ${v.name}\n`;
116
+ });
117
+
118
+ const choice = prompt(message + "\nEnter number to control:");
119
+ if (!choice) return;
120
+
121
+ const index = parseInt(choice) - 1;
122
+ if (allVideos ) {
123
+ const v = allVideos .video;
124
+ const action = prompt("Type 'p' for Play/Pause or 'm' for Mute/Unmute:");
125
+ if (action === 'p' || action === 'P') togglePause(v);
126
+ if (action === 'm' || action === 'M') toggleMute(v);
127
+ }
128
+ };
129
+
130
+ // Add the Show Controls button to the panel
131
+ setTimeout(() => {
132
+ const panel = document.getElementById('panel');
133
+ const controlBtn = document.createElement('button');
134
+ controlBtn.className = 'btn';
135
+ controlBtn.textContent = '๐ŸŽฎ Video Controls';
136
+ controlBtn.onclick = window.showControls;
137
+ panel.appendChild(controlBtn);
138
+ }, 500);
139
  </script>
140
  </body>
141
  </html>