Skip to content

Conversation

@santhoshvai
Copy link
Member

@santhoshvai santhoshvai commented Oct 24, 2025

💡 Overview

Currently our floating video dimensions are hardcoded. This looks fine in a iPhone Xs phone. Anything taller or wider, it looks small.

Our dogfood app had a custom implementation based on window dimensions so we didnt use it. But this is also flawed, as this didnt adapt to portrait to landscape change.

📝 Implementation notes

I implemented the Android AOSP PiP mode algorithm. Which is based on the video dimensions.

Now it works well on larger devices like iPad too. Looks similar to Facetime behaviour now. If the video changes to landscape, will adapt to that as well now.

IMG_0016 IMG_0017

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements adaptive floating video dimensions based on the Android AOSP PiP mode algorithm, replacing the previous hardcoded dimensions. The new implementation calculates dimensions dynamically based on video aspect ratio and container width (23% of container width), making the floating video appear appropriately sized across different devices including iPads.

Key Changes:

  • Removed hardcoded floating video dimensions in favor of aspect-ratio-based calculations
  • Made useTrackDimensions hook accept optional participant parameter
  • Created new useFloatingVideoDimensions hook implementing AOSP PiP algorithm

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sample-apps/react-native/dogfood/src/theme.ts Removed custom hardcoded floating video dimensions from dogfood app theme
packages/react-native-sdk/src/hooks/useTrackDimensions.ts Made participant parameter optional to support undefined participants
packages/react-native-sdk/src/constants/index.ts Removed hardcoded FLOATING_VIDEO_VIEW_STYLE constant
packages/react-native-sdk/src/components/Participant/FloatingParticipantView/useFloatingVideoDimensions.tsx Added new hook implementing adaptive dimensions based on video aspect ratio
packages/react-native-sdk/src/components/Participant/FloatingParticipantView/index.tsx Integrated adaptive dimensions and conditional rendering based on calculated dimensions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@santhoshvai santhoshvai merged commit 5a213d2 into main Oct 24, 2025
6 checks passed
@santhoshvai santhoshvai deleted the floating-video-dimensions branch October 24, 2025 12:42
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.

3 participants