Adds the hidden BrowserWindow assets for remote desktop streaming: - lib/remote-capture-preload.js: IPC bridge for desktopCapturer source ID, WebRTC signaling relay, input event forwarding, and client count tracking - lib/remote-capture.html: WebRTC logic handling multiple concurrent clients via RTCPeerConnection, stream capture via getUserMedia with desktop source ID, and DataChannel input forwarding Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
895 B
JavaScript
21 lines
895 B
JavaScript
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
contextBridge.exposeInMainWorld('capture', {
|
|
// Get capture source ID from main process (desktopCapturer runs in main)
|
|
getSourceId: () => ipcRenderer.invoke('remote:get-capture-source-id'),
|
|
|
|
// Signaling: receive offer/ICE from main process (relayed from dashboard)
|
|
onSignaling: (callback) => {
|
|
ipcRenderer.on('remote:signaling-to-capture', (_event, data) => callback(data));
|
|
},
|
|
|
|
// Signaling: send answer/ICE back to main process (relayed to dashboard)
|
|
sendSignaling: (data) => ipcRenderer.send('remote:signaling-from-capture', data),
|
|
|
|
// Input: forward input events from DataChannel to main process
|
|
sendInput: (data) => ipcRenderer.send('remote:input-event', data),
|
|
|
|
// Notify main process of client connection/disconnection
|
|
notifyClientCount: (count) => ipcRenderer.send('remote:client-count', count)
|
|
});
|