fix: serialize WebRTC objects before IPC transfer

RTCSessionDescription and RTCIceCandidate objects lose their properties
when sent through Electron's contextBridge IPC. Convert to plain objects
with explicit property extraction before sending.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Administrator 2026-03-12 08:40:57 +01:00
parent d8a2ec6443
commit 6b47181572
2 changed files with 10 additions and 4 deletions

View File

@ -58,13 +58,18 @@ async function handleOffer(clientId, offer, role) {
}; };
}; };
// ICE candidates // ICE candidates — serialize to plain object (WebRTC objects don't survive IPC)
pc.onicecandidate = (event) => { pc.onicecandidate = (event) => {
if (event.candidate) { if (event.candidate) {
window.capture.sendSignaling({ window.capture.sendSignaling({
type: 'ice-candidate', type: 'ice-candidate',
clientId, clientId,
candidate: event.candidate candidate: {
candidate: event.candidate.candidate,
sdpMid: event.candidate.sdpMid,
sdpMLineIndex: event.candidate.sdpMLineIndex,
usernameFragment: event.candidate.usernameFragment
}
}); });
} }
}; };
@ -79,10 +84,11 @@ async function handleOffer(clientId, offer, role) {
const answer = await pc.createAnswer(); const answer = await pc.createAnswer();
await pc.setLocalDescription(answer); await pc.setLocalDescription(answer);
// Serialize to plain object (RTCSessionDescription doesn't survive IPC)
window.capture.sendSignaling({ window.capture.sendSignaling({
type: 'answer', type: 'answer',
clientId, clientId,
answer: pc.localDescription answer: { type: pc.localDescription.type, sdp: pc.localDescription.sdp }
}); });
window.capture.notifyClientCount(clients.size); window.capture.notifyClientCount(clients.size);

View File

@ -1,6 +1,6 @@
{ {
"name": "multi-hoster-uploader", "name": "multi-hoster-uploader",
"version": "2.1.3", "version": "2.1.4",
"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": {