Fix trim bar handles not visible
Bug from screenshot: trim bar visible but red handles not showing. Causes: 1. video_duration in job is None for old jobs (was not saved on initial processing). Without it, fallback was endInit+60 which placed handles off-screen. 2. videoDuration was const, couldn't be updated when video metadata loads. 3. Handle offset was 9px but handles are now 24px wide (need 12px offset). Fixes: - Backend /api/transcript: fallback to last segment end time if video_duration missing in job - Frontend: videoDuration is let, updated on loadedmetadata - Handle offset 9px → 12px for 24px wide handles - Re-render trim after metadata loads to pick up actual video.duration
This commit is contained in:
+5
-1
@@ -1262,11 +1262,15 @@ async def get_transcript(job_id: str, user: str = Depends(check_auth)):
|
||||
analysis = json.loads(analysis_path.read_text())
|
||||
transcript = analysis.get("transcript", {})
|
||||
clip_range = analysis.get("clip_range", {})
|
||||
# video_duration: probaj iz analysis, sicer iz zadnjega segmenta, sicer 0
|
||||
video_dur = analysis.get("video_duration") or job.get("video_duration") or 0
|
||||
if not video_dur and transcript.get("segments"):
|
||||
video_dur = max((s.get("end", 0) for s in transcript["segments"]), default=0)
|
||||
return {
|
||||
"segments": transcript.get("segments", []),
|
||||
"language": transcript.get("language", "?"),
|
||||
"clip_range": clip_range,
|
||||
"video_duration": job.get("video_duration", 0),
|
||||
"video_duration": video_dur,
|
||||
}
|
||||
except Exception as e:
|
||||
raise HTTPException(500, f"Napaka pri branju: {e}")
|
||||
|
||||
Reference in New Issue
Block a user