[call-me] - #13 - fix video on outgoing call from device without camera

This commit is contained in:
Miroslav Pejic
2025-11-09 17:09:58 +01:00
parent ae6257b39c
commit cee1e96076
3 changed files with 21 additions and 3 deletions
+2 -2
View File
@@ -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",
+1 -1
View File
@@ -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",
+18
View File
@@ -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];