I'm working on a video call app using React and stanza.io. When calling one-to-one everything works fine, but when I add a third peer, the second and the third peer stop sending video frames only to the first peer (chrome webrtc internals screenshot), and the video tracks are muted even though the state of all peer connections is "connected". note that the streams are working fine between the second and third peer and both are receiving the first peer stream.
Making calls function:
public async addPeerToCall(jid: string, localStream: MediaStream | null) {
const stream = localStream
if (!stream) return;
const session = this.user.jingle.createMediaSession(jid);
stream.getTracks().forEach(async (track) => {
await session
.addTrack(track, stream);
});
await session.start();
}
Incoming calls event listener:
private incomingCall() {
this.user.jingle.on(
'incoming',
async (session: XMPP.Jingle.MediaSession) => {
try {
for (const track of stream.getTracks()) {
await session.addTrack(track, stream);
}
await session.accept();
} catch (error) {
console.log('incomingCall error', error);
}
}
);
}
Receiving tracks event listener:
this.user.jingle.on(
'peerTrackAdded',
(
session: XMPP.Jingle.MediaSession,
track: MediaStreamTrack,
stream: MediaStream
) => {
if (track.kind === 'video') {
Streams.addRemoteStream({
stream,
peerJID: session.peerID
});
}
}
);