Metaprime commited on
Commit
5f87513
·
verified ·
1 Parent(s): 288b982

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +39 -30
index.html CHANGED
@@ -38,7 +38,7 @@
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');
@@ -61,7 +61,6 @@
61
  plane.setAttribute('height', '6');
62
  plane.setAttribute('position', `${xPos} 4 -10`);
63
  plane.setAttribute('material', 'shader:flat; side:double; color:#fff');
64
- plane.setAttribute('class', 'video-screen');
65
  scene.appendChild(plane);
66
 
67
  const video = document.createElement('video');
@@ -83,41 +82,51 @@
83
 
84
  video.load();
85
 
86
- const videoData = {video, plane, name: file.name};
87
- allVideos.push(videoData);
88
 
89
- // Click handler for this specific screen
90
- plane.addEventListener('click', () => showMediaControls(videoData));
91
 
92
  alert(`✅ ${side.toUpperCase()} screen loaded`);
93
  };
94
  }
95
 
96
- function showMediaControls(videoData) {
97
- const action = prompt(
98
- `🎥 Controls for: ${videoData.name}\n\n` +
99
- `Type:\n` +
100
- `p = Play / Pause\n` +
101
- `m = Mute / Unmute`
102
- );
103
-
104
- if (!action) return;
105
-
106
- const lower = action.toLowerCase();
107
- if (lower === 'p') {
108
- if (videoData.video.paused) {
109
- videoData.video.play();
110
- alert("▶️ Playing");
111
- } else {
112
- videoData.video.pause();
113
- alert("⏸️ Paused");
114
- }
115
- } else if (lower === 'm') {
 
 
 
 
 
 
 
 
 
116
  videoData.video.muted = !videoData.video.muted;
117
- alert(videoData.video.muted ? "🔇 Muted" : "🔊 Sound On");
118
- }
 
 
119
  }
120
  </script>
121
  </body>
122
- </html>
123
- EOF
 
38
  <input type="file" id="mediaInput" accept="video/*" style="display:none;">
39
 
40
  <script>
41
+ let videos = [];
42
 
43
  function togglePanel() {
44
  const p = document.getElementById('panel');
 
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');
 
82
 
83
  video.load();
84
 
85
+ const videoData = { video: video, name: file.name, side: side };
86
+ videos.push(videoData);
87
 
88
+ // Dynamically add control buttons to panel
89
+ createControlButtons(videoData);
90
 
91
  alert(`✅ ${side.toUpperCase()} screen loaded`);
92
  };
93
  }
94
 
95
+ function createControlButtons(videoData) {
96
+ const panel = document.getElementById('panel');
97
+
98
+ const label = document.createElement('div');
99
+ label.style.color = 'white';
100
+ label.style.fontSize = '14px';
101
+ label.style.padding = '5px 0';
102
+ label.textContent = `${videoData.side.toUpperCase()} SCREEN`;
103
+ panel.appendChild(label);
104
+
105
+ const controls = document.createElement('div');
106
+ controls.style.display = 'flex';
107
+ controls.style.gap = '8px';
108
+
109
+ const playBtn = document.createElement('button');
110
+ playBtn.className = 'btn';
111
+ playBtn.style.flex = '1';
112
+ playBtn.textContent = '▶️ / ⏸️';
113
+ playBtn.onclick = () => {
114
+ if (videoData.video.paused) videoData.video.play();
115
+ else videoData.video.pause();
116
+ };
117
+ controls.appendChild(playBtn);
118
+
119
+ const muteBtn = document.createElement('button');
120
+ muteBtn.className = 'btn';
121
+ muteBtn.style.flex = '1';
122
+ muteBtn.textContent = '🔊 / 🔇';
123
+ muteBtn.onclick = () => {
124
  videoData.video.muted = !videoData.video.muted;
125
+ };
126
+ controls.appendChild(muteBtn);
127
+
128
+ panel.appendChild(controls);
129
  }
130
  </script>
131
  </body>
132
+ </html>