Post

Replies

Boosts

Views

Activity

Center stage control mode not working for iPad on front camera with .photo session preset.
I am working on an iPad app using the front camera. The camera logic is implemented using the AVFoundation framework. During a session I use central stage mode to center the face with front camera . Central stage mode works fine in all cases except when I set the session preset photo. In other presets: high, medium, low, cif352x288, vga640x480, hd1280x720, hd1920x1080, iFrame960x540, iFrame1280x720, inputPriority presets central stage mode working except photo session preset. Can you explain why this happens or maybe it is an unobvious bug? Code snippet: final class CameraManager { //MARK: - Properties private let captureSession: AVCaptureSession private let photoOutput: AVCapturePhotoOutput private let previewLayer: AVCaptureVideoPreviewLayer //MARK: - Init init() { captureSession = AVCaptureSession() photoOutput = AVCapturePhotoOutput() previewLayer = AVCaptureVideoPreviewLayer(session: captureSession) } //MARK: - Methods Setup Camera and preview layer func setupPreviewLayerFrame(view: UIView) { previewLayer.frame = view.frame view.layer.insertSublayer(previewLayer, at: 0) setupCamera() } private func setupCamera() { guard let videoCaptureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front) else { return } AVCaptureDevice.centerStageControlMode = .app AVCaptureDevice.isCenterStageEnabled = true do { let input = try AVCaptureDeviceInput(device: videoCaptureDevice) captureSession.addInput(input) captureSession.addOutput(photoOutput) /// high, medium, low, cif352x288, vga640x480, hd1280x720, hd1920x1080, iFrame960x540, iFrame1280x720 and inputPriority presets working except photo session preset captureSession.sessionPreset = .photo DispatchQueue.global(qos: .userInteractive).async { self.captureSession.startRunning() } } catch { print("Error setting up camera: \(error.localizedDescription)") } } }
0
0
429
Aug ’24