update: Device Selection + No Cam Required
This commit is contained in:
@@ -40,12 +40,8 @@ public partial class MainPage : ContentPage
|
||||
_wsc.Send($"REGISTER_KEY|{_username}|{publicKey}");
|
||||
_wsc.Send("GET_SERVER_KEY");
|
||||
_wsc.Send("GET_CHANNELS");
|
||||
hybridWebView.SetInvokeJavaScriptTarget(this);
|
||||
|
||||
Loaded += async (_, _) =>
|
||||
{
|
||||
await InitializeRtcPageAsync();
|
||||
};
|
||||
hybridWebView.SetInvokeJavaScriptTarget(this);
|
||||
|
||||
}
|
||||
|
||||
@@ -355,6 +351,12 @@ public partial class MainPage : ContentPage
|
||||
|
||||
private async void OnHybridWebViewRawMessageReceived(object sender, HybridWebViewRawMessageReceivedEventArgs e)
|
||||
{
|
||||
if (e.Message == "rtc_page_ready")
|
||||
{
|
||||
await InitializeRtcPageAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await DisplayAlertAsync("Raw Message Received", e.Message, "OK");
|
||||
}
|
||||
|
||||
@@ -405,8 +407,8 @@ public partial class MainPage : ContentPage
|
||||
|
||||
private async Task InitializeRtcPageAsync()
|
||||
{
|
||||
var jsArg = JsonSerializer.Serialize(_username);
|
||||
await hybridWebView.EvaluateJavaScriptAsync($"window.currentUsername = {jsArg};");
|
||||
Console.WriteLine($"[{_username}] RTC page initialized.");
|
||||
var usernameJson = JsonSerializer.Serialize(_username);
|
||||
await hybridWebView.EvaluateJavaScriptAsync($"window.setUsername({usernameJson})");
|
||||
Console.WriteLine($"[{_username}] pushed username into HybridWebView.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user