Skip to content

Add video event model (toVideoEvents, assignEventLanes)#1671

Merged
LeonardoRosaa merged 44 commits into
mainfrom
horatiu-lig-9807-show-event-bars-on-the-timeline-3-events-model
Jul 20, 2026
Merged

Add video event model (toVideoEvents, assignEventLanes)#1671
LeonardoRosaa merged 44 commits into
mainfrom
horatiu-lig-9807-show-event-bars-on-the-timeline-3-events-model

Conversation

@horatiualmasan

@horatiualmasan horatiualmasan commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What has changed and why?

Adds a small, UI-agnostic utility layer for temporal video events, the foundation for the event bar on the video timeline. toVideoEvents maps classification annotations that carry a temporal span (e.g. ActivityNet-style imports) into sorted VideoEvents with label-derived colors; assignEventLanes greedily packs overlapping events into separate lanes so none hides another. Pure functions with no component dependencies, so they can be reused for any temporal-annotation source.

How has it been tested?

Unit tests in videoEvents.test.ts cover filtering, mapping, sorting, and lane assignment (including overlap cases).

Did you update CHANGELOG.md?

  • Yes
  • Not needed (internal change)

Summary by CodeRabbit

  • New Features

    • Added support for converting classification annotations with time spans into sorted video timeline events.
    • Added automatic event lane assignment so overlapping events display on separate rows while reusing available lanes.
    • Added deterministic event colors and improved label contrast for timeline visualization.
  • Tests

    • Added coverage for event conversion, sorting, filtering, overlap handling, and lane reuse.

horatiualmasan and others added 30 commits July 7, 2026 17:54
…ions' into horatiu-lig-9805-import-activitynet-style-event-annotations-3
Previously, filtering and counting video annotations only considered
annotations attached to a video's frames. Videos can also carry
annotations directly (e.g. ActivityNet-style event/classification labels
on the whole video). This makes both the video filter and the annotation
counter consider these direct video annotations in addition to frame
annotations.
…ions-3' into horatiu-lig-9806-filter-videos-by-event-metadata
Mirrors a <video> element's playback state into reactive fields and
exposes intent callbacks (seek, play/pause, mute, fullscreen) for a
custom control bar. Listening via native events keeps it composable
with handlers on the element. Covered by a harness-driven unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Compose useVideoPlayback + VideoControls, forcing native <video controls>
off so the full-width scrubber can host aligned timeline overlays. Adds a
startTimeS prop (null waits for a deep-link timestamp) and a region ref
for fullscreen. Updates tests and stories accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hand the deep-linked frame's timestamp to VideoPlayer via startTimeS
instead of seeking after load, and remount on frame-number change with
a composite #key. Align the annotation overlay to the <video> box and
fix min-h-0 layout so the player fills its card. Adds a VideoDetails
test covering the frame-load branch and deep-link handoff.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Full-width scrubber + transport buttons that own no playback state and
call back on user intent. Includes helpers (formatTime, clampPercent,
timeFromClientX) and unit tests. Exported from the components barrel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Interactive Playground plus paused / near-end states, on a dark backdrop
matching how the bar overlays a video.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hand the deep-linked frame's timestamp to VideoPlayer via startTimeS
instead of seeking after load, and remount on frame-number change with
a composite #key. Align the annotation overlay to the <video> box and
fix min-h-0 layout so the player fills its card. Adds a VideoDetails
test covering the frame-load branch and deep-link handoff.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Compose useVideoPlayback + VideoControls, forcing native <video controls>
off so the full-width scrubber can host aligned timeline overlays. Adds a
startTimeS prop (null waits for a deep-link timestamp) and a region ref
for fullscreen. Updates tests and stories accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirrors a <video> element's playback state into reactive fields and
exposes intent callbacks (seek, play/pause, mute, fullscreen) for a
custom control bar. Listening via native events keeps it composable
with handlers on the element. Covered by a harness-driven unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Interactive Playground plus paused / near-end states, on a dark backdrop
matching how the bar overlays a video.
horatiualmasan and others added 6 commits July 16, 2026 23:15
…github.com:lightly-ai/lightly-studio into horatiu-lig-9807-show-event-bars-on-the-timeline.d
…o horatiu-lig-9807-show-event-bars-on-the-timeline.d
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@horatiualmasan
horatiualmasan requested a review from a team as a code owner July 16, 2026 21:01
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Video event utilities

Layer / File(s) Summary
Event transformation contract and implementation
lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts, lightly_studio_view/src/lib/utils/videoEvents/videoEvents.test.ts, lightly_studio_view/src/lib/utils/index.ts
Defines video event types, converts eligible classification annotations with temporal spans into sorted events, derives colors, tests the transformation, and exports the utilities and types.
Lane allocation and validation
lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts, lightly_studio_view/src/lib/utils/videoEvents/videoEvents.test.ts
Assigns overlapping events to separate lanes, reuses available lanes, reports the lane count, and tests allocation behavior.

Estimated code review effort: 2 (Simple) | ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding the video event model utilities.
Description check ✅ Passed The description matches the required template and includes change summary, testing details, and changelog status.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch horatiu-lig-9807-show-event-bars-on-the-timeline-3-events-model

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@horatiualmasan

Copy link
Copy Markdown
Contributor Author

/review

horatiualmasan and others added 6 commits July 17, 2026 14:11
Base automatically changed from horatiu-lig-9807-show-event-bars-on-the-timeline.d to main July 20, 2026 16:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts (1)

77-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using a secondary sort criterion for visual stability.

When multiple events start at the exact same time, sorting them secondarily by their end time (descending) guarantees that longer events are processed first. In the context of assignEventLanes, this places longer events on lower-indexed lanes, forming a clean visual "base" over which shorter, concurrent events stack neatly.

Consider updating the sort logic in both utility functions to maintain consistent event ordering:

  • lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts#L77-L77: Update the sort inside assignEventLanes to (a, b) => a.startTimeS - b.startTimeS || b.endTimeS - a.endTimeS.
  • lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts#L63-L63: Update the sort inside toVideoEvents identically so the default output is also thoroughly stable.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts` at line 77,
Update the event sorting in both toVideoEvents and assignEventLanes in
lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts:63-63 and
lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts:77-77 to sort by
startTimeS ascending, then endTimeS descending when start times match, ensuring
consistent stable ordering with longer concurrent events processed first.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts`:
- Line 77: Update the event sorting in both toVideoEvents and assignEventLanes
in lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts:63-63 and
lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts:77-77 to sort by
startTimeS ascending, then endTimeS descending when start times match, ensuring
consistent stable ordering with longer concurrent events processed first.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9e9c2cf7-4cdc-479e-b22b-c3c9551bb5ed

📥 Commits

Reviewing files that changed from the base of the PR and between 2ffcae0 and 93bd70a.

📒 Files selected for processing (3)
  • lightly_studio_view/src/lib/utils/index.ts
  • lightly_studio_view/src/lib/utils/videoEvents/videoEvents.test.ts
  • lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts

@LeonardoRosaa
LeonardoRosaa enabled auto-merge July 20, 2026 17:42
@LeonardoRosaa
LeonardoRosaa added this pull request to the merge queue Jul 20, 2026
Merged via the queue into main with commit 1c89cf2 Jul 20, 2026
22 checks passed
@LeonardoRosaa
LeonardoRosaa deleted the horatiu-lig-9807-show-event-bars-on-the-timeline-3-events-model branch July 20, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants