Skip to content

Use custom player in VideoDetails with deep-link start time#1663

Merged
LeonardoRosaa merged 43 commits into
mainfrom
horatiu-lig-9807-show-event-bars-on-the-timeline.d
Jul 20, 2026
Merged

Use custom player in VideoDetails with deep-link start time#1663
LeonardoRosaa merged 43 commits into
mainfrom
horatiu-lig-9807-show-event-bars-on-the-timeline.d

Conversation

@horatiualmasan

@horatiualmasan horatiualmasan commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What has changed and why?

Last of 4 PRs splitting #1649.

Switches VideoDetails to the custom player: instead of seeking after load,
it hands the deep-linked frame's timestamp to VideoPlayer via startTimeS,
and remounts on frame-number change via a composite #key. Aligns the
annotation overlay to the <video> box (not the full player chrome) and
fixes min-h-0 layout so the player fills its card.

How has it been tested?

New VideoDetails unit tests covering the on-mount frame-load branch
(deep-link vs. playback-time) and the deep-link startTimeS handoff. Plus
manual testing.

Did you update CHANGELOG.md?

  • Yes
  • Not needed (internal change)

Summary by CodeRabbit

  • New Features
    • Deep-linked video frames now open at the correct playback position.
    • Video annotations render as an overlay that stays precisely aligned and scaled as the video resizes.
  • Bug Fixes
    • Improved video details remounting and layout behavior in both grouped and standard views.
    • Updated frame loading logic to avoid stale frame content when navigating between frames and ensured playback sync is properly stopped when leaving the view.

horatiualmasan and others added 22 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>
@horatiualmasan
horatiualmasan requested a review from a team as a code owner July 16, 2026 13:43
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: eda97628-8100-4e19-ad55-2982599e525f

📥 Commits

Reviewing files that changed from the base of the PR and between 50e2836 and 591e697.

📒 Files selected for processing (1)
  • lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/videos/[sample_id]/+page.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
  • lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/videos/[sample_id]/+page.svelte

📝 Walkthrough

Walkthrough

VideoDetails now supports frame-based deep-link playback, positions annotations over the measured video element, and stops frame synchronization on unmount. The video route remounts on frame changes, while tests validate loading and resolved playback start times.

Changes

Video frame navigation

Layer / File(s) Summary
Route frame-keyed remounting
lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/videos/[sample_id]/+page.svelte
The route derives frameNumber, remounts VideoDetails when the sample or frame changes, and adjusts video container sizing.
Frame loading and video overlay
lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte
VideoDetails loads either the initial or deep-linked frame, passes the resolved timestamp to VideoPlayer, observes video geometry, and positions annotations over the video.
Stub capture and playback tests
lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.stub.svelte, lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts
The test stub captures player props and renders children; tests cover initial loading, deep-link resolution, timestamp adjustment, and non-matching frames.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VideoPage
  participant VideoDetails
  participant useVideoFrames
  participant VideoPlayer
  VideoPage->>VideoDetails: remount for sample_id and frameNumber
  VideoDetails->>useVideoFrames: load initial or deep-linked frame
  useVideoFrames-->>VideoDetails: provide current frame
  VideoDetails->>VideoPlayer: pass startTimeS
  VideoDetails->>VideoDetails: measure video and position annotation overlay
Loading

Possibly related PRs

Suggested reviewers: leonardorosaa

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: switching VideoDetails to the custom player with deep-link start time handling.
Description check ✅ Passed The description follows the required template and covers the change, testing, and changelog status with adequate detail.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch horatiu-lig-9807-show-event-bars-on-the-timeline.d

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 and others added 6 commits July 16, 2026 16:48
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
horatiualmasan force-pushed the horatiu-lig-9807-show-event-bars-on-the-timeline.c branch from 5a07a5b to 7dede03 Compare July 16, 2026 20:11
…github.com:lightly-ai/lightly-studio into horatiu-lig-9807-show-event-bars-on-the-timeline.d
horatiualmasan and others added 2 commits July 16, 2026 23:34
@horatiualmasan

Copy link
Copy Markdown
Contributor Author

/review

Base automatically changed from horatiu-lig-9807-show-event-bars-on-the-timeline.c to main July 20, 2026 13:25

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte (1)

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

Scope the ResizeObserver tightly within the effect.

resizeObserver is declared at the component level but is only utilized inside the $effect. Moving its declaration inside the effect prevents potential reference leaks or stale closure issues during cleanup, keeping the component state clean.

♻️ Proposed refactor
-    let resizeObserver: ResizeObserver;
-
     // Align the annotation overlay to the <video> box, not the full player chrome.
     $effect(() => {
         if (!videoEl || !videoFrameContainerEl) return;
 
         const updateOverlaySize = () => {
             if (!videoEl || !videoFrameContainerEl) return;
             const videoRect = videoEl.getBoundingClientRect();
             const containerRect = videoFrameContainerEl.getBoundingClientRect();
             overlayLeft = videoRect.left - containerRect.left;
             overlayTop = videoRect.top - containerRect.top;
             videoWidth = videoRect.width;
             videoHeight = videoRect.height;
         };
         updateOverlaySize();
 
-        resizeObserver = new ResizeObserver(updateOverlaySize);
-        resizeObserver.observe(videoEl);
-        resizeObserver.observe(videoFrameContainerEl);
+        const resizeObserver = new ResizeObserver(updateOverlaySize);
+        resizeObserver.observe(videoEl);
+        resizeObserver.observe(videoFrameContainerEl);
 
         return () => resizeObserver.disconnect();
     });
🤖 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/components/VideoDetails/VideoDetails.svelte`
around lines 117 - 136, Move the ResizeObserver declaration from component scope
into the $effect callback alongside its creation and observation logic, while
preserving the existing updateOverlaySize behavior and cleanup handling.
🤖 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.

Inline comments:
In
`@lightly_studio_view/src/routes/datasets/`[dataset_id]/[collection_type]/[collection_id]/videos/[sample_id]/+page.svelte:
- Line 19: Update the frameNumber derivation to parse data.frameNumber with an
explicit base-10 radix and convert any NaN result to undefined before passing it
to VideoDetails, preserving undefined for absent values.

---

Nitpick comments:
In `@lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte`:
- Around line 117-136: Move the ResizeObserver declaration from component scope
into the $effect callback alongside its creation and observation logic, while
preserving the existing updateOverlaySize behavior and cleanup handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 439cb8d7-7cf3-4c93-86f3-d4a52c08789e

📥 Commits

Reviewing files that changed from the base of the PR and between af13049 and 50e2836.

📒 Files selected for processing (4)
  • lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.stub.svelte
  • lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte
  • lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts
  • lightly_studio_view/src/routes/datasets/[dataset_id]/[collection_type]/[collection_id]/videos/[sample_id]/+page.svelte

@LeonardoRosaa
LeonardoRosaa enabled auto-merge July 20, 2026 15:49
@LeonardoRosaa
LeonardoRosaa added this pull request to the merge queue Jul 20, 2026
Merged via the queue into main with commit 2ffcae0 Jul 20, 2026
21 checks passed
@LeonardoRosaa
LeonardoRosaa deleted the horatiu-lig-9807-show-event-bars-on-the-timeline.d branch July 20, 2026 16:58
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