Fix attempts for RTC calls

This commit is contained in:
2026-04-29 13:52:35 -04:00
parent 777328caed
commit 38662f6655
3 changed files with 41 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
const peerConnections = {};
const peerConnections = {};
async function joinChannelCall() {
LogMessage("Current username: " + currentUsername);
@@ -24,7 +24,7 @@ async function joinChannelCall() {
}
for (const username of existingUsers) {
await sendOffer(username);
await sendOffer(username); //Creates an offer to each person in call for MESH RTC
}
}
@@ -34,6 +34,7 @@ async function sendOffer(username) {
await Media.applyLocalStreamToPeerConnection(pc, username);
const offer = await pc.createOffer();
// LogMessage(`Offer created: ${JSON.stringify(offer)}`);
await pc.setLocalDescription(offer);
await RelaySocket.sendRtcSignal({
@@ -88,11 +89,12 @@ async function handleRtcSignal(rawJson) {
}
async function handleOffer(msg) {
LogMessage(`Offer handler: ${msg}`);
const pc = await ensurePeerConnectionForUser(msg.from);
await Media.ensureLocalMedia();
await Media.applyLocalStreamToPeerConnection(pc, msg.from);
// const offer = JSON.parse(msg.offer);
await pc.setRemoteDescription({
type: "offer",
sdp: msg.sdp