I would like my user to use zoom in AR application. Is it possible to zoom using ARView?
I have written the following code and added it to tap action.
let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes:
[.builtInTrueDepthCamera, .builtInDualCamera, .builtInWideAngleCamera],
mediaType: .video, position: .back)
let devices : [AVCaptureDevice] = discoverySession.devices
let zoomFactor:CGFloat = 2
for de in devices {
print("name of camera")
print(de.localizedName)
do{
try de.lockForConfiguration()
de.videoZoomFactor = zoomFactor
de.unlockForConfiguration()
}catch {
print ("error")
}
}
I run it on IPhone X and see result in log
name of camera
Back Dual Camera
name of camera
Back Camera
But it has no effect on zoom.
Is it even possible to zoom in while using ARKit?