imaginary-cloud / CameraManager

Simple Swift class to provide all the configurations you need to create custom camera view in your app
MIT License
1.37k stars 323 forks source link

does not work on iPhone 15 Pro Max #272

Open thierrybucco opened 1 year ago

thierrybucco commented 1 year ago

CameraManager does not work anymore on my device: iPhone 15 Pro Max. It fails in stillImageOutput.captureStillImageAsynchronously. here is the error (which seems to be generic, without more informations)

▿ CaptureResult

sessionQueue.async { [weak self] in
            if let self = self {
                let stillImageOutput = self._getStillImageOutput()
                if let connection = stillImageOutput.connection(with: AVMediaType.video),
                   connection.isEnabled {
                    if self.cameraDevice == CameraDevice.front, connection.isVideoMirroringSupported,
                       self.shouldFlipFrontCameraImage {
                        connection.isVideoMirrored = true
                    }
                    if connection.isVideoOrientationSupported {
                        connection.videoOrientation = self._currentCaptureVideoOrientation()
                    }

                    stillImageOutput.captureStillImageAsynchronously(from: connection, completionHandler: { [weak self] sample, error in

                        if let error = error {
<<< failed here!
                            self?._show(NSLocalizedString("Error", comment: ""), message: error.localizedDescription)
                            imageCompletion(.failure(error))
                            return
                        }

                        guard let sample = sample else { imageCompletion(.failure(CaptureError.noSampleBuffer)); return }
                        if let imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(sample) {
                            imageCompletion(CaptureResult(imageData))
                        } else {
                            imageCompletion(.failure(CaptureError.noImageData))
                        }

                    })
                } else {
                    imageCompletion(.failure(CaptureError.noVideoConnection))
                }
            }
        }

Do you have an idea? Thanks

marcnpopa commented 1 year ago

Same here, it works on 15 max only after zooming in - I guess it's after a camera switch

marcnpopa commented 1 year ago

@thierrybucco try this : https://github.com/imaginary-cloud/CameraManager/pull/273