From 9e05ea15c166b74401dfa638fcdfc40f2ca54e33 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 9 Oct 2024 17:59:22 -0600 Subject: [PATCH] Ensure custom exposure mode is supported --- package/ios/Core/CameraSession+Video.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/package/ios/Core/CameraSession+Video.swift b/package/ios/Core/CameraSession+Video.swift index 5489997..53d72ab 100644 --- a/package/ios/Core/CameraSession+Video.swift +++ b/package/ios/Core/CameraSession+Video.swift @@ -18,7 +18,7 @@ extension CameraSession { filePath: String, onVideoRecorded: @escaping (_ video: Video) -> Void, onError: @escaping (_ error: CameraError) -> Void) { - + lockCurrentExposure(for: captureSession) // Run on Camera Queue CameraQueues.cameraQueue.async { @@ -36,7 +36,7 @@ extension CameraSession { } let enableAudio = self.configuration?.audio != .disabled - + // Callback for when new chunks are ready let onChunkReady: (ChunkedRecorder.Chunk) -> Void = { chunk in guard let delegate = self.delegate else { @@ -193,13 +193,18 @@ extension CameraSession { } } } - + func lockCurrentExposure(for session: AVCaptureSession) { guard let captureDevice = AVCaptureDevice.default(for: .video) else { print("No capture device available") return } + guard captureDevice.isExposureModeSupported(.custom) else { + ReactLogger.log(level: .info, message: "Custom exposure mode not supported") + return + } + do { // Lock the device for configuration try captureDevice.lockForConfiguration()