Skip to content

fix: allow screen sharing without media devices - #40744

Open
adityasingh6533 wants to merge 3 commits into
RocketChat:developfrom
adityasingh6533:media-screen-share-without-devices
Open

fix: allow screen sharing without media devices#40744
adityasingh6533 wants to merge 3 commits into
RocketChat:developfrom
adityasingh6533:media-screen-share-without-devices

Conversation

@adityasingh6533

@adityasingh6533 adityasingh6533 commented May 31, 2026

Copy link
Copy Markdown

This PR allows a client to share their screen even when they do not have an available microphone or camera.

Previously, the media call flow depended on obtaining an audio input track before the client could fully participate in the WebRTC session. Because of that, a user without mic/camera could receive another user's audio/video or screen share, but could not start sharing their own screen.

This change makes screen sharing independent from the local audio input track by:

  • avoiding call teardown when no audio input track is available
  • allowing WebRTC offer creation without a local audio track
  • tracking screen share media separately from the audio input track
  • updating transceiver directions for audio and screen sharing independently
  • exposing screen share controls through the media session UI
  • showing the remote screen share stream in the call widget

Issue(s)

close #1745

Related to the issue where users without camera/microphone cannot share their screen during a media call.

Steps to test or reproduce

  1. Use two clients: Client A with microphone/camera available, and Client B without microphone/camera available.
  2. Start a media call from Client A to Client B.
  3. Accept the call from Client B.
  4. Confirm Client B can see/hear Client A as before.
  5. From Client B, click the screen share control.
  6. Select a screen/window/tab to share.
  7. Confirm Client A can see Client B's shared screen.
  8. Stop screen sharing from Client B.
  9. Confirm the screen share stream stops cleanly and the call remains active.

Further comments

The fix keeps audio input and screen sharing as separate media concerns. A missing audio input track should no longer prevent the client from negotiating or sending a screen share video track.

I also removed the behavior that ended calls with input-error when no local audio input was available, since that prevented screen-share-only participation.

Summary by CodeRabbit

  • New Features
    • Added screen sharing during calls with a toggle control in the call UI.
    • Remote participant screens now display inline in the call view when shared.
    • Toggle button shows a localized "Stop sharing" label when active.

@dionisio-bot

dionisio-bot Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented May 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 44c72fb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6b02e337-651d-4ce8-943a-c5d01afee379

📥 Commits

Reviewing files that changed from the base of the PR and between c536476 and e702a9d.

📒 Files selected for processing (2)
  • packages/ui-voip/src/providers/MediaCallViewProvider.tsx
  • packages/ui-voip/src/providers/useMediaSessionControls.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/ui-voip/src/providers/useMediaSessionControls.ts
  • packages/ui-voip/src/providers/MediaCallViewProvider.tsx
📜 Recent review details
⏰ 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). (1)
  • GitHub Check: cubic · AI code reviewer

Walkthrough

Adds end-to-end screen sharing: new localization and type contracts, call and WebRTC processor support for a screen-share track, relaxed negotiation/session input-track handling, provider and hooks to toggle and sync screen-share track, and OngoingCall UI to render remote screen-share video.

Changes

Screen Sharing Feature

Layer / File(s) Summary
Screen-share types and contracts
packages/i18n/src/locales/en.i18n.json, packages/media-signaling/src/definition/call/IClientMediaCall.ts, packages/media-signaling/src/definition/services/webrtc/IWebRTCProcessor.ts, packages/ui-voip/src/context/MediaCallViewContext.ts, packages/ui-voip/src/context/definitions.d.ts
Localization key Stop_sharing added; CallFeature expanded with 'screen-share'; IClientMediaCall and IWebRTCProcessor add setScreenShareTrack(); WebRTCProcessorConfig adds screenShareTrack?; UI context/types add onToggleScreenShare, screenSharing, and remoteScreenSharing.
Call and WebRTC processor implementation
packages/media-signaling/src/lib/Call.ts, packages/media-signaling/src/lib/services/webrtc/Processor.ts
ClientMediaCall stores screenShareTrack and implements setScreenShareTrack() to forward updates, renegotiate, and emit streamChange; MediaCallWebRTCProcessor stores/validates/loads a screen-share video track, adjusts transceiver directions for audio and screen-share, and adds helpers including loadScreenShareTrack().
Negotiation and session changes
packages/media-signaling/src/lib/NegotiationManager.ts, packages/media-signaling/src/lib/Session.ts
NegotiationManager.isConfigured() no longer blocks on missing input track; Session.startInputTrack() early-returns on media acquisition failure instead of hanging up calls; helper hangupCallsThatNeedInput removed.
UI provider and controls
packages/ui-voip/src/providers/MediaCallViewProvider.tsx, packages/ui-voip/src/providers/MockedMediaCallProvider.tsx, packages/ui-voip/src/providers/useMediaSession.ts, packages/ui-voip/src/providers/useMediaSessionControls.ts, packages/ui-voip/src/providers/useMediaSessionInstance.ts
MediaCallViewProvider adds screenShareTrackRef, implements onToggleScreenShare using getDisplayMedia, stops/cleans tracks on end, and exposes onToggleScreenShare; hooks compute screenSharing/remoteScreenSharing via media streams and expose setScreenShareTrack; mocked provider updated.
OngoingCall component
packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
Renders remote screen-share <video> when remoteScreenSharing is true, attaches remote stream via effect, and wires footer toggle to onToggleScreenShare with localized titles and disabled state during connecting/reconnecting.

Sequence Diagram(s)

sequenceDiagram
  participant Call as ClientMediaCall
  participant Processor as MediaCallWebRTCProcessor
  participant Transceiver as VideoTransceiver
  Call->>Processor: setScreenShareTrack(track)
  Processor->>Processor: validate track.kind === 'video'
  Processor->>Processor: loadScreenShareTrack()
  Processor->>Transceiver: setTrack / updateDirection
  Processor->>Call: emit streamChange
Loading
sequenceDiagram
  participant UI as OngoingCall
  participant Provider as MediaCallViewProvider
  participant Controls as useMediaSessionControls
  participant Call as ClientMediaCall
  UI->>Provider: onToggleScreenShare()
  Provider->>Provider: getDisplayMedia()
  Provider->>Controls: setScreenShareTrack(track)
  Controls->>Call: setScreenShareTrack(track)
  Call->>Provider: streamChange -> context update
  Provider->>UI: render remote video
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • aleksandernsilva
  • tassoevan
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: enabling screen sharing capability without requiring media devices.
Linked Issues check ✅ Passed The PR fulfills the core requirement from #1745: enabling screen sharing for clients without camera/mic by removing input track dependencies and managing screen-share tracks separately.
Out of Scope Changes check ✅ Passed All changes are directly aligned with enabling screen sharing without media devices; no unrelated modifications detected.
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.

✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch media-screen-share-without-devices

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label May 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/ui-voip/src/providers/MediaCallViewProvider.tsx (1)

212-237: ⚡ Quick win

Guard onToggleScreenShare against re-entrancy.

screenShareTrackRef.current is only set after getDisplayMedia resolves. If the toggle is invoked twice before the first prompt resolves, two getDisplayMedia requests run; the second overwrites the ref, orphaning the first track so it keeps capturing the screen with no way to stop it. A simple in-flight flag avoids the orphaned capture.

♻️ Proposed guard
+	const screenShareBusyRef = useRef(false);
+
 	const onToggleScreenShare = useCallback(async () => {
 		if (screenShareTrackRef.current) {
 			await stopScreenShare();
 			return;
 		}
 
+		if (screenShareBusyRef.current) {
+			return;
+		}
+		screenShareBusyRef.current = true;
 		try {
 			if (!navigator.mediaDevices.getDisplayMedia) {
 				return;
 			}
 
 			const stream = await navigator.mediaDevices.getDisplayMedia({ video: true });
 			const [track] = stream.getVideoTracks();
 			if (!track) {
 				return;
 			}
 
 			screenShareTrackRef.current = track;
 			track.addEventListener('ended', () => {
 				void stopScreenShare();
 			});
 			await controls.setScreenShareTrack(track);
 		} catch (error) {
 			console.error('Media Call - Error sharing screen', error);
+		} finally {
+			screenShareBusyRef.current = false;
 		}
 	}, [controls, stopScreenShare]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui-voip/src/providers/MediaCallViewProvider.tsx` around lines 212 -
237, onToggleScreenShare can be re-entered while
navigator.mediaDevices.getDisplayMedia is pending, allowing two concurrent
requests that orphan the first track; introduce an in-flight guard (e.g., a
local ref like screenShareInFlightRef) checked at the start of
onToggleScreenShare and set true before awaiting getDisplayMedia then set false
in finally so a second call returns early; ensure the guard is cleared on both
success and error and keep existing logic that sets screenShareTrackRef.current
and calls stopScreenShare unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/ui-voip/src/providers/MediaCallViewProvider.tsx`:
- Around line 212-237: onToggleScreenShare can be re-entered while
navigator.mediaDevices.getDisplayMedia is pending, allowing two concurrent
requests that orphan the first track; introduce an in-flight guard (e.g., a
local ref like screenShareInFlightRef) checked at the start of
onToggleScreenShare and set true before awaiting getDisplayMedia then set false
in finally so a second call returns early; ensure the guard is cleared on both
success and error and keep existing logic that sets screenShareTrackRef.current
and calls stopScreenShare unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 993b7255-c7d5-4504-8b65-5e8bf132f1c7

📥 Commits

Reviewing files that changed from the base of the PR and between 0ef1002 and c536476.

⛔ Files ignored due to path filters (1)
  • packages/ui-voip/src/views/MediaCallWidget/__snapshots__/MediaCallWidget.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (15)
  • packages/i18n/src/locales/en.i18n.json
  • packages/media-signaling/src/definition/call/IClientMediaCall.ts
  • packages/media-signaling/src/definition/services/webrtc/IWebRTCProcessor.ts
  • packages/media-signaling/src/lib/Call.ts
  • packages/media-signaling/src/lib/NegotiationManager.ts
  • packages/media-signaling/src/lib/Session.ts
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
  • packages/ui-voip/src/context/MediaCallViewContext.ts
  • packages/ui-voip/src/context/definitions.d.ts
  • packages/ui-voip/src/providers/MediaCallViewProvider.tsx
  • packages/ui-voip/src/providers/MockedMediaCallProvider.tsx
  • packages/ui-voip/src/providers/useMediaSession.ts
  • packages/ui-voip/src/providers/useMediaSessionControls.ts
  • packages/ui-voip/src/providers/useMediaSessionInstance.ts
  • packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
💤 Files with no reviewable changes (1)
  • packages/media-signaling/src/lib/NegotiationManager.ts
📜 Review details
⏰ 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). (1)
  • GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • packages/ui-voip/src/context/definitions.d.ts
  • packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
  • packages/media-signaling/src/definition/services/webrtc/IWebRTCProcessor.ts
  • packages/media-signaling/src/definition/call/IClientMediaCall.ts
  • packages/ui-voip/src/providers/useMediaSessionInstance.ts
  • packages/ui-voip/src/providers/useMediaSessionControls.ts
  • packages/media-signaling/src/lib/Call.ts
  • packages/ui-voip/src/providers/MockedMediaCallProvider.tsx
  • packages/ui-voip/src/context/MediaCallViewContext.ts
  • packages/media-signaling/src/lib/Session.ts
  • packages/ui-voip/src/providers/MediaCallViewProvider.tsx
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
  • packages/ui-voip/src/providers/useMediaSession.ts
🧠 Learnings (6)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • packages/ui-voip/src/context/definitions.d.ts
  • packages/media-signaling/src/definition/services/webrtc/IWebRTCProcessor.ts
  • packages/media-signaling/src/definition/call/IClientMediaCall.ts
  • packages/ui-voip/src/providers/useMediaSessionInstance.ts
  • packages/ui-voip/src/providers/useMediaSessionControls.ts
  • packages/media-signaling/src/lib/Call.ts
  • packages/ui-voip/src/context/MediaCallViewContext.ts
  • packages/media-signaling/src/lib/Session.ts
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
  • packages/ui-voip/src/providers/useMediaSession.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • packages/ui-voip/src/context/definitions.d.ts
  • packages/media-signaling/src/definition/services/webrtc/IWebRTCProcessor.ts
  • packages/media-signaling/src/definition/call/IClientMediaCall.ts
  • packages/ui-voip/src/providers/useMediaSessionInstance.ts
  • packages/ui-voip/src/providers/useMediaSessionControls.ts
  • packages/media-signaling/src/lib/Call.ts
  • packages/ui-voip/src/context/MediaCallViewContext.ts
  • packages/media-signaling/src/lib/Session.ts
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
  • packages/ui-voip/src/providers/useMediaSession.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • packages/ui-voip/src/context/definitions.d.ts
  • packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
  • packages/media-signaling/src/definition/services/webrtc/IWebRTCProcessor.ts
  • packages/media-signaling/src/definition/call/IClientMediaCall.ts
  • packages/ui-voip/src/providers/useMediaSessionInstance.ts
  • packages/ui-voip/src/providers/useMediaSessionControls.ts
  • packages/media-signaling/src/lib/Call.ts
  • packages/ui-voip/src/providers/MockedMediaCallProvider.tsx
  • packages/ui-voip/src/context/MediaCallViewContext.ts
  • packages/media-signaling/src/lib/Session.ts
  • packages/ui-voip/src/providers/MediaCallViewProvider.tsx
  • packages/media-signaling/src/lib/services/webrtc/Processor.ts
  • packages/ui-voip/src/providers/useMediaSession.ts
📚 Learning: 2026-02-26T19:22:29.385Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryActions.tsx:40-40
Timestamp: 2026-02-26T19:22:29.385Z
Learning: For TSX files in the UI VOIP package, ensure that when a media session state is 'unavailable', the voiceCall action is excluded from the actions object passed to CallHistoryActions so it does not render in the menu. This filtering should occur upstream (before getItems is called) to avoid tooltips or UI hints for unavailable actions. If there are multiple actions with availability states, implement a centralized helper to filter actions based on session state.

Applied to files:

  • packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
  • packages/ui-voip/src/providers/MockedMediaCallProvider.tsx
  • packages/ui-voip/src/providers/MediaCallViewProvider.tsx
📚 Learning: 2026-05-05T12:34:29.042Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 40331
File: packages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsx:69-69
Timestamp: 2026-05-05T12:34:29.042Z
Learning: In Rocket.Chat’s `packages/ui-voip` UI (e.g., media/call widgets), voice/media calls are only supported in Direct Message (DM) rooms. Rocket.Chat models a DM as a “room” with exactly two participants, so handlers like `onClickDirectMessage` are the correct destination—even when the UI text/element says “Open in room” (e.g., on the shared screen card/`StreamCard`). During review, don’t flag a “DM vs room” mismatch for these cases; they intentionally map to the same destination.

Applied to files:

  • packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
  • packages/ui-voip/src/providers/MockedMediaCallProvider.tsx
  • packages/ui-voip/src/providers/MediaCallViewProvider.tsx
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
  • packages/ui-voip/src/providers/MockedMediaCallProvider.tsx
  • packages/ui-voip/src/providers/MediaCallViewProvider.tsx
🔇 Additional comments (23)
packages/i18n/src/locales/en.i18n.json (1)

4875-4875: LGTM!

Also applies to: 7116-7116

packages/media-signaling/src/definition/call/IClientMediaCall.ts (1)

22-22: LGTM!

Also applies to: 115-115

packages/media-signaling/src/definition/services/webrtc/IWebRTCProcessor.ts (1)

37-37: LGTM!

Also applies to: 54-61

packages/ui-voip/src/context/MediaCallViewContext.ts (1)

15-15: LGTM!

Also applies to: 31-32, 44-44

packages/ui-voip/src/context/definitions.d.ts (1)

31-32: LGTM!

packages/media-signaling/src/lib/Call.ts (3)

189-190: LGTM!

Also applies to: 232-232


475-492: LGTM!


1302-1302: LGTM!

packages/media-signaling/src/lib/services/webrtc/Processor.ts (8)

25-26: LGTM!

Also applies to: 54-54


84-95: LGTM!


107-107: LGTM!

Also applies to: 331-334


200-211: 💤 Low value

Verify intent: updateScreenShareDirectionBeforeNegotiation is called twice for offers.

When processing a remote offer, the screen share direction is updated once before peer.setRemoteDescription (line 200) and again immediately after (lines 205-207). Typically, setting direction before applying the remote description is sufficient. Confirm this double invocation is intentional (e.g., to handle transceivers created by the remote offer).


346-362: LGTM!


446-473: LGTM!


498-500: LGTM!

Also applies to: 554-556


720-723: LGTM!

packages/media-signaling/src/lib/Session.ts (1)

406-427: LGTM!

packages/ui-voip/src/providers/MediaCallViewProvider.tsx (1)

116-134: LGTM!

packages/ui-voip/src/providers/MockedMediaCallProvider.tsx (1)

79-79: LGTM!

Also applies to: 148-149, 162-162, 179-179

packages/ui-voip/src/providers/useMediaSessionControls.ts (1)

43-43: LGTM!

Also applies to: 67-78, 113-113

packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx (1)

78-84: LGTM!

Also applies to: 100-107

packages/ui-voip/src/providers/useMediaSession.ts (1)

141-142: Confirm mainCall.getLocalMediaStream/getRemoteMediaStream return a stream wrapper with hasVideo()

@rocket.chat/media-signaling’s IClientMediaCall exposes getLocalMediaStream(tag?)/getRemoteMediaStream(tag?) returning IMediaStreamWrapper | null, and IMediaStreamWrapper defines hasVideo(): boolean (implemented by MediaStreamWrapper). This makes Boolean(localMediaStream?.hasVideo()) / Boolean(remoteMediaStream?.hasVideo()) correct (including 167-168 and 201-202).

packages/ui-voip/src/providers/useMediaSessionInstance.ts (1)

88-90: ⚡ Quick win

No unhandled promise rejection here—MediaSignalTransport/writeStream are void
MediaSignalTransport is defined as (signal: T) => void, and ServerContext.writeStream (via useWriteStream) also returns void, so void this.sendSignal(signal) doesn’t convert a rejectable Promise into an unhandled rejection. If you still want diagnostics, guard against synchronous throws (e.g., try/catch) rather than adding a .catch(...) on a Promise.

			> Likely an incorrect or invalid review comment.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 16 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/ui-voip/src/providers/MediaCallViewProvider.tsx Outdated
@adityasingh6533

Copy link
Copy Markdown
Author

/label state: WAS assured

@adityasingh6533

Copy link
Copy Markdown
Author

Please add the 'state: WAS assured' label and assign the required milestone/project to this PR. I don't have permissions to modify them.

@coderabbitai coderabbitai Bot removed the type: feature Pull requests that introduces new feature label Jun 2, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/ui-voip/src/providers/MediaCallViewProvider.tsx">

<violation number="1" location="packages/ui-voip/src/providers/MediaCallViewProvider.tsx:246">
P2: Race condition in catch cleanup: `screenShareTrackRef.current` (shared mutable ref) is read in the catch block instead of the specific track from the failing attempt. If a concurrent `stopScreenShare` + new share starts while an older `setScreenShareTrack` is pending, the older catch will stop the newer active track and call `setScreenShareTrack(null)` on it.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

try {
await controls.setScreenShareTrack(null);
} catch (resetError) {
console.error('Media Call - Error clearing failed screen share track', resetError);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Race condition in catch cleanup: screenShareTrackRef.current (shared mutable ref) is read in the catch block instead of the specific track from the failing attempt. If a concurrent stopScreenShare + new share starts while an older setScreenShareTrack is pending, the older catch will stop the newer active track and call setScreenShareTrack(null) on it.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/ui-voip/src/providers/MediaCallViewProvider.tsx, line 246:

<comment>Race condition in catch cleanup: `screenShareTrackRef.current` (shared mutable ref) is read in the catch block instead of the specific track from the failing attempt. If a concurrent `stopScreenShare` + new share starts while an older `setScreenShareTrack` is pending, the older catch will stop the newer active track and call `setScreenShareTrack(null)` on it.</comment>

<file context>
@@ -232,6 +236,16 @@ const MediaCallViewProvider = ({ children }: MediaCallViewProviderProps) => {
+				try {
+					await controls.setScreenShareTrack(null);
+				} catch (resetError) {
+					console.error('Media Call - Error clearing failed screen share track', resetError);
+				}
+			}
</file context>

@adityasingh6533
adityasingh6533 force-pushed the media-screen-share-without-devices branch from e702a9d to 0a28e48 Compare June 2, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion: Allow screen sharing, even when camera/mic not available

1 participant