Verify RTS Push to JS (fixes to application)

This commit is contained in:
2026-04-17 16:47:30 -04:00
parent 88c5d597d3
commit b70189c619
3 changed files with 31 additions and 8 deletions

View File

@@ -1,4 +1,6 @@
let peerConnection = null;
let peerConnections = {};
let remoteStreams = {};
let localStream = null;
let currentUsername = null;
let currentChannelId = null;
@@ -241,7 +243,7 @@ async function joinChannelCall() {
// }
} //Combine with channelCallJoin
async function ensurePeerConnection2()
async function ensurePeerConnectionForUser(username)
{
if (peerConnection) return;
peerConnection = new RTCPeerConnection(configuration);
@@ -263,7 +265,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);
//await IceCandidateAdded(event.candidate);
};
peerConnection.ontrack = (event) => {
@@ -297,7 +299,7 @@ async function ensurePeerConnection2()
async function channelCallJoin(activeCall)
{
// LogMessage("Active call: " + activeCall);
await ensurePeerConnection2();
await ensurePeerConnectionForUser();
await ensureLocalMedia();
await applyLocalStreamToPeerConnection();
@@ -529,7 +531,7 @@ async function waitForIceGatheringComplete(pc) {
});
} //Remove?
// window.handleRtcSignal = handleRtcSignal;
window.handleRtcSignal = handleRtcSignal;
window.addEventListener("HybridWebViewMessageReceived", function (e) {
LogMessage("Raw message: " + e.detail.message);