VIDSOL-599: Hide local screenshare view when sharing entire screen to prevent infinite mirror effect#381
VIDSOL-599: Hide local screenshare view when sharing entire screen to prevent infinite mirror effect#381
Conversation
… prevent infinite mirror effect
frontend/src/components/MeetingRoom/ScreenSharePublisher/ScreenSharePublisher.tsx
Outdated
Show resolved
Hide resolved
…odule.scss, Move a message to en.json
|
Thanks for the suggestions. I've pushed the updates addressing the comments. |
|
Pd: tests are failing, maybe you need to execute yarn test:integration update ? |
Hossein-Movahed
left a comment
There was a problem hiding this comment.
Hey, great work on this! A few things to address.
frontend/src/components/MeetingRoom/ScreenSharePublisher/ScreenSharePublisher.tsx
Outdated
Show resolved
Hide resolved
|
Thanks for the suggestion. I've updated the logic as recommended. The update has been pushed. |
There was a problem hiding this comment.
Thank you @ydumburs, just a few comments, and please add more tests, we need minimum 80% coverage for new code, and make sure the E2E test are passing
frontend/src/components/MeetingRoom/ScreenSharePublisher/ScreenSharePublisher.tsx
Outdated
Show resolved
Hide resolved
frontend/src/components/MeetingRoom/ScreenSharePublisher/ScreenSharePublisher.tsx
Show resolved
Hide resolved
|
Hi @Hossein-Movahed @OscarFava, I can't access the SonarCloud details page from my account. Could you please share which files or lines are uncovered so I can add the missing tests? |
frontend/src/hooks/useScreenShare.tsx |
|
@ydumburs the E2E test is failing, the test now expects "You are sharing your screen." on the publisher side (Chrome always picks entire screen in E2E) instead of the User One's screen |
|
Thank you @Hossein-Movahed . Updated the screenshare test. |
OscarFava
left a comment
There was a problem hiding this comment.
Awesome work, minor comment.
frontend/src/components/MeetingRoom/ScreenSharePublisher/ScreenSharePublisher.tsx
Outdated
Show resolved
Hide resolved
|
| > | ||
| <ScreenShareNameDisplay name={streamName} box={box} /> | ||
| {isEntireScreen ? ( | ||
| <div className="absolute inset-0 flex items-center justify-center text-xl font-medium bg-vera-dark-background text-vera-on-background pointer-events-none"> |
There was a problem hiding this comment.
text-xl is wrong. You can use text-vera-heading-4
There was a problem hiding this comment.
Same with font-medium. You should use our tokens.
There was a problem hiding this comment.
Thanks for the suggestion. I'll update the text and font.
There was a problem hiding this comment.
Is this fixed? I do not see the changes.
There was a problem hiding this comment.
I fixed this locally but still waiting for @Hossein-Movahed 's answer on the next thread which I may need to change this part as well.
There was a problem hiding this comment.
Hi, I've addressed the requested change.
| const mediaStream = videoEl.srcObject as MediaStream | null; | ||
| const track = mediaStream?.getVideoTracks?.()[0]; | ||
| const displaySurface = track?.getSettings?.()?.displaySurface; | ||
| setIsEntireScreen(displaySurface === 'monitor'); |
There was a problem hiding this comment.
The displaySurface detection doesn't work in Firefox since getSettings() exists but displaySurface is not part of Firefox's implementation, so isEntireScreen will always be false there, causing the mirror effect.
A reliable fix is to fall back to comparing the track dimensions against the screen dimensions when displaySurface is undefined:
const settings = track?.getSettings?.();
const displaySurface = settings?.displaySurface;
// Firefox does not support displaySurface — fall back to dimension comparison
const isMonitor =
displaySurface === 'monitor' ||
(!displaySurface && settings?.width === screen.width && settings?.height === screen.height);
setIsEntireScreen(isMonitor);
Don't forget to add a test for the Firefox fallback path (where displaySurface is undefined but dimensions match the screen).
There was a problem hiding this comment.
Thanks for the suggestion. I'm trying to hide the mirror effect for full screen sharing while keeping the Firefox PiP icon visible. Since the PiP icon seems to be browser-controlled and tied to the video element, hiding the video also hides the icon.
Do we want to:
- Fully hide the mirror and lose PiP, or
- Keep PiP visible and partially mask the screen?
What would you prefer from a UX perspective?
There was a problem hiding this comment.
Hi @Hossein-Movahed , just following up on this. Could you check the comment and let me know your thoughts when you have time?
There was a problem hiding this comment.
I'd go with fully hiding the mirror. The mirror effect is a clear visual bug that affects all full-screen sharers, while PiP on a local screenshare preview is rarely used. The overlay already gives enough feedback. The trade off is worth it i guess
There was a problem hiding this comment.
Got it, thanks for the confirmation. I'll fully hide the video element.
There was a problem hiding this comment.
Hi, I've addressed the requested changed - fixed firefox fallback. Also, resolved lint and conflict issues. Could you please take another look?
|
vcr:deploy |
✅ Deployed to VCRURL: https://neru-ca37991c-vonage-video-react-app-vera-pr-381.euw1.runtime.vonage.cloud Commit: |
Hossein-Movahed
left a comment
There was a problem hiding this comment.
@ydumburs , we need the string local in de as well
863b15c to
37d0f29
Compare



What is this PR doing?
Hides the local publisher screenshare preview when the user shares the entire screen (displaySurface==='monitor') to prevent infinite mirror effect. The behavior only applies to entire screen mode. Tab and Window sharing remain unchanged.
How should this be manually tested?
What are the relevant tickets?
A maintainer will add this ticket number.
Resolves VIDSOL-599
Checklist
[x] Branch is based on
develop(notmain).[ ] 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?