Skip to content

Event-triggered recording with timeline markers and configurable pre-recording #15

Open

Description

@mouldybread

Goal

Record video when an event is triggered, mark the triggering event on the timeline with an icon, and let the user configure how much footage before the trigger is included.

Scope

  • Allow event-triggered recording to be selected per camera.
  • Associate each trigger with its camera, timestamp and event type/label.
  • Show an icon at the trigger time on the timeline, distinct from the start of the recording. Clicking it should navigate to the associated recording; details should identify the event and camera.
  • Provide a configurable pre-recording duration so the saved clip includes footage leading up to the trigger. Clearly distinguish requested pre-recording from footage actually available.
  • Define the recording duration after the trigger and how repeated or overlapping triggers are handled.

Existing work to assess first

The repository already has event-based recording, a prebuffer, event metadata and timeline event navigation. Audit and reuse those paths rather than implement a second system. Establish which parts of this request already work and which need configuration, UI or reliability improvements.

Acceptance

  • A trigger records the intended camera and appears at its actual trigger timestamp on the timeline.
  • The icon remains at the trigger time even when the recording starts earlier because of pre-recording.
  • Configuring pre-recording changes the requested lead-in; missing prebuffer after startup or interruption is reported rather than claimed as captured.
  • Clicking the marker opens the correct camera and playback day, including events near midnight and across time zones.
  • Repeated triggers, cancellation, recorder restart and failed capture have deterministic, tested behavior; retained recovery evidence is preserved.
  • Tests cover zero/nonzero pre-recording, insufficient prebuffer, overlapping triggers and timeline navigation. Settings and limitations are documented.

Design questions

  • Which trigger sources should be supported beyond those already implemented?
  • Should pre-recording be configured per camera, globally, or per event request? What range is supported?
  • How long should recording continue after a trigger, and should another trigger extend the same clip or create a separate recording?
  • What icon and details should each event type display?

Related work

Coordinate recording names, day directories and media URLs with #11 / PR #13. Keep this feature separate from disk-pressure pruning in #14.

Activity

  1. mouldybread commented on Nov 28, 2026

    @mouldybread
    OwnerAuthor

    Suggested prompt for a coding assistant:

    Repo: mouldybread/SimpleNVR. Issue #15. Base: main. Audit the existing event-triggered recording, prebuffer and timeline navigation before proposing changes. Do not create a second event system.
    
    Trace triggerEventHandlerWithState in events.go, BufferManager.TriggerEvent and recordEventDuration in recorder.go, event_selection_timing.go, prebuffer_preservation.go, and seekToEvent in static/js/events.js through navigateToEvent in the playback scripts. Read docs/RECORDING_LAYOUT.md. Check buffer_test.go, event_control_terminal_integration_test.go, tests/event-navigation.cjs and tests/event-rendering.cjs.
    
    First report which acceptance cases already work, which are gaps, and what evidence supports each. Ask the owner to settle trigger sources, pre-recording scope and range, post-trigger duration, whether repeats extend or split clips, and marker icons/details. Implement only agreed gaps.
    
    Done: the intended camera records; the marker uses the trigger timestamp rather than clip start and opens the correct camera and local playback day across midnight/time zones. Test zero and nonzero lead-in, missing prebuffer, overlapping triggers, cancellation, restart and failed capture. Distinguish requested from captured footage and preserve recovery evidence. Document settings and limits.
    
    Preserve the recording layout and media URLs from merged PR #13 / closed #11. No storage-policy changes under #14. The audit can run now, but land #17 before editing playback scripts, and leave #16's path moves until after overlapping #15 work.
    
    Run go test -race ./..., node tests/event-navigation.cjs and node tests/event-rendering.cjs; use docs/CHECKPOINT_CI.md for browser checks. Return a short findings or changes summary, owner decisions, exact checks and results, and anything unverified.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions