Skip to content

fix: allow screen sharing without media devices#40744

Open
adityasingh6533 wants to merge 1 commit into
RocketChat:developfrom
adityasingh6533:media-screen-share-without-devices
Open

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

Conversation

@adityasingh6533
Copy link
Copy Markdown

@adityasingh6533 adityasingh6533 commented May 31, 2026

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 functionality, enabling users to share their screen during calls
  • Remote participant screens now display in the call view when shared
  • New screen share toggle control with "Stop sharing" label in the call interface

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 31, 2026

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

  • This PR has conflicts, please resolve them before merging
  • This PR is missing the 'stat: QA assured' label
  • This PR is not mergeable
  • 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
Copy link
Copy Markdown

changeset-bot Bot commented May 31, 2026

⚠️ No Changeset found

Latest commit: c536476

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
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

Walkthrough

This PR adds complete screen-sharing functionality to VoIP calls. It introduces screen-share track management in the media signaling layer, relaxes input-track requirements for call negotiation, updates the UI context and provider to handle screen-share lifecycle, and integrates a toggle button in the OngoingCall component to control and display remote screen sharing.

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 string added for "Stop sharing"; CallFeature type expanded to include 'screen-share'; IClientMediaCall and IWebRTCProcessor gain setScreenShareTrack() methods; WebRTCProcessorConfig gains optional screenShareTrack field; UI context extended with onToggleScreenShare callback and screenSharing/remoteScreenSharing state.
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 update track, forward to processor, trigger negotiation, and emit streamChange; MediaCallWebRTCProcessor stores screen-share track, validates kind, loads into transceiver, manages direction without negotiation; direction handling refactored to compute desired audio/video directions based on held and track presence; data-channel command parsing hardened.
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() now early-exits on media failures instead of hanging up calls; 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 manages screen-share track via screenShareTrackRef, implements getDisplayMedia() toggle, wires setScreenShareTrack to call control, and exposes onToggleScreenShare through context; session and controls hooks compute screen-sharing state from media streams' hasVideo() and implement setScreenShareTrack control; mocked provider updated with stubs and types.
OngoingCall component
packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
Renders remote screen-share video element with effect-driven stream attachment; footer toggle button bound to screenSharing state and onToggleScreenShare callback with localized labels; disabled during connecting/reconnecting.

Sequence Diagram(s)

sequenceDiagram
  participant Call as ClientMediaCall
  participant Processor as MediaCallWebRTCProcessor
  participant Transceiver as Video Transceiver
  Call->>Call: setScreenShareTrack(track)
  Call->>Processor: setScreenShareTrack(track)
  Processor->>Processor: validate track.kind
  Processor->>Processor: loadScreenShareTrack()
  Processor->>Transceiver: setTrack(video)
  Processor->>Processor: updateScreenShareDirectionBeforeNegotiation()
  Call->>Call: emit streamChange
Loading
sequenceDiagram
  participant UI as OngoingCall Component
  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->>Call: emit streamChange
  Provider->>UI: context update
  UI->>UI: render remote video
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

type: feature

Suggested reviewers

  • aleksandernsilva
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: allow screen sharing without media devices' accurately and concisely describes the main change—enabling screen sharing functionality even when audio/camera devices are unavailable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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.

Copy link
Copy Markdown
Contributor

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

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

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:229">
P2: Screen capture track is not cleaned up when `setScreenShareTrack` fails, leaving a dangling screen capture and stale local state.</violation>
</file>

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

Re-trigger cubic

return;
}

screenShareTrackRef.current = track;
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: Screen capture track is not cleaned up when setScreenShareTrack fails, leaving a dangling screen capture and stale local state.

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 229:

<comment>Screen capture track is not cleaned up when `setScreenShareTrack` fails, leaving a dangling screen capture and stale local state.</comment>

<file context>
@@ -196,9 +197,51 @@ const MediaCallViewProvider = ({ children }: MediaCallViewProviderProps) => {
+				return;
+			}
+
+			screenShareTrackRef.current = track;
+			track.addEventListener('ended', () => {
+				void stopScreenShare();
</file context>

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community stat: conflict type: feature Pull requests that introduces new feature

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