fix: robust capture source detection + diagnostic logging
- desktopCapturer now searches window+screen types with fallbacks - Partial title match and screen fallback if exact match fails - Error messages sent back from capture window via IPC - Detailed logging for capture source selection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
efcaa760df
commit
d8a2ec6443
@ -111,6 +111,7 @@ window.capture.onSignaling((data) => {
|
||||
case 'offer':
|
||||
handleOffer(data.clientId, data.offer, data.role).catch(err => {
|
||||
console.error('Failed to handle offer:', err);
|
||||
window.capture.sendSignaling({ type: 'error', clientId: data.clientId, error: err.message });
|
||||
});
|
||||
break;
|
||||
case 'ice-candidate':
|
||||
|
||||
14
main.js
14
main.js
@ -1081,11 +1081,19 @@ function buildModifiers(data) {
|
||||
|
||||
// IPC: Get capture source ID (desktopCapturer must run in main process in Electron 33+)
|
||||
ipcMain.handle('remote:get-capture-source-id', async () => {
|
||||
if (!mainWindow || mainWindow.isDestroyed()) return null;
|
||||
if (!mainWindow || mainWindow.isDestroyed()) {
|
||||
debugLog('remote: capture source - mainWindow not available');
|
||||
return null;
|
||||
}
|
||||
const { desktopCapturer } = require('electron');
|
||||
const sources = await desktopCapturer.getSources({ types: ['window'] });
|
||||
const sources = await desktopCapturer.getSources({ types: ['window', 'screen'] });
|
||||
const title = mainWindow.getTitle();
|
||||
const source = sources.find(s => s.name === title);
|
||||
debugLog('remote: capture source - looking for title:', title, 'available:', sources.map(s => s.name).join(', '));
|
||||
// Try exact title match first, then partial match, then fall back to first screen
|
||||
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.id.startsWith('screen:'));
|
||||
debugLog('remote: capture source -', source ? `found: ${source.name} (${source.id})` : 'NONE FOUND');
|
||||
return source ? source.id : null;
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "multi-hoster-uploader",
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.3",
|
||||
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user