Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between builtInDualCamera and builtInDualWideCamera

I know only a little about iPhone's camera, and I'm bit confused with the differences between builtInDualCamera and builtInDualWideCamera. (so as builtInWideAngleCamera and builtInUltraWideCamera)

builtInDualCamera

A device that consists of a wide-angle and telephoto camera.

builtInWideAngleCamera

A device that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle.

I guess builtInDualCamera is like iPhone 11's camera and builtInDualCamera is like iPhone X's camera... Is that correct?

I'm working on a camera app (basically using video), and I'm trying to configure the camera when a user opens the app's camera screen. I tried codes in this article, basically picking which camera to use. So my code below is just checking if the device has 3 cameras > 2 cameras > 1 camera, and use one of them when configuring capture session. However, the device types has two similar properties, like builtInDualCamera and builtInDualWideCamera (and also builtInWideAngleCamera and builtInUltraWideCamera). I want to know which iPhone's camera is builtInWideAngleCamera and builtInUltraWideCamera. I added a screenshot as well, but is it like the difference between iPhone X's camera and iPhone 11's camera? (I mean... iPhone 11's camera has separate two camera's whereas iPhone X has two camera's but in a different shape.

import AVFoundation

class CameraManager {
    
    static let shared = CameraManager()
    let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInTripleCamera, .builtInDualCamera, .builtInWideAngleCamera], mediaType: .video, position: .back)
    
    func getBestDevice() -> AVCaptureDevice? {
        let devices = discoverySession.devices
        guard !devices.isEmpty else { fatalError("Missing capture devices.")}
        return devices.first
    }
}

and use like

CameraManager.shared.getBestDevice()

If I have three cameras (.builtInTripleCamera, .builtInDualCamera, .builtInWideAngleCamera) in the discoverySession property to check which camera to use, every iPhone camera will be categorized one of them? If the device's camera is builtInWideAngleCamera, do I need to add .builtInWideAngleCamera to the discoverySession property in order to use the builtInWideAngleCamera?

enter image description here

like image 364
Yuuu Avatar asked Jul 07 '26 13:07

Yuuu


1 Answers

If you look at DeviceType page, the cameras are listed from the most basic to the most advanced:

  • builtInWideAngleCamera exists on all iOS devices since long time ago,
  • builtInDualCamera exists from iPhone 7,
  • and builtInTripleCamera is iPhone 11

But seems you don't need a discovery session at all. You seems want to choose "the best back camera for taking videos", so your case falls under "Quickly Choose a Default Device" use case on the page you referenced.

In your case you will have for: .video, position: .back, while the first parameter actually depends on kind of video you want to take. For example you could ask for builtInTripleCamera, if available, then builtInDualCamera, and then settle on builtInWideAngleCamera as a minimal option. Or you may decide that people who don't have builtInTripleCamera just can't use your app:

if let device = AVCaptureDevice.default(.builtInTripleCamera,
                                        for: .video, position: .back) {
    return device
} else if let device = AVCaptureDevice.default(.builtInDualCamera,
                                               for: .video, position: .back) {
    return device
} else if let device = AVCaptureDevice.default(.builtInWideAngleCamera,
                                               for: .video, position: .back) {
    return device
} else {
    fatalError("Missing expected back camera device.")
}
like image 192
ytrewq Avatar answered Jul 10 '26 02:07

ytrewq