Windows: fix screenshare containing other participants' voices (#1294)

This commit is contained in:
vocal
2026-08-19 01:30:48 +02:00
committed by GitHub
parent 9c6019f291
commit cb9c55fe1a
+7 -1
View File
@@ -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);
});