Fix attempts for RTC calls
This commit is contained in:
@@ -49,4 +49,12 @@ window.addEventListener("load", async () => {
|
||||
Media.wireDeviceSelectors();
|
||||
await Media.loadDevices();
|
||||
await Media.ensureLocalMedia();
|
||||
});
|
||||
});
|
||||
|
||||
function testIndex(rawJson)
|
||||
{
|
||||
const data = typeof rawJson === "string" ? JSON.parse(rawJson) : rawJson;
|
||||
if (data.type === "rtc_offer")
|
||||
HandleOffer(rawJson)
|
||||
LogMessage("Called by SendRtcSignalToJsAsync from C#!")
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user