|
332 | 332 | <video |
333 | 333 | id="resultVideoEnhanced" |
334 | 334 | class="comparison-img enhanced block w-full h-auto bg-slate-900" |
335 | | - controls |
336 | 335 | loop |
337 | 336 | muted |
338 | 337 | playsinline |
|
400 | 399 | Upscaled |
401 | 400 | </div> |
402 | 401 | </div> |
| 402 | + |
| 403 | + <!-- Play/Pause Button --> |
| 404 | + <button |
| 405 | + id="comparisonPlayPauseBtn" |
| 406 | + onclick="toggleComparisonPlayPause(event)" |
| 407 | + class="absolute bottom-3 left-3 w-9 h-9 flex items-center justify-center bg-black/50 backdrop-blur-sm rounded-full text-white hover:bg-black/70 transition-all z-20" |
| 408 | + title="Play/Pause" |
| 409 | + > |
| 410 | + <svg id="comparisonPlayIcon" class="w-4 h-4 hidden" fill="currentColor" viewBox="0 0 24 24"> |
| 411 | + <path d="M8 5v14l11-7z"/> |
| 412 | + </svg> |
| 413 | + <svg id="comparisonPauseIcon" class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"> |
| 414 | + <path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/> |
| 415 | + </svg> |
| 416 | + </button> |
403 | 417 | </div> |
404 | 418 | </div> |
405 | 419 |
|
@@ -1185,6 +1199,46 @@ <h3 class="text-sm font-semibold text-slate-800"> |
1185 | 1199 | } |
1186 | 1200 |
|
1187 | 1201 | console.log("Upscaler ready:", Upscaler.getBackendType()); |
| 1202 | + |
| 1203 | + // Comparison video controls |
| 1204 | + function toggleComparisonPlayPause(event) { |
| 1205 | + event.preventDefault(); |
| 1206 | + event.stopPropagation(); |
| 1207 | + const enhancedVideo = document.getElementById('resultVideoEnhanced'); |
| 1208 | + const originalVideo = document.getElementById('resultVideoOriginal'); |
| 1209 | + const playIcon = document.getElementById('comparisonPlayIcon'); |
| 1210 | + const pauseIcon = document.getElementById('comparisonPauseIcon'); |
| 1211 | + if (!enhancedVideo || !originalVideo) return; |
| 1212 | + |
| 1213 | + if (enhancedVideo.paused) { |
| 1214 | + enhancedVideo.play(); |
| 1215 | + originalVideo.play(); |
| 1216 | + playIcon.classList.add('hidden'); |
| 1217 | + pauseIcon.classList.remove('hidden'); |
| 1218 | + } else { |
| 1219 | + enhancedVideo.pause(); |
| 1220 | + originalVideo.pause(); |
| 1221 | + playIcon.classList.remove('hidden'); |
| 1222 | + pauseIcon.classList.add('hidden'); |
| 1223 | + } |
| 1224 | + } |
| 1225 | + |
| 1226 | + // Update play/pause icon when video state changes |
| 1227 | + (function initComparisonVideoEvents() { |
| 1228 | + const enhancedVideo = document.getElementById('resultVideoEnhanced'); |
| 1229 | + const playIcon = document.getElementById('comparisonPlayIcon'); |
| 1230 | + const pauseIcon = document.getElementById('comparisonPauseIcon'); |
| 1231 | + if (!enhancedVideo || !playIcon || !pauseIcon) return; |
| 1232 | + |
| 1233 | + enhancedVideo.addEventListener('play', () => { |
| 1234 | + playIcon.classList.add('hidden'); |
| 1235 | + pauseIcon.classList.remove('hidden'); |
| 1236 | + }); |
| 1237 | + enhancedVideo.addEventListener('pause', () => { |
| 1238 | + playIcon.classList.remove('hidden'); |
| 1239 | + pauseIcon.classList.add('hidden'); |
| 1240 | + }); |
| 1241 | + })(); |
1188 | 1242 | </script> |
1189 | 1243 | </body> |
1190 | 1244 | </html> |
0 commit comments