Fix camera selection

This commit is contained in:
Ilya Laktyushin 2023-07-02 17:39:30 +02:00
parent a886d60f89
commit 9ca6a1a4a5
3 changed files with 4 additions and 3 deletions

View File

@ -58,7 +58,7 @@ final class CameraDeviceContext {
self.previewView = previewView self.previewView = previewView
self.device.configure(for: session, position: position) self.device.configure(for: session, position: position, dual: !exclusive || additional)
self.input.configure(for: session, device: self.device, audio: audio) self.input.configure(for: session, device: self.device, audio: audio)
self.output.configure(for: session, device: self.device, input: self.input, previewView: previewView, audio: audio, photo: photo, metadata: metadata) self.output.configure(for: session, device: self.device, input: self.input, previewView: previewView, audio: audio, photo: photo, metadata: metadata)

View File

@ -29,11 +29,11 @@ final class CameraDevice {
public private(set) var audioDevice: AVCaptureDevice? = nil public private(set) var audioDevice: AVCaptureDevice? = nil
func configure(for session: CameraSession, position: Camera.Position) { func configure(for session: CameraSession, position: Camera.Position, dual: Bool) {
self.position = position self.position = position
var selectedDevice: AVCaptureDevice? var selectedDevice: AVCaptureDevice?
if #available(iOS 13.0, *), position != .front { if #available(iOS 13.0, *), position != .front && !dual {
if let device = AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: position) { if let device = AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: position) {
selectedDevice = device selectedDevice = device
} else if let device = AVCaptureDevice.default(.builtInDualCamera, for: .video, position: position) { } else if let device = AVCaptureDevice.default(.builtInDualCamera, for: .video, position: position) {

View File

@ -660,6 +660,7 @@ final class VideoInputScalePass: RenderPass {
width = Int(scaledSize.width) width = Int(scaledSize.width)
height = Int(scaledSize.height) height = Int(scaledSize.height)
} }
self.mainPosition = VideoPosition(position: CGPoint(x: width / 2, y: height / 2), size: CGSize(width: width, height: height), scale: 1.0, rotation: 0.0)
let containerSize = CGSize(width: width, height: height) let containerSize = CGSize(width: width, height: height)