[ad_1]
I am engaged on a digicam app and I presently do not have a tool with a triple digicam (so I can not take a look at). When an app initially configures a digicam, I would like the digicam setting with no zoom out and in till the person begins pinching in or out (then begins zooming in or out).
Within the video zoom issue documentation, it says
Allowed values vary from 1.0 (full discipline of view) to the worth of the lively format’s videoMaxZoomFactor property.
So, when the triple digicam makes use of its 2x zoom out, that point the video zoom issue is 1.0?
and if it does not use any zoom performance, the zoom issue turns into 2.0 (just like the double of the 2x zoom out’s zoom issue)?
Subsequently, when configuring the digicam with no zoom or out, do I have to set 2.0 for zoom issue solely when utilizing the triple digicam?
var videoDevice: AVCaptureDevice?
init() {
getBestDevice()
setInitialZoomFactor(for: self.videoDevice)
}
let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInTripleCamera, .builtInDualWideCamera, .builtInDualCamera, .builtInWideAngleCamera], mediaType: .video, place: .again)
func getBestDevice() {
let gadgets = discoverySession.gadgets
guard !gadgets.isEmpty else { fatalError("Lacking seize gadgets.")}
videoDevice = gadgets.first
}
func setInitialZoomFactor(for machine: AVCaptureDevice?) {
guard let machine = machine else { return }
do {
strive videoDevice.lockForConfiguration()
if videoDevice.deviceType == .builtInTripleCamera {
videoDevice.videoZoomFactor = 2.0
} else {
videoDevice.videoZoomFactor = 1.0
}
videoDevice.unlockForConfiguration()
} catch {
print("acquired error")
}
}
[ad_2]
