In my project, I am trying to support triple cameras system. But I don't know how to check whether a device has triple cameras?
CodePudding user response:
you can do this with following code either device has builtin dual back camera or wide angle back camera
var currentDevice:AVCaptureDevice?
if let device = AVCaptureDevice.default(.builtInDualCamera, for: AVMediaType.video, position: .back)
{
currentDevice = device
}
else if let device = AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: .back)
{
currentDevice = device
}
else if let device = AVCaptureDevice.default(.builtInWideAngleCamera, for: AVMediaType.video, position: .back)
{
currentDevice = device
}
else
{
print("Error: no camera available")
}
Hope this will helps you