CALL WORKS, NEEDS TO HAVE LEAVE CALL SETUP AND HOTSWAP FIXED

This commit is contained in:
2026-04-08 22:29:29 -04:00
parent c03e5102fb
commit dad5de3d7f
6 changed files with 60 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ let currentUsername = null;
let currentChannelId = null;
let availableCameras = [];
let availableMics = [];
let candidateQueue = [];
const configuration = {
iceServers:[
{
@@ -262,6 +263,7 @@ async function ensurePeerConnection2()
console.log(`Ice Candidate: ${JSON.stringify(event.candidate)}`);
LogMessage(`Ice Candidate: ${JSON.stringify(event.candidate)}`);
await window.HybridWebView.InvokeDotNet("WriteIceCandidate", [JSON.stringify(event.candidate)]);
await IceCandidateAdded(event.candidate);
};
peerConnection.ontrack = (event) => {
@@ -334,11 +336,22 @@ async function AnswerCallbackJS(answer)
LogMessage("Current answer: " + JSON.stringify(answer));
const desc = new RTCSessionDescription(answer);
await peerConnection.setRemoteDescription(desc);
for (const candidate of candidateQueue) {
await peerConnection.addIceCandidate(candidate);
}
}
}
async function IceCandidateAdded(candidate)
{
await peerConnection.addIceCandidate(candidate);
if (peerConnection.currentRemoteDescription) {
await peerConnection.addIceCandidate(candidate);
LogMessage("ICE CANDIDATE ADDED: " + JSON.stringify(candidate));
}
else {
LogMessage("RemoteDescription Missing")
candidateQueue.push(candidate);
}
}
async function handleRtcSignal(rawJson) {
try {