fix: use getMediaSourceId() for exact window capture
Instead of enumerating all sources and matching by title (which falls back to full screen capture), use BrowserWindow.getMediaSourceId() to get the exact media source ID for the app window. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c9d038d588
commit
b4211a7d50
9
main.js
9
main.js
@ -1090,11 +1090,16 @@ ipcMain.handle('remote:get-capture-source-id', async () => {
|
|||||||
debugLog('remote: capture source - mainWindow not available');
|
debugLog('remote: capture source - mainWindow not available');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// Use getMediaSourceId() for exact window capture without enumeration
|
||||||
|
const sourceId = mainWindow.getMediaSourceId();
|
||||||
|
debugLog('remote: capture source - getMediaSourceId:', sourceId);
|
||||||
|
if (sourceId) return sourceId;
|
||||||
|
|
||||||
|
// Fallback: enumerate sources
|
||||||
const { desktopCapturer } = require('electron');
|
const { desktopCapturer } = require('electron');
|
||||||
const sources = await desktopCapturer.getSources({ types: ['window', 'screen'] });
|
const sources = await desktopCapturer.getSources({ types: ['window', 'screen'] });
|
||||||
const title = mainWindow.getTitle();
|
const title = mainWindow.getTitle();
|
||||||
debugLog('remote: capture source - looking for title:', title, 'available:', sources.map(s => s.name).join(', '));
|
debugLog('remote: capture source - fallback, looking for title:', title);
|
||||||
// Try exact title match first, then partial match, then fall back to first screen
|
|
||||||
let source = sources.find(s => s.name === title);
|
let source = sources.find(s => s.name === title);
|
||||||
if (!source) source = sources.find(s => s.name.includes('Multi-Hoster'));
|
if (!source) source = sources.find(s => s.name.includes('Multi-Hoster'));
|
||||||
if (!source) source = sources.find(s => s.id.startsWith('screen:'));
|
if (!source) source = sources.find(s => s.id.startsWith('screen:'));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "2.1.6",
|
"version": "2.1.7",
|
||||||
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user