Skip to content

Conversation

@holzgeist
Copy link
Contributor

@holzgeist holzgeist commented Jan 22, 2026

similar to #695, but this time I needed direct access to the size (and aspect ratio) to properly configure native PiP on Android and figured that others might want that too :)

Summary by CodeRabbit

  • New Features
    • VideoTrackRenderer now emits optional resize notifications so apps can monitor displayed video dimensions and adapt layouts. Notifications account for video rotation (90/270°), ensuring reported width/height reflect the actual displayed orientation for accurate sizing and responsive UI updates.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

The VideoTrackRenderer widget now exposes an optional onResize callback that is invoked when the displayed video size changes; the callback calculation accounts for rotation (swapping width/height for 90°/270° rotations).

Changes

Cohort / File(s) Summary
Video Track Resize Notification
lib/src/widgets/video_track_renderer.dart
Added final void Function(Size)? onResize field and constructor parameter. Wired renderer's resize hook to compute displayed Size with rotation-aware width/height swap and invoke widget.onResize(Size(...)) when provided.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I nibble bytes and count each frame's size,
I hop when pixels flip beneath my eyes,
A gentle twitch — the rotation's cue,
I tell the app the width and height anew,
Hooray for tiny rabbits tracking views!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add onResize to VideoTrackRenderer' clearly and accurately summarizes the main change: adding a new onResize callback parameter to the VideoTrackRenderer widget.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


🧹 Recent nitpick comments
lib/src/widgets/video_track_renderer.dart (1)

181-196: Guard against callbacks after dispose.

If autoDisposeRenderer is false, the renderer can outlive the widget and still invoke this closure. Consider early-returning when unmounted to avoid calling widget.onResize post-dispose.

♻️ Suggested tweak
 _renderer?.onResize = () {
+  if (!mounted) return;
   final videoValue = (_renderer as ValueNotifier<rtc.RTCVideoValue>?)?.value;
   if (videoValue == null) {
     return;
   }
📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a185594 and afd64e2.

📒 Files selected for processing (1)
  • lib/src/widgets/video_track_renderer.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Build for Flutter Web
  • GitHub Check: Build for Flutter macOS
  • GitHub Check: Build for Flutter Web WASM
  • GitHub Check: Build for Flutter Linux
  • GitHub Check: Build for Flutter Windows
  • GitHub Check: Build for Flutter Android
  • GitHub Check: Dart Test Check
🔇 Additional comments (1)
lib/src/widgets/video_track_renderer.dart (1)

72-83: Nice API addition; wiring looks correct.

The new onResize field and constructor parameter are cleanly added and follow existing patterns.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

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.

1 participant