Beispiel #1
0
        private async void ActivateFrontCameraExecute()
        {
            var frontCamera = _cameras.Devices.FirstOrDefault(c => c.Location == MediaDeviceLocation.Front);

            if (frontCamera != null)
            {
                IsCameraSwitchInProgress = true;
                await _settingsChannel.SetVideoDeviceAsync(frontCamera);
            }
        }
        private async void OnSaveCommandExecute()
        {
            var registrationSettingChanged = false;

            if (SignalingSettings.SignalingServerPort != SignalingServerPort.ToString())
            {
                SignalingSettings.SignalingServerPort = SignalingServerPort.ToString();
                registrationSettingChanged            = true;
            }

            if (SignalingSettings.SignalingServerHost != SignalingServerHost)
            {
                SignalingSettings.SignalingServerHost = SignalingServerHost;
                registrationSettingChanged            = true;
            }
            if (RegistrationSettings.Domain != Domain)
            {
                RegistrationSettings.Domain = Domain;
                registrationSettingChanged  = true;
            }

            if (registrationSettingChanged)
            {
                OnRegistrationSettingsChanged?.Invoke();
            }

            SignalingSettings.AppInsightsEnabled = AppInsightsEnabled;

            if (NtpServerIp != null)
            {
                _localSettings.Values[nameof(NtpServerIp)] = NtpServerIp;
            }

            if (SelectedCamera != null)
            {
                await _mediaSettings.SetVideoDeviceAsync(SelectedCamera);
            }

            if (SelectedMicrophone != null)
            {
                await
                _mediaSettings.SetAudioDeviceAsync(SelectedMicrophone.Id == DefaultAudioDeviceId
                                                   ?null
                                                   : SelectedMicrophone);
            }

            if (SelectedAudioPlayoutDevice != null)
            {
                await _mediaSettings.SetAudioPlayoutDeviceAsync(SelectedAudioPlayoutDevice.Id == DefaultAudioDeviceId
                                                                ?null
                                                                : SelectedAudioPlayoutDevice);
            }

            if (SelectedVideoCodec != null)
            {
                await _mediaSettings.SetVideoCodecAsync(SelectedVideoCodec);

                _localSettings.Values[nameof(SelectedVideoCodec)] = SelectedVideoCodec.Id;
            }

            if (SelectedAudioCodec != null)
            {
                await _mediaSettings.SetAudioCodecAsync(SelectedAudioCodec);

                _localSettings.Values[nameof(SelectedAudioCodec)] = SelectedAudioCodec.Id;
            }

            if (SelectedCapFpsItem != null)
            {
                await
                _mediaSettings.SetPreferredVideoCaptureFormatAsync(new VideoCaptureFormat((int)SelectedCapFpsItem.Width,
                                                                                          (int)SelectedCapFpsItem.Height,
                                                                                          (int)SelectedCapFpsItem.FrameRate));

                _localSettings.Values[nameof(SelectedCapResItem)] = SelectedCapResItem;
                _localSettings.Values[SelectedFrameRateId]        = SelectedCapFpsItem?.FrameRate;
            }

            var newList =
                (from iceServerVm in IceServers where iceServerVm.Apply() select iceServerVm.IceServer).ToList();

            IceServerSettings.IceServers = newList;

            _localSettings.Values[nameof(StatsServerPort)] = StatsServerPort;
            _localSettings.Values[nameof(StatsServerHost)] = StatsServerHost;

            await _mediaSettings.SetStatsConfigAsync(new StatsConfig {
                SendStatsToServerEnabled = _statsSendToServerEnabled,
                StatsServerHost          = StatsServerHost,
                StatsServerPort          = StatsServerPort
            });

            OnCloseCommandExecute();
        }