public void StartCapture(int videoWidth, int videoHeight, int fps) { _fps = fps; _videoWidth = videoWidth; _videoHeight = videoHeight; var position = _usingFrontCamera ? AVCaptureDevicePosition.Back : AVCaptureDevicePosition.Front; var device = FindDeviceForPosition(position); var format = SelectFormatForDevice(device, videoWidth, videoHeight); if (format == null) { Debug.WriteLine($"CameraVideoCapturerNative -> didn't find a valid format for {device}"); format = RTCCameraVideoCapturer.SupportedFormatsForDevice(device).FirstOrDefault(); } if (format == null) { Console.WriteLine("CameraVideoCapturerNative -> no valid formats for device {0}", device); return; } fps = SelectFpsForFormat(format); _capturer.StartCaptureWithDevice(device, format, fps); }
public void StartCapture() { var position = _usingFrontCamera ? AVCaptureDevicePosition.Back : AVCaptureDevicePosition.Front; var device = FindDeviceForPosition(position); var format = SelectFormatForDevice(device); if (format == null) { Console.WriteLine("No valid formats for device {0}", device); return; } var fps = SelectFpsForFormat(format); _capturer.StartCaptureWithDevice(device, format, fps); }
public void StartCapture(int videoWidth, int videoHeight, int fps) { _videoFps = fps; _videoHeight = videoHeight; _videoWidth = videoWidth; var position = _usingFrontCamera ? AVCaptureDevicePosition.Back : AVCaptureDevicePosition.Front; var device = GetDeviceByPosition(position); var format = GetFormatForDevice(device, videoWidth, videoHeight); if (format == null) { Debug.WriteLine($"PLATFORMCAMERAVIDEOCAPTURER: not valid format for {device}"); format = RTCCameraVideoCapturer.SupportedFormatsForDevice(device).FirstOrDefault(); if (format == null) { Debug.WriteLine($"PLATFORMCAMERAVIDEOCAPTURER: no valid formats for device {0} and {device}"); return; } fps = GetFpsByFormat(format); _cameraVideoCapturer.StartCaptureWithDevice(device, format, fps); } }