Skip to content

fix: keep objectfit as cover for floating video view #1849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 9, 2025
Merged

Conversation

santhoshvai
Copy link
Member

@santhoshvai santhoshvai commented Jul 8, 2025

💡 Overview

In this PR,

  • we make sure that floating participant view is always cover, because its always a small view
  • we also remove usage of track.getSettings() for local participant as it was incorrect

⏩ Next iteration - TODO

Next, We should wait for dimensions to be valid to render the video element.

If we wait now, the delay is 2 seconds for rtc stats to appear, this makes the video component render after an unnecessary delay.

We will next add a native event listener webrtc level to send dimensions change update. Then add this mechanism.

@santhoshvai santhoshvai changed the title Wait contain fix: do not change objectFit on the fly by default Jul 8, 2025
@santhoshvai santhoshvai changed the title fix: do not change objectFit on the fly by default fix: do not change objectfit on the fly by default Jul 8, 2025
Copy link
Contributor

@Copilot 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 ensures the video’s objectFit behavior remains stable by waiting for valid frame dimensions before rendering and defaulting floating participant views to cover.

  • Simplified useTrackDimensions hook: removed local getSettings() logic and unified on-call stats for all participants.
  • Updated VideoRenderer to gate rendering on valid dimensions or an explicit objectFit prop.
  • Defaulted objectFit="cover" for floating participant views in CallContent.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/react-native-sdk/src/hooks/useTrackDimensions.ts Removed trackType param and getSettings() effect; use call stats for all.
packages/react-native-sdk/src/components/Participant/ParticipantView/VideoRenderer.tsx Added isVideoDimensionsValid check and integrated objectFit gating.
packages/react-native-sdk/src/components/Call/CallContent/CallContent.tsx Passed objectFit="cover" to floating ParticipantView.
Comments suppressed due to low confidence (1)

packages/react-native-sdk/src/hooks/useTrackDimensions.ts:32

  • [nitpick] Consider adding unit tests for useTrackDimensions to verify that it correctly updates dimensions based on call stats, especially covering transitions from zero to non-zero values.
  useEffect(() => {

@santhoshvai santhoshvai changed the title fix: do not change objectfit on the fly by default fix: keep objectfit as cover for floating video view Jul 9, 2025
@santhoshvai santhoshvai merged commit a99de4c into main Jul 9, 2025
8 checks passed
@santhoshvai santhoshvai deleted the wait-contain branch July 9, 2025 10:43
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