Skip to content

VIDCS-3437: Account for portrait and landscape cameras on mobile devices #110

New issue

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

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

Already on GitHub? # to your account

Merged
merged 15 commits into from
Mar 13, 2025

Conversation

cpettet
Copy link
Contributor

@cpettet cpettet commented Feb 28, 2025

What is this PR doing?

Description

Makes the publisher match the corresponding subscriber for a participant by maintaining the aspect ratio of the stream. Current behavior shows a zoomed-in version of the publisher, which is especially strange on mobile. Also, I believe this solves the weird grey edges in certain viewports (or it makes it less apparent, at least).

After Images

Screenshot 2025-03-05 at 5 28 20 PM
Screenshot 2025-03-05 at 5 27 42 PM
Screenshot 2025-03-05 at 5 27 33 PM

Before Image 😂

vera-desktop-current

How should this be manually tested?

Reproing the issue
  • on the deployed app, enter a room on mobile and desktop
  • notice how the mobile publisher does not match what was in the meeting room and also does not match what's on the desktop participant's subscriber
Verifying the fix
  • checkout this branch
  • enter a room on mobile and desktop
  • notice the mobile publisher matches the waiting room preview publisher
  • notice mobile publisher matches the desktop subscriber
  • try a few edge cases (I may have missed one, please double-check)
  • screenshare publisher, screenshare subscriber
  • 3+ participants
  • pin a user or two

What are the relevant tickets?

A maintainer will add this ticket number.

Resolves VIDCS-3437

Checklist

[✅] Branch is based on develop (not main).
[ ] Resolves a Known Issue.
[ ] If yes, did you remove the item from the docs/KNOWN_ISSUES.md?
[ ] Resolves an item reported in Issues.
If yes, which issue? Issue Number?

@cpettet cpettet added the do-not-review Do not review label Feb 28, 2025
@maikthomas maikthomas removed the do-not-review Do not review label Mar 6, 2025
behei-vonage
behei-vonage previously approved these changes Mar 6, 2025
Copy link
Contributor

@behei-vonage behei-vonage left a comment

Choose a reason for hiding this comment

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

LGTM! great job 🚀

Copy link
Contributor

@maikthomas maikthomas left a comment

Choose a reason for hiding this comment

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

Looks like an issue with screenshare, also a Q. Otherwise things look good 🙏

@@ -50,6 +50,9 @@ const VideoTile = forwardRef(
<div
className={`relative left-0 top-0 size-full overflow-hidden rounded-xl ${isTalking ? 'outline outline-2 outline-sky-500' : ''} ${!hasVideo ? 'hidden' : ''}`}
ref={ref}
style={{
backgroundColor: 'rgba(60, 64, 67, 0.55)',
Copy link
Contributor

Choose a reason for hiding this comment

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

how come we're using style for everything in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed most of them back. This one needs to stay, though.

Using style made it easier to test different props with the devTools. If I manually edited it through the .object-contain, object-fill, etc., classes, it would make changes for all of the elements with that class.

@v-kpheng
Copy link
Collaborator

@cpettet, is this ready for review again? If so, I can help since Mike is on Beer time.

@@ -216,7 +216,7 @@ describe('getLayoutBoxes', () => {
);
});

it('should call getLayout with shouldMakeLargeTilesLandscape flag false for single pinned participants with no screenshare', () => {
it('should call getLayout with shouldMakeLargeTilesLandscape flag true for single pinned participants with no screenshare', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want non-screenshare video tiles to be landscape

box && {
left: box.left,
top: box.top,
// We subtract the margins from width and height
width: box.width - VIDEO_TILE_MARGIN,
width: box.width - VIDEO_TILE_MARGIN - (isScreenShare ? 0 : 6),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the non-screenshare publisher and subscriber tiles, the video tile container was peaking out. We didn't see it before because we weren't using object-fit: contain, but we were using object-fit: cover which blew up the image. That's also why mobile publishers looked so strange - we were making a 16:9 image out of a 9:16 image 🤠.

We use 6 since there aren't fractional pixels, but I think it should be 6.22 as 14.22 / 8 is a 16 / 9 ratio.

v-kpheng
v-kpheng previously approved these changes Mar 13, 2025
Copy link
Collaborator

@v-kpheng v-kpheng left a comment

Choose a reason for hiding this comment

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

LGTM! 💪 🚀

Copy link
Collaborator

@v-kpheng v-kpheng left a comment

Choose a reason for hiding this comment

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

LGTM! 💪 🚀

Copy link
Contributor

@behei-vonage behei-vonage left a comment

Choose a reason for hiding this comment

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

LGTM! great job :shipit:

@DeliaTok
Copy link
Collaborator

looks good!

@behei-vonage behei-vonage merged commit a0dbb8a into develop Mar 13, 2025
7 checks passed
@behei-vonage behei-vonage deleted the cpettet/vidcs-3437-viewports branch March 13, 2025 23:28
cpettet added a commit that referenced this pull request Mar 19, 2025
cpettet added a commit that referenced this pull request Mar 19, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants