Add throwOnFail to groupCall.setScreensharingEnabled (#2787)

* Add throwOnFail to groupCall.setScreensharingEnabled

For https://github.com/vector-im/element-call/pull/652

* Update mediaHandler.ts
This commit is contained in:
David Baker
2022-10-24 10:20:04 +01:00
committed by GitHub
parent 5a0787349d
commit eddd0cafe8
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -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),
+5
View File
@@ -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 and emitting.
throwOnFail?: boolean;
}
export class MediaHandler extends TypedEventEmitter<