Ensure custom exposure mode is supported
This commit is contained in:
parent
f8efa172ba
commit
9e05ea15c1
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user