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

Add throwOnFail to groupCall.setScreensharingEnabled #2787

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/webrtc/groupCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ export class GroupCall extends TypedEventEmitter<

return true;
} catch (error) {
if (opts.throwOnFail) throw error;
logger.error("Enabling screensharing error", error);
this.emit(GroupCallEvent.Error,
new GroupCallError(GroupCallErrorCode.NoUserMedia, "Failed to get screen-sharing stream: ", error),
Expand Down
5 changes: 5 additions & 0 deletions src/webrtc/mediaHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export type MediaHandlerEventHandlerMap = {
export interface IScreensharingOpts {
desktopCapturerSourceId?: string;
audio?: boolean;
// For electron screen capture, there are very few options for detecting electron
// apart from inspecting the user agent or just trying getDisplayMedia() and
// catching the failure, so we do the latter - this flag tells the function to just
// throw an error so we can catch it in this case, rather than logging an emitting.
throwOnFail?: boolean;
}

export class MediaHandler extends TypedEventEmitter<
Expand Down