예제 #1
0
 private async Task GetCameraInfoAsync(string cameraName)
 {
     await Task.Run(() =>
     {
         VideoDeviceInfo videoDeviceInfo = _sdkService.GetVideoDeviceInfos(cameraName);
     });
 }
예제 #2
0
        private void RefreshResolutionsAsync(ConfigChangedItem configChangedItem)
        {
            if (configChangedItem.value == NonExclusiveItem)
            {
                return;
            }

            VideoDeviceInfo videoDeviceInfo = _sdkService.GetVideoDeviceInfos(configChangedItem.value);


            if (configChangedItem.key == ConfigItemKey.MainCamera)
            {
                if (videoDeviceInfo.FormatCount > 0)
                {
                    MeetingConfigParameter.UserCameraSetting.ResolutionList.Clear();

                    VideoFormat videoFormat = videoDeviceInfo.Formats[0];

                    for (int i = 0; i < videoFormat.sizeCount; i++)
                    {
                        string resolution = $"{videoFormat.VideoSizes[i].Width}*{videoFormat.VideoSizes[i].Height}";

                        if (!MeetingConfigParameter.UserCameraSetting.ResolutionList.Contains(resolution))
                        {
                            MeetingConfigParameter.UserCameraSetting.ResolutionList.Add(resolution);
                        }
                    }
                }

                if (
                    MeetingConfigParameter.UserCameraSetting.ResolutionList.Contains(
                        GlobalData.Instance.AggregatedConfig.MainCamera.Resolution))
                {
                    MeetingConfigResult.MainCamera.Resolution =
                        GlobalData.Instance.AggregatedConfig.MainCamera.Resolution;
                }
                else if (MeetingConfigParameter.UserCameraSetting.ResolutionList.Count > 0)
                {
                    MeetingConfigResult.MainCamera.Resolution =
                        MeetingConfigParameter.UserCameraSetting.ResolutionList[0];
                }
            }

            if (configChangedItem.key == ConfigItemKey.SecondaryCamera)
            {
                if (videoDeviceInfo.FormatCount > 0)
                {
                    MeetingConfigParameter.DataCameraSetting.ResolutionList.Clear();

                    VideoFormat videoFormat = videoDeviceInfo.Formats[0];

                    for (int i = 0; i < videoFormat.sizeCount; i++)
                    {
                        string resolution = $"{videoFormat.VideoSizes[i].Width}*{videoFormat.VideoSizes[i].Height}";

                        if (!MeetingConfigParameter.DataCameraSetting.ResolutionList.Contains(resolution))
                        {
                            MeetingConfigParameter.DataCameraSetting.ResolutionList.Add(resolution);
                        }
                    }
                }

                if (
                    MeetingConfigParameter.DataCameraSetting.ResolutionList.Contains(
                        GlobalData.Instance.AggregatedConfig.SecondaryCamera.Resolution))
                {
                    MeetingConfigResult.SecondaryCamera.Resolution =
                        GlobalData.Instance.AggregatedConfig.SecondaryCamera.Resolution;
                }
                else if (MeetingConfigParameter.DataCameraSetting.ResolutionList.Count > 0)
                {
                    MeetingConfigResult.SecondaryCamera.Resolution =
                        MeetingConfigParameter.DataCameraSetting.ResolutionList[0];
                }
            }
        }