feat(editor): rebuild the clip editor around a source monitor and a working timeline
Turns the clip editor into a three-point editing surface: mark in/out on the source, send the range to the clip, and scrub the result — with the timeline honest about which parts of the edit the last render can already show. - Chrome: the source track ignored drags entirely. Without preventDefault the gesture became a text selection and then a native drag, which swallows every later pointer event and shows the not-allowed cursor. - The source track's block is draggable (body moves, edges trim) and every gesture on it scrubs the source monitor, so a cut is chosen against the picture rather than against numbers. - Three-point editing: mark in / mark out (i / o) off the monitor's playhead, then "replace #N" (.) or "insert after #N" (,). Dragging empty track marks a range instead of silently appending a segment. - /edl ships the whole source transcript instead of a ±45s window: a cut can only be extended into words the editor was sent. The panel shows all of it, follows playback, and seeks the monitor on click. - Layout: source monitor + its track + transcript | clip preview + its track | controls. Each track sits under the video it drives. - The clip timeline works while edited. A cut that only removes material keeps nothing but frames the last render already produced, so it stays scrubbable and playable; only material the render never saw is marked red, and the playhead — now a solid handle — stops at its edge. Transcript words render in memoised 50-word slices: repainting a couple of thousand of them costs ~66ms, and timeupdate fires four times a second.
This commit is contained in:
parent
dfa31241ca
commit
83c45916a2
3 changed files with 937 additions and 210 deletions
11
app.py
11
app.py
|
|
@ -2224,9 +2224,10 @@ async def get_clip_transcript(job_id: str, clip_index: int, request: Request):
|
|||
|
||||
# --- Clip editor: EDL + re-render ---
|
||||
|
||||
# How much transcript to send around the clip's segments — enough for the
|
||||
# editor's word-level trimming without shipping a whole podcast's words.
|
||||
EDL_WORD_CONTEXT_SECONDS = 45.0
|
||||
# The editor ships the WHOLE source transcript, not a window around the clip:
|
||||
# the point of the source track is extending a cut into material the clip never
|
||||
# covered, and you cannot pick a new in-point from words you were not sent.
|
||||
# Cost is about 7 KB of JSON per minute of speech, fetched once per editor open.
|
||||
|
||||
|
||||
def _source_duration_seconds(path):
|
||||
|
|
@ -2295,11 +2296,9 @@ async def get_clip_edl(job_id: str, clip_index: int, request: Request):
|
|||
candidates.append(words[-1]['e'])
|
||||
source_duration = round(max(candidates), 3)
|
||||
|
||||
lo = min(s['start'] for s in segments) - EDL_WORD_CONTEXT_SECONDS
|
||||
hi = max(s['end'] for s in segments) + EDL_WORD_CONTEXT_SECONDS
|
||||
words_out = [
|
||||
{"w": w["w"], "s": round(w["s"], 3), "e": round(w["e"], 3)}
|
||||
for w in words if w["e"] >= lo and w["s"] <= hi
|
||||
for w in words
|
||||
]
|
||||
|
||||
current_file = (clip.get('video_url') or '').split('/')[-1]
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -114,7 +114,8 @@ class TestGetEdl:
|
|||
assert data["has_captions"] is False
|
||||
assert data["source"]["available"] is True
|
||||
assert data["source"]["url"] == f"/api/source/{JOB_ID}"
|
||||
# All three transcript words sit within the ±context window.
|
||||
# The editor gets the whole source transcript, not a window around
|
||||
# the clip: a cut can only be extended into words it was sent.
|
||||
assert [w["w"] for w in data["words"]] == ["hello", "world", "again"]
|
||||
assert data["limits"]["max_segments"] == recut.MAX_SEGMENTS
|
||||
# Self-host meters nothing.
|
||||
|
|
|
|||
Loading…
Reference in a new issue