I am trying to increase the zoom of the camera to its max level in my application.
However even after setting the device VideoZoomFactor to its max it still manages to remain the same on the screen.
Below is my implementation
void Initialize() { var videoDevs = AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video); var position = (cameraOptions == CameraOptions.Front) ? AVCaptureDevicePosition.Front : AVCaptureDevicePosition.Back; var device = videoDevs.FirstOrDefault(d => d.Position == position); device.LockForConfiguration(out error); if (error == null) { device.VideoZoomFactor = device.ActiveFormat.VideoMaxZoomFactor; } device.UnlockForConfiguration(); while(device.RampingVideoZoom == true) { Console.WriteLine("Zooming camera"); //This line is never written } Console.WriteLine("Zoom Factor"); Console.WriteLine(device.VideoZoomFactor); //This returns 16 Console.WriteLine("Current Format"); Console.WriteLine(device.ActiveFormat); }
The last Console WriteLine returns:
<AVCaptureDeviceFormat: 0x1c48049a0 'vide'/'420v' 1920x1080, { 3- 30 fps}, HRSI:4096x2304, fov:59.680, supports vis, max zoom:16.00 (upscales @1.94), AF System:2, ISO:22.0-704.0, SS:0.000005-0.333333>
So I know it is possible to zoom but it is not working.
Any suggestions?
Answers
Try the same but after you add the device to a session:
Also instead:
You can write like this: