Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix recording inception error

Siddharthc8d4e867b234
diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts
index 95ed797e7..e067f5964 100644
--- a/electron/ipc/handlers.ts
+++ b/electron/ipc/handlers.ts
@@ -526,14 +526,27 @@ export function registerIpcHandlers(
});
ipcMain.handle("get-sources", async (_, opts) => {
+ const ownWindowSourceIds = new Set(
+ BrowserWindow.getAllWindows()
+ .map((win) => {
+ try {
+ return win.getMediaSourceId();
+ } catch {
+ return null;
+ }
+ })
+ .filter((id): id is string => Boolean(id)),
+ );
const sources = await desktopCapturer.getSources(opts);
- return sources.map((source) => ({
- id: source.id,
- name: source.name,
- display_id: source.display_id,
- thumbnail: source.thumbnail ? source.thumbnail.toDataURL() : null,
- appIcon: source.appIcon ? source.appIcon.toDataURL() : null,
- }));
+ return sources
+ .filter((source) => !ownWindowSourceIds.has(source.id))
+ .map((source) => ({
+ id: source.id,
+ name: source.name,
+ display_id: source.display_id,
+ thumbnail: source.thumbnail ? source.thumbnail.toDataURL() : null,
+ appIcon: source.appIcon ? source.appIcon.toDataURL() : null,
+ }));
});
ipcMain.handle("select-source", (_, source: SelectedSource) => {