Skip to content

Commit 4501ec2

Browse files
committed
feat: update version to 5.4.0 and add play/pause functionality for comparison videos
1 parent 6c79148 commit 4501ec2

2 files changed

Lines changed: 56 additions & 2 deletions

File tree

docs/uncompiled/artplayer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ var Artplayer = (function() {
153153
}
154154
var optionValidatorExports = requireOptionValidator();
155155
const validator = /* @__PURE__ */ getDefaultExportFromCjs(optionValidatorExports);
156-
const version$1 = "5.3.1";
156+
const version$1 = "5.4.0";
157157
const config$1 = {
158158
properties: [
159159
"audioTracks",

docs/upscaler/index.html

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@
332332
<video
333333
id="resultVideoEnhanced"
334334
class="comparison-img enhanced block w-full h-auto bg-slate-900"
335-
controls
336335
loop
337336
muted
338337
playsinline
@@ -400,6 +399,21 @@
400399
Upscaled
401400
</div>
402401
</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>
403417
</div>
404418
</div>
405419

@@ -1185,6 +1199,46 @@ <h3 class="text-sm font-semibold text-slate-800">
11851199
}
11861200

11871201
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+
})();
11881242
</script>
11891243
</body>
11901244
</html>

0 commit comments

Comments
 (0)