AVCaptureDevice.DeviceType
has a set of camera options and allows us to list available devices and pick one of them.
For example, the code block below lists available devices on my iPhone.
let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes:
[.builtInTrueDepthCamera, .builtInDualCamera, .builtInWideAngleCamera, .builtInDualWideCamera, .builtInTripleCamera, .builtInTelephotoCamera, .builtInUltraWideCamera],
mediaType: .video, position: .back)
let devices = discoverySession.devices
guard !devices.isEmpty else { fatalError("Missing capture devices.")}
devices.forEach({
print($0.deviceType)
})
When I run this code snippet on my iPhone, I am getting the result below.
AVCaptureDeviceType(_rawValue: AVCaptureDeviceTypeBuiltInWideAngleCamera)
AVCaptureDeviceType(_rawValue: AVCaptureDeviceTypeBuiltInDualWideCamera)
AVCaptureDeviceType(_rawValue: AVCaptureDeviceTypeBuiltInUltraWideCamera)
3 devices are available on my device. How can I know that which one is the best option or the device has the highest quality? Of course, I want to pick the device which has the best quality on a user's device. Where are the differences between those there options and how can I know it during the runtime to pick the best one?