protected async ValueTask TryAddRoom(object args)
        {
            if (string.IsNullOrWhiteSpace(RoomName))
            {
                return;
            }

            var takeAction = args switch
            {
                KeyboardEventArgs keyboard when keyboard.Key == "Enter" => true,
                MouseEventArgs _ => true,
                _ => false
            };

            if (takeAction)
            {
                var addedOrJoined = await VideoJS.CreateOrJoinRoomAsync(JsRuntime, RoomName);

                if (addedOrJoined)
                {
                    _activeRoom = RoomName;
                    RoomName    = null;

                    await _hubConnection.InvokeAsync(NotificationHub.RoomAddedRoute, _activeRoom);
                }
            }
        }
        protected async ValueTask SelectCamera(string deviceId, bool persist = true)
        {
            if (persist)
            {
                await LocalStore.SetAsync(DefaultDeviceId, deviceId);
            }

            await VideoJS.StartVideoAsync(JsRuntime, deviceId, Selector);
        }
        protected async ValueTask TryJoinRoom(string roomName)
        {
            if (string.IsNullOrWhiteSpace(roomName))
            {
                return;
            }

            var joined = await VideoJS.CreateOrJoinRoomAsync(JsRuntime, roomName);

            if (joined)
            {
                _activeRoom = roomName;
            }
        }
        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();
        }