fix: Windows audio mute fix
This commit is contained in:
@@ -210,6 +210,39 @@ export async function createWindow(): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
session.defaultSession.setDisplayMediaRequestHandler(
|
||||
async (request, respond) => {
|
||||
// On Windows the system picker (useSystemPicker: true) is preferred.
|
||||
// This handler is only reached when the system picker is unavailable.
|
||||
// Include loopback audio when the renderer requested it so that
|
||||
// getDisplayMedia receives an audio track and the renderer-side
|
||||
// restrictOwnAudio constraint can keep the app's own voice playback
|
||||
// out of the captured stream.
|
||||
try {
|
||||
const sources = await desktopCapturer.getSources({
|
||||
types: ['window', 'screen'],
|
||||
thumbnailSize: { width: 150, height: 150 }
|
||||
});
|
||||
const firstSource = sources[0];
|
||||
|
||||
if (firstSource) {
|
||||
respond({
|
||||
video: firstSource,
|
||||
...(request.audioRequested ? { audio: 'loopback' } : {})
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// desktopCapturer also unavailable
|
||||
}
|
||||
|
||||
respond({});
|
||||
},
|
||||
{ useSystemPicker: true }
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env['NODE_ENV'] === 'development') {
|
||||
const devUrl = process.env['SSL'] === 'true'
|
||||
? 'https://localhost:4200'
|
||||
|
||||
Reference in New Issue
Block a user