Skip to content

Add waveform cue creation and playhead timing commands #36

@laubonghaudoi

Description

@laubonghaudoi

Summary

Make the waveform more like a fast captioning workspace by adding cue creation and timing commands around the current playhead. This focuses on high-impact interactions, not a large desktop-style toolbar.

Why this is in scope

The app already uses wavesurfer regions for cue display and drag/resize editing. This issue adds the missing browser-friendly editing operations users expect from a subtitle editor: create a cue from the waveform, set start/end from playback, and move quickly to the next cue.

Initial scope

  • Drag empty waveform space to create a new subtitle cue.
  • Insert a subtitle at the current playback position.
  • Set selected cue start to current playback time.
  • Set selected cue end to current playback time.
  • Set selected cue end and advance to the next cue.
  • Add minimal keyboard shortcuts for the above.

Non-goals

  • Shot-change detection.
  • Spectrogram mode.
  • Silence detection.
  • Full user-configurable shortcuts.

Implementation plan

  1. Extend subtitle actions.

    • Add action helpers in hooks/use-subtitle-actions.ts for inserting a subtitle at a time range and updating the active cue boundary from seconds.
    • Keep transformations in lib/subtitle-operations.ts where possible.
    • Ensure new cues are inserted chronologically and IDs remain consistent.
  2. Track the active/selected cue.

    • Reuse editingSubtitleUuid and current playback matching where possible.
    • If needed, add a small active cue state in app/[locale]/page.tsx or context.
    • Avoid a large selection model in this issue unless #new multi-select work lands first.
  3. Waveform interactions.

    • In components/waveform-visualizer/use-waveform-regions.ts, handle empty-space drag to create a region.
    • On create, call a parent callback to create the subtitle in React state, then let region regeneration own the final region.
    • Keep minimum duration at the existing region minimum or a simple default like 1.0s.
  4. Commands and shortcuts.

    • Add a compact command group, probably near the waveform or transport controls.
    • Add shortcuts only where they do not conflict with existing editing behavior.
    • Document shortcuts in the existing instruction/shortcut text.
    • Consider A couple of hotkey ideas #22 when choosing keybindings.
  5. Validation.

    • Prevent creating cues that cross neighboring cues when overlap clamping is enabled.
    • Clamp start/end at 0 and media duration when known.
    • Preserve undo/redo.
  6. Tests.

    • Add pure operation tests for insert/set-boundary behavior.
    • Add component-level tests only if the current test setup can cover the interaction without brittle wavesurfer mocks.

Acceptance criteria

  • A user can create a cue by dragging empty waveform space.
  • A user can set start/end of the active cue from the current playback time.
  • New cues keep chronological ordering and work with undo/redo.
  • The feature remains compact and does not turn the app into a complex desktop clone.

Related

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions