I’m trying to implement specific window screen sharing in my Electron app using the Zoom Web SDK (client view). I’m attempting to pass the sourceId
directly into ZoomMtg.startScreenShare
, but it’s not working as expected.
Here’s the code I’m using:
async function handleZoomScreenShare(data) {
try {
const sources = await electron.ipcRenderer.invoke('get-screen-sharing-sources');
console.log('Available sources:', sources);
const screenSource = sources.find(source => source.id === data?.id);
console.log('Selected screen source:', screenSource);
if (!screenSource) {
console.error('Screen source not found');
return;
}
console.log('Is Zoom startScreenShare available:', typeof ZoomMtg.startScreenShare);
// Attempt to start screen share with a specific sourceId
ZoomMtg.startScreenShare({
sourceId: screenSource.id,
hideShareAudioOption: false,
optimizedForSharedVideo: true,
success: () => {
console.log('✅ Screen share started successfully');
},
error: (err) => {
console.error('❌ Screen share error:', err);
}
});
} catch (error) {
console.error('Error in handleZoomScreenShare:', error);
}
}
Despite passing a valid sourceId
, the screen share does not start. Is there something missing or a limitation with ZoomMtg.startScreenShare
in the Web SDK when used inside Electron? Any guidance or alternative approach would be appreciated.
Versions that i am using:
Electron Version: v38.1.0
Zoom meeting SDK: v4.0.7