Skip to content
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

Fix uncaught error when canceling screen sharing after joining a meeting #15466

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rahulrana701
Copy link

With this change the uncaught error of screen share will be resolved.
Issue Resolve via this pr: #15456

@jitsi-jenkins
Copy link

Hi, thanks for your contribution!
If you haven't already done so, could you please make sure you sign our CLA (https://jitsi.org/icla for individuals and https://jitsi.org/ccla for corporations)? We would unfortunately be unable to merge your patch unless we have that piece :(.

@@ -157,9 +157,14 @@ async function _toggleScreenSharing(
try {
tracks = await createLocalTracksF(options) as any[];
} catch (error) {
dispatch(handleScreenSharingError(error, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));
if (error.name) {
Copy link
Member

Choose a reason for hiding this comment

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

Why this check?

Copy link
Author

@rahulrana701 rahulrana701 Jan 9, 2025

Choose a reason for hiding this comment

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

Why this check?

this check was soly introduced to check the error related to user-cancelled errors.
Perhaps this could be improved with error.name ="gum.screensharing_user_canceled". I hope this would make more sense.

Copy link
Author

Choose a reason for hiding this comment

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

As soon as we are getting the error we are returning. I think it does the job well , what do u think about that

Copy link
Member

Choose a reason for hiding this comment

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

I think we need to check the logic on the calling side. As in, the caller of this function.

Copy link
Author

Choose a reason for hiding this comment

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

I think we need to check the logic on the calling side. As in, the caller of this function.
After going through the codebase , I find that ShareScreenWarningDialog component is responsible for handling the logic when the user chooses to stop sharing a screen or audio. The toggleScreensharing action is dispatched when the user submits the dialog. However , The dialog differentiates between audio-only and normal screen sharing modes using the _isAudioScreenShareWarning prop . If _isAudioScreenShareWarning is true, it handles the stop of audio screen sharing. Otherwise, it handles normal screen sharing.
If toggleScreensharing encounters an error due to user cancellation, it might not properly handle it, leading to unhandled promise rejections.

Copy link
Member

Choose a reason for hiding this comment

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

Good find! Then I reckon we need to fix it there.

Copy link
Author

Choose a reason for hiding this comment

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

@saghul I think the best practice is to handle this error in the toggleScreenSharing function itself rather than in the component because , The toggleScreenSharing function is responsible for managing the entire logic related to starting, stopping, and handling the state of screen sharing, including audio-only sharing and by handling the error inside this function, we centralize the error management for screen sharing. This means that any error or cancellation related to screen sharing is processed in a single location rather than in various places across the component hierarchy

react/features/base/tracks/actions.web.ts Show resolved Hide resolved
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.

3 participants