mirror of
https://github.com/samsonjs/SwiftyCam.git
synced 2026-03-25 09:05:52 +00:00
Support the dual-wide camera on recent non-Pro phones
This commit is contained in:
parent
69f86a9c0a
commit
5b50330d72
1 changed files with 5 additions and 2 deletions
|
|
@ -663,11 +663,13 @@ open class SwiftyCamViewController: UIViewController {
|
|||
videoDevice.automaticallyEnablesLowLightBoostWhenAvailable = true
|
||||
}
|
||||
|
||||
// Start out using the wide camera focal length when we have a triple cam. This
|
||||
// must be done after adding the video device input to the session.
|
||||
// Start out using the wide camera focal length when we have a triple or dual-wide cam.
|
||||
// This must be done after adding the video device input to the session.
|
||||
let zoomBoundaries = videoDevice.virtualDeviceSwitchOverVideoZoomFactors
|
||||
if videoDevice.deviceType == .builtInTripleCamera, let zoom = zoomBoundaries.first?.doubleValue {
|
||||
videoDevice.videoZoomFactor = zoom
|
||||
} else if videoDevice.deviceType == .builtInDualWideCamera, let zoom = zoomBoundaries.first?.doubleValue {
|
||||
videoDevice.videoZoomFactor = zoom
|
||||
}
|
||||
|
||||
videoDevice.unlockForConfiguration()
|
||||
|
|
@ -764,6 +766,7 @@ open class SwiftyCamViewController: UIViewController {
|
|||
fileprivate class func defaultCaptureDevice(preferringPosition position: AVCaptureDevice.Position) -> AVCaptureDevice? {
|
||||
AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: position)
|
||||
?? AVCaptureDevice.default(.builtInDualCamera, for: .video, position: position)
|
||||
?? AVCaptureDevice.default(.builtInDualWideCamera, for: .video, position: position)
|
||||
?? AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: position)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue