Edit: play selection feature
- Big '▶ Predvajaj odsek' button: plays from trim start - Auto-stop when video reaches trim end (loops back to trim start) - iPhone trim preview behavior: see exactly what reel will contain
This commit is contained in:
parent
ce827e939a
commit
274ff80b34
@ -1058,14 +1058,14 @@
|
||||
</div>
|
||||
|
||||
<!-- Time display + controls -->
|
||||
<div style="display:flex; justify-content:space-between; align-items:center; margin-top:12px; gap:12px;">
|
||||
<div style="display:flex; justify-content:space-between; align-items:center; margin-top:12px; gap:12px; flex-wrap:wrap;">
|
||||
<div style="font-size:14px;">
|
||||
<span style="color:var(--muted);">Začetek:</span> <b id="edit-start-val">${formatTime(startInit)}</b>
|
||||
<span style="color:var(--muted); margin-left:12px;">Konec:</span> <b id="edit-end-val">${formatTime(endInit)}</b>
|
||||
<span style="color:var(--muted); margin-left:12px;">Trajanje:</span> <b id="edit-duration">${(endInit-startInit).toFixed(1)}s</b>
|
||||
</div>
|
||||
<div style="display:flex; gap:8px;">
|
||||
<button class="small ghost" onclick="seekEditVideo('start')" title="Predvajaj od začetka">▶ Začetek</button>
|
||||
<button class="primary" onclick="seekEditVideo('start')" title="Predvajaj označen del" style="background:var(--accent); padding:8px 16px;">▶ Predvajaj odsek</button>
|
||||
<button class="small ghost" onclick="seekEditVideo('end')" title="Skoči na konec">↪ Konec</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -1215,9 +1215,21 @@
|
||||
if (!video) return;
|
||||
const t = which === "start" ? trimStart : trimEnd;
|
||||
video.currentTime = t;
|
||||
if (which === "start") video.play();
|
||||
if (which === "start") {
|
||||
video.play();
|
||||
}
|
||||
};
|
||||
|
||||
// Auto-stop predvajanje ko doseže trimEnd (kot iPhone trim preview)
|
||||
if (video) {
|
||||
video.addEventListener("timeupdate", () => {
|
||||
if (!video.paused && video.currentTime >= trimEnd) {
|
||||
video.pause();
|
||||
video.currentTime = trimStart; // reset na začetek označenega dela
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initial render — počakaj da DOM ima dimenzije (modal je bil pravkar dodan)
|
||||
console.log("[EditModal] init", { startInit, endInit, videoDuration, trimStart, trimEnd });
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user