ice candidates gathering working, needs to get public ips

This commit is contained in:
2026-04-07 17:30:34 -04:00
parent 31646a315a
commit dff05dd596
2 changed files with 72 additions and 47 deletions

View File

@@ -417,7 +417,7 @@ public partial class MainPage : ContentPage
bool active = await ServerAPI.GetIsChannelActiveAsync(_currentChannelId);
SafeSendRawToWebView($"Rtc Channel {_currentChannelName} | {_currentChannelId} is active: {active}");
// SafeSendRawToWebView($"Rtc Channel {_currentChannelName} | {_currentChannelId} is active: {active}");
return active;
}
@@ -457,7 +457,7 @@ public partial class MainPage : ContentPage
public async void WriteRtcAnswer(string json)
{
SafeSendRawToWebView("WriteRtcAnswer entered with: " + json);
// SafeSendRawToWebView("WriteRtcAnswer entered with: " + json);
try
{
@@ -477,6 +477,23 @@ public partial class MainPage : ContentPage
}
}
public async void WriteIceCandidate(string json)
{
IceCandidate? candidate = JsonSerializer.Deserialize<IceCandidate>(json);
await ServerAPI.PostIceCandidateAsync(candidate);
}
public async void IceCandidateCallback(string json)
{
try
{
await hybridWebView.InvokeJavaScriptAsync("IceCandidateAdded");
}
catch (Exception ex)
{
SafeSendRawToWebView("WriteIceCandidate failed: " + ex.Message);
}
}
public async Task AnswerCallback(RtcDescription answer)
{
answer.sdp = answer.sdp.Replace("\r\n", "(rn)");
@@ -486,7 +503,7 @@ public partial class MainPage : ContentPage
}
catch (Exception ex)
{
SafeSendRawToWebView("WriteRtcAnswer failed: " + ex.Message);
SafeSendRawToWebView("AnswerCallback failed: " + ex.Message);
}
}