mirror of
https://github.com/samsonjs/SwiftyCam.git
synced 2026-04-27 15:07:43 +00:00
Use dual camera when triple isn't available, don't fall back directly to wide
This commit is contained in:
parent
5e659e1435
commit
69f86a9c0a
1 changed files with 4 additions and 3 deletions
|
|
@ -761,8 +761,9 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
|
|
||||||
/// Get Devices
|
/// Get Devices
|
||||||
|
|
||||||
fileprivate class func defaultCaptureDevice(preferringPosition position: AVCaptureDevice.Position = .back) -> 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(.builtInWideAngleCamera, for: .video, position: position)
|
?? AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: position)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -910,7 +911,7 @@ extension SwiftyCamViewController {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
let captureDevice = Self.defaultCaptureDevice()
|
let captureDevice = Self.defaultCaptureDevice(preferringPosition: currentCamera.captureDevicePosition)
|
||||||
try captureDevice?.lockForConfiguration()
|
try captureDevice?.lockForConfiguration()
|
||||||
|
|
||||||
zoomScale = min(maxZoomScale, max(1.0, min(beginZoomScale * pinch.scale, captureDevice!.activeFormat.videoMaxZoomFactor)))
|
zoomScale = min(maxZoomScale, max(1.0, min(beginZoomScale * pinch.scale, captureDevice!.activeFormat.videoMaxZoomFactor)))
|
||||||
|
|
@ -985,7 +986,7 @@ extension SwiftyCamViewController {
|
||||||
let translationDifference = currentTranslation - previousPanTranslation
|
let translationDifference = currentTranslation - previousPanTranslation
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let captureDevice = Self.defaultCaptureDevice()
|
let captureDevice = Self.defaultCaptureDevice(preferringPosition: currentCamera.captureDevicePosition)
|
||||||
try captureDevice?.lockForConfiguration()
|
try captureDevice?.lockForConfiguration()
|
||||||
|
|
||||||
let currentZoom = captureDevice?.videoZoomFactor ?? 0.0
|
let currentZoom = captureDevice?.videoZoomFactor ?? 0.0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue