From cee1e96076d1dc66b05e08fdbe0421e3bbdd045f Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Sun, 9 Nov 2025 17:09:58 +0100 Subject: [PATCH] [call-me] - #13 - fix video on outgoing call from device without camera --- package-lock.json | 4 ++-- package.json | 2 +- public/client.js | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index efbb1c8..60c6602 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "call-me", - "version": "1.2.72", + "version": "1.2.73", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "call-me", - "version": "1.2.72", + "version": "1.2.73", "license": "AGPLv3", "dependencies": { "@ngrok/ngrok": "1.5.2", diff --git a/package.json b/package.json index 1df8c89..f6427b7 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "call-me", - "version": "1.2.72", + "version": "1.2.73", "description": "Your Go-To for Instant Video Calls", "author": "Miroslav Pejic - miroslav.pejic.85@gmail.com", "license": "AGPLv3", diff --git a/public/client.js b/public/client.js index 4ffd776..7e3e2d0 100755 --- a/public/client.js +++ b/public/client.js @@ -1173,8 +1173,26 @@ function handleMediaStreamError(error) { function initializeConnection() { thisConnection = new RTCPeerConnection(config); + // Add existing tracks from local stream stream.getTracks().forEach((track) => thisConnection.addTrack(track, stream)); + // Ensure we have transceivers for both audio and video, even if we don't have those tracks + // This allows us to receive video/audio from remote peer even if we don't have camera/mic + const hasVideo = stream.getVideoTracks().length > 0; + const hasAudio = stream.getAudioTracks().length > 0; + + if (!hasVideo) { + // Add video transceiver to receive video from remote peer + thisConnection.addTransceiver('video', { direction: 'recvonly' }); + console.log('Added recvonly video transceiver (no local camera)'); + } + + if (!hasAudio) { + // Add audio transceiver to receive audio from remote peer + thisConnection.addTransceiver('audio', { direction: 'recvonly' }); + console.log('Added recvonly audio transceiver (no local microphone)'); + } + thisConnection.ontrack = (e) => { if (e.streams && e.streams[0]) { const remoteStream = e.streams[0];