feat: add desktopCapturer.getMediaSourceIdForWebContents() to get stream source id from web contents (#22701)
* feat: add desktopCapturer.getMediaSourceIdForWebContents() to get stream source id from web contents * Cleanup from #22701 PR comments
This commit is contained in:
parent
dc72f74020
commit
204f001c5d
9 changed files with 178 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
const { createDesktopCapturer } = process.electronBinding('desktop_capturer');
|
||||
const { createDesktopCapturer, getMediaSourceIdForWebContents: getMediaSourceIdForWebContentsBinding } = process.electronBinding('desktop_capturer');
|
||||
|
||||
const deepEqual = (a: ElectronInternal.GetSourcesOptions, b: ElectronInternal.GetSourcesOptions) => JSON.stringify(a) === JSON.stringify(b);
|
||||
|
||||
|
@ -77,3 +77,7 @@ export const getSourcesImpl = (event: Electron.IpcMainEvent | null, args: Electr
|
|||
|
||||
return getSources;
|
||||
};
|
||||
|
||||
export const getMediaSourceIdForWebContents = (event: Electron.IpcMainEvent, webContentsId: number) => {
|
||||
return getMediaSourceIdForWebContentsBinding(event.sender.id, webContentsId);
|
||||
};
|
||||
|
|
|
@ -73,6 +73,10 @@ if (BUILDFLAG(ENABLE_DESKTOP_CAPTURER)) {
|
|||
|
||||
return typeUtils.serialize(await desktopCapturer.getSourcesImpl(event, options));
|
||||
});
|
||||
|
||||
ipcMainInternal.handle('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_MEDIA_SOURCE_ID_FOR_WEB_CONTENTS', function (event, webContentsId, stack) {
|
||||
return desktopCapturer.getMediaSourceIdForWebContents(event, webContentsId);
|
||||
});
|
||||
}
|
||||
|
||||
const isRemoteModuleEnabled = BUILDFLAG(ENABLE_REMOTE_MODULE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue