mirror of
https://github.com/samsonjs/SwiftyCam.git
synced 2026-04-27 15:07:43 +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
|
videoDevice.automaticallyEnablesLowLightBoostWhenAvailable = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start out using the wide camera focal length when we have a triple cam. This
|
// Start out using the wide camera focal length when we have a triple or dual-wide cam.
|
||||||
// must be done after adding the video device input to the session.
|
// This must be done after adding the video device input to the session.
|
||||||
let zoomBoundaries = videoDevice.virtualDeviceSwitchOverVideoZoomFactors
|
let zoomBoundaries = videoDevice.virtualDeviceSwitchOverVideoZoomFactors
|
||||||
if videoDevice.deviceType == .builtInTripleCamera, let zoom = zoomBoundaries.first?.doubleValue {
|
if videoDevice.deviceType == .builtInTripleCamera, let zoom = zoomBoundaries.first?.doubleValue {
|
||||||
videoDevice.videoZoomFactor = zoom
|
videoDevice.videoZoomFactor = zoom
|
||||||
|
} else if videoDevice.deviceType == .builtInDualWideCamera, let zoom = zoomBoundaries.first?.doubleValue {
|
||||||
|
videoDevice.videoZoomFactor = zoom
|
||||||
}
|
}
|
||||||
|
|
||||||
videoDevice.unlockForConfiguration()
|
videoDevice.unlockForConfiguration()
|
||||||
|
|
@ -764,6 +766,7 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
fileprivate class func defaultCaptureDevice(preferringPosition position: AVCaptureDevice.Position) -> AVCaptureDevice? {
|
fileprivate class func defaultCaptureDevice(preferringPosition position: AVCaptureDevice.Position) -> AVCaptureDevice? {
|
||||||
AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: position)
|
AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: position)
|
||||||
?? AVCaptureDevice.default(.builtInDualCamera, 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)
|
?? AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: position)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue