diff --git a/lib/remote-capture.html b/lib/remote-capture.html index 0b47b01..f048559 100644 --- a/lib/remote-capture.html +++ b/lib/remote-capture.html @@ -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': diff --git a/main.js b/main.js index 454cd3a..856f605 100644 --- a/main.js +++ b/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; }); diff --git a/package.json b/package.json index cd58bfd..7f5c7eb 100644 --- a/package.json +++ b/package.json @@ -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": {