Skip to content

Commit

Permalink
Merge pull request #1654 from SimonBrandner/terminate-screen-share
Browse files Browse the repository at this point in the history
Properly terminate screen-share calls if NoUserMedia
  • Loading branch information
turt2live authored Apr 5, 2021
2 parents 3820c15 + 02b283b commit 59e0bd4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/webrtc/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ export class MatrixCall extends EventEmitter {

try {
const screenshareConstraints = await getScreenshareContraints(selectDesktopCapturerSource);
if (!screenshareConstraints) return;
if (!screenshareConstraints) {
this.terminate(CallParty.Local, CallErrorCode.NoUserMedia, false);
return;
}

if (window.electron?.getDesktopCapturerSources) {
// We are using Electron
logger.debug("Getting screen stream using getUserMedia()...");
Expand All @@ -402,6 +406,7 @@ export class MatrixCall extends EventEmitter {
"Failed to get screen-sharing stream: ", err,
),
);
this.terminate(CallParty.Local, CallErrorCode.NoUserMedia, false);
}
this.type = CallType.Video;
}
Expand Down

0 comments on commit 59e0bd4

Please sign in to comment.