private async Task GetCameraInfoAsync(string cameraName) { await Task.Run(() => { VideoDeviceInfo videoDeviceInfo = _sdkService.GetVideoDeviceInfos(cameraName); }); }
private void cbCameraDevices_SelectionChanged(object sender, SelectionChangedEventArgs e) { VideoDeviceInfo deviceInfo = cbCameraDevices.SelectedItem as VideoDeviceInfo; if (deviceInfo == null) { return; } MediaHandlers.ChangeCamera(deviceInfo.DeviceID); }
private void UpdateCameraResolution(VideoDeviceInfo device) { if (device == null) return; cobVideoResolutions.Items.Clear(); if (device.Capabilities != null) { foreach (VideoCapabilities resolution in device.Capabilities) { cobVideoResolutions.Items.Add(resolution); } if (cobVideoResolutions.Items.Count > 0) cobVideoResolutions.SelectedItem = device.Capabilities[0]; cobVideoResolutions.Update(); } }
public CameraDeviceItemViewModel(VideoDeviceInfo videoDeviceInfo) { OwnerVideoDevice = videoDeviceInfo; IsSelected = false; }
/// <summary> /// Changes the camera device. /// </summary> public void ChangeCamera(int deviceID) { if (!initialized) { return; } // same device if (WebCamera != null && WebCamera.DeviceID == deviceID) { return; } // find the proper info VideoDeviceInfo newDeviceInfo = null; foreach (var info in Cameras) { if (info.DeviceID != deviceID) { continue; } newDeviceInfo = info; break; } if (newDeviceInfo == null) { return; } // begin change device bool capturing = false; if (WebCamera != null) { // disconnect if (LocalImageProvider != null) { audioConnector.Disconnect(WebCamera, LocalImageProvider); } audioConnector.Disconnect(WebCamera, phoneCallVideoSender); // dispose previous device capturing = WebCamera.Capturing; WebCamera.Stop(); WebCamera.Dispose(); } // create new WebCamera = WebCamera.GetDevice(newDeviceInfo); if (WebCamera != null) { audioConnector.Connect(WebCamera, LocalImageProvider); audioConnector.Connect(WebCamera, phoneCallVideoSender); if (capturing) { WebCamera.Start(); } } OnPropertyChanged("WebCamera"); }
public WebCameraEngine(VideoDeviceInfo device) { _camera = WebCamera.GetDevice(device); _microphone = Microphone.GetDefaultDevice(); }
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]; } } }
internal static org_webRtc_VideoDeviceInfo_t org_webRtc_VideoDeviceInfo_ToC(VideoDeviceInfo value) { if (null == value) { return(System.IntPtr.Zero); } return(Wrapper.Org_WebRtc.OverrideApi.org_webRtc_VideoDeviceInfo_wrapperClone(value.native_)); }