Add video event model (toVideoEvents, assignEventLanes)#1671
Conversation
…ions' into horatiu-lig-9805-import-activitynet-style-event-annotations-3
…ent-annotations-3
…ent-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.
…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>
📝 WalkthroughWalkthroughChangesVideo event utilities
Estimated code review effort: 2 (Simple) | ~15 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
/review |
…o horatiu-lig-9807-show-event-bars-on-the-timeline.b
…o horatiu-lig-9807-show-event-bars-on-the-timeline.c
…o horatiu-lig-9807-show-event-bars-on-the-timeline.d
…o horatiu-lig-9807-show-event-bars-on-the-timeline-3-events-model
…line-3-events-model
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts (1)
77-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider 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 insideassignEventLanesto(a, b) => a.startTimeS - b.startTimeS || b.endTimeS - a.endTimeS.lightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts#L63-L63: Update the sort insidetoVideoEventsidentically 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
📒 Files selected for processing (3)
lightly_studio_view/src/lib/utils/index.tslightly_studio_view/src/lib/utils/videoEvents/videoEvents.test.tslightly_studio_view/src/lib/utils/videoEvents/videoEvents.ts
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?
Summary by CodeRabbit
New Features
Tests