Windows: fix screenshare containing other participants' voices (#1294)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import { desktopCapturer, session, Streams } from "electron";
|
||||
import { release } from "os";
|
||||
import type { StreamPick } from "renderer/components/ScreenSharePicker";
|
||||
import { IpcCommands, IpcEvents } from "shared/IpcEvents";
|
||||
|
||||
@@ -14,6 +15,8 @@ import { handle } from "./utils/ipcWrappers";
|
||||
const isWayland =
|
||||
process.platform === "linux" && (process.env.XDG_SESSION_TYPE === "wayland" || !!process.env.WAYLAND_DISPLAY);
|
||||
|
||||
const supportsLoopbackWithoutChrome = process.platform === "win32" && Number(release().split(".").pop()) >= 20348;
|
||||
|
||||
export function registerScreenShareHandler() {
|
||||
handle(IpcEvents.CAPTURER_GET_LARGE_THUMBNAIL, async (_, id: string) => {
|
||||
const sources = await desktopCapturer.getSources({
|
||||
@@ -78,7 +81,10 @@ export function registerScreenShareHandler() {
|
||||
const streams: Streams = {
|
||||
video: source
|
||||
};
|
||||
if (choice.audio && process.platform === "win32") streams.audio = "loopback";
|
||||
if (choice.audio && process.platform === "win32") {
|
||||
// @ts-expect-error loopbackWithoutChrome is real but not documented
|
||||
streams.audio = supportsLoopbackWithoutChrome ? "loopbackWithoutChrome" : "loopback";
|
||||
}
|
||||
|
||||
callback(streams);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user