Skip to content

Commit

Permalink
fix(ScreenObtainer) improve result handling
Browse files Browse the repository at this point in the history
- Lower logger level to warning
- Use nested conditions
  • Loading branch information
saghul committed Feb 6, 2025
1 parent 28c1120 commit 31897f9
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions modules/RTC/ScreenObtainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,24 +298,20 @@ const ScreenObtainer = {
errorStack: error?.stack
};

logger.error('getDisplayMedia error', JSON.stringify(constraints), JSON.stringify(errorDetails));
logger.warn('getDisplayMedia error', JSON.stringify(constraints), JSON.stringify(errorDetails));

if (errorDetails.errorMsg?.indexOf('denied by system') !== -1) {
// On Chrome this is the only thing different between error returned when user cancels
// and when no permission was given on the OS level.
errorCallback(new JitsiTrackError(JitsiTrackErrors.PERMISSION_DENIED));

return;
} else if (errorDetails.errorMsg === 'NotReadableError') {
// This can happen under some weird conditions:
// - https://issues.chromium.org/issues/369103607
// - https://issues.chromium.org/issues/353555347
errorCallback(new JitsiTrackError(JitsiTrackErrors.SCREENSHARING_GENERIC_ERROR));

return;
} else {
errorCallback(new JitsiTrackError(JitsiTrackErrors.SCREENSHARING_USER_CANCELED));
}

errorCallback(new JitsiTrackError(JitsiTrackErrors.SCREENSHARING_USER_CANCELED));
});
},

Expand Down

0 comments on commit 31897f9

Please sign in to comment.