Spaces:
Running
Running
Update index.html
Browse files- 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
|
| 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
|
| 87 |
-
|
| 88 |
|
| 89 |
-
//
|
| 90 |
-
|
| 91 |
|
| 92 |
alert(`✅ ${side.toUpperCase()} screen loaded`);
|
| 93 |
};
|
| 94 |
}
|
| 95 |
|
| 96 |
-
function
|
| 97 |
-
const
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
const
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
videoData.video.muted = !videoData.video.muted;
|
| 117 |
-
|
| 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>
|
|
|