Verify RTS Push to JS (fixes to application)
This commit is contained in:
@@ -198,13 +198,13 @@ public partial class MainPage : ContentPage
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == SignalType.OfferUpdated || type == SignalType.AnswerUpdated || type == SignalType.CandidateAdded || type == SignalType.CallLeft)
|
||||
if (type is SignalType.OfferUpdated or SignalType.AnswerUpdated or SignalType.CandidateAdded or SignalType.CallLeft)
|
||||
{
|
||||
var rtcNotification = JsonSerializer.Deserialize<RtcNotificationMessage>(e.Data);
|
||||
if (rtcNotification is null)
|
||||
return;
|
||||
|
||||
var notificationType = rtcNotification.Type ?? null;
|
||||
var notificationType = rtcNotification.Type;
|
||||
var notificationChannelId = rtcNotification.ChannelId ?? string.Empty;
|
||||
|
||||
if (notificationChannelId != _currentChannelId)
|
||||
@@ -216,8 +216,11 @@ public partial class MainPage : ContentPage
|
||||
{
|
||||
switch (notificationType)
|
||||
{
|
||||
case SignalType.OfferUpdated :
|
||||
case SignalType.OfferUpdated:
|
||||
{
|
||||
if (rtcNotification.Username == _username)
|
||||
break;
|
||||
|
||||
var offer = await GetRtcOffer();
|
||||
await SendRtcSignalToJsAsync(offer);
|
||||
break;
|
||||
@@ -233,9 +236,16 @@ public partial class MainPage : ContentPage
|
||||
}
|
||||
case SignalType.CandidateAdded:
|
||||
{
|
||||
if (rtcNotification.Username == _username)
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
IceCandidate? iceCandidate = JsonSerializer.Deserialize<IceCandidate>(rtcNotification.Direction);
|
||||
|
||||
if (iceCandidate is null)
|
||||
break;
|
||||
|
||||
IceCandidateCallback(iceCandidate);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -600,6 +610,11 @@ public partial class MainPage : ContentPage
|
||||
Console.WriteLine($"[{_username}] sent RTC signal: {rtcSignal.Type} -> {rtcSignal.ChannelId}");
|
||||
} //Remove?
|
||||
|
||||
//public async Task<string> GetRtcParticipants() // TODO: UNCOMMENT AND ADD
|
||||
//{
|
||||
// var participants = await ServerAPI.GetRtcParticipantsAsync(_currentChannelId);
|
||||
// return JsonSerializer.Serialize(participants);
|
||||
//}
|
||||
|
||||
#endregion
|
||||
private void OnSendMessageButtonClicked(object sender, EventArgs e)
|
||||
@@ -615,7 +630,7 @@ public partial class MainPage : ContentPage
|
||||
return;
|
||||
}
|
||||
|
||||
await DisplayAlertAsync("Raw Message Received", e.Message, "OK");
|
||||
SafeSendRawToWebView($"JS RAW -> C#: {e.Message}");
|
||||
}
|
||||
|
||||
private void SafeSendRawToWebView(string message)
|
||||
|
||||
Reference in New Issue
Block a user