protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { Devices = await VideoJS.GetVideoDevicesAsync(JsRuntime); State = Devices != null && Devices.Length > 0 ? CameraState.FoundCameras : CameraState.Error; StateHasChanged(); var defaultDeviceId = await LocalStore.GetAsync <string>(DefaultDeviceId); if (!string.IsNullOrWhiteSpace(defaultDeviceId)) { await SelectCamera(defaultDeviceId, false); } } }
protected override async Task OnInitializedAsync() { _hubConnection = new HubConnectionBuilder() .AddMessagePackProtocol() .WithUrl(NavigationManager.ToAbsoluteUri(NotificationHub.Endpoint)) .WithAutomaticReconnect() .ConfigureLogging(builder => builder.AddDebug().AddConsole()) .Build(); _hubConnection.On <string>(NotificationHub.RoomAddedRoute, OnRoomAdded); await _hubConnection.StartAsync(); Devices = await VideoJS.GetVideoDevicesAsync(JsRuntime); State = Devices != null && Devices.Length > 0 ? CameraState.FoundCameras : CameraState.Error; StateHasChanged(); }