コード例 #1
0
        private async Task ConfigItemChangedAsync(ConfigChangedItem configChangedItem)
        {
            if (string.IsNullOrEmpty(configChangedItem.value))
            {
                return;
            }

            await Task.Run(async() =>
            {
                switch (configChangedItem.key)
                {
                case ConfigItemKey.MainCamera:
                    await RefreshExclusiveDataSourceAsync(ConfigItemKey.MainCamera, configChangedItem.value);
                    _sdkService.SetDefaultDevice(1, configChangedItem.value);


                    await _meetingConfigView.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        RefreshResolutionsAsync(configChangedItem);
                    }));
                    break;

                case ConfigItemKey.MainCameraResolution:
                    string[] mainResolution = configChangedItem.value.Split('*');
                    _sdkService.SetVideoResolution(1, int.Parse(mainResolution[0]), int.Parse(mainResolution[1]));
                    break;

                case ConfigItemKey.MainCameraCodeRate:
                    _sdkService.SetVideoBitRate(1, int.Parse(configChangedItem.value));

                    break;

                case ConfigItemKey.SecondaryCamera:
                    await RefreshExclusiveDataSourceAsync(ConfigItemKey.SecondaryCamera, configChangedItem.value);
                    _sdkService.SetDefaultDevice(2, configChangedItem.value);

                    await _meetingConfigView.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        RefreshResolutionsAsync(configChangedItem);
                    }));
                    break;

                case ConfigItemKey.SecondaryCameraResolution:
                    string[] secondaryResolution = configChangedItem.value.Split('*');
                    _sdkService.SetVideoResolution(2, int.Parse(secondaryResolution[0]),
                                                   int.Parse(secondaryResolution[1]));
                    break;

                case ConfigItemKey.SecondaryCameraCodeRate:
                    _sdkService.SetVideoBitRate(2, int.Parse(configChangedItem.value));
                    break;

                case ConfigItemKey.MainMicrophone:
                    await RefreshExclusiveDataSourceAsync(ConfigItemKey.MainMicrophone, configChangedItem.value);
                    _sdkService.SetDefaultDevice(3, configChangedItem.value);

                    break;

                case ConfigItemKey.SecondaryMicrophone:
                    await
                    RefreshExclusiveDataSourceAsync(ConfigItemKey.SecondaryMicrophone, configChangedItem.value);
                    _sdkService.SetDefaultDevice(5, configChangedItem.value);

                    break;

                case ConfigItemKey.Speaker:
                    _sdkService.SetDefaultDevice(4, configChangedItem.value);
                    break;

                case ConfigItemKey.AudioSampleRate:
                    _sdkService.SetAudioSampleRate(int.Parse(configChangedItem.value));
                    break;

                case ConfigItemKey.AudioCodeRate:
                    _sdkService.SetAudioBitRate(int.Parse(configChangedItem.value));
                    break;

                case ConfigItemKey.LiveResolution:

                    break;

                case ConfigItemKey.LiveCodeRate:

                    break;

                case ConfigItemKey.Unknown:
                default:
                    break;
                }

                SaveConfig();
            });
        }