Ensure custom exposure mode is supported
This commit is contained in:
parent
f8efa172ba
commit
9e05ea15c1
@ -18,7 +18,7 @@ extension CameraSession {
|
|||||||
filePath: String,
|
filePath: String,
|
||||||
onVideoRecorded: @escaping (_ video: Video) -> Void,
|
onVideoRecorded: @escaping (_ video: Video) -> Void,
|
||||||
onError: @escaping (_ error: CameraError) -> Void) {
|
onError: @escaping (_ error: CameraError) -> Void) {
|
||||||
|
|
||||||
lockCurrentExposure(for: captureSession)
|
lockCurrentExposure(for: captureSession)
|
||||||
// Run on Camera Queue
|
// Run on Camera Queue
|
||||||
CameraQueues.cameraQueue.async {
|
CameraQueues.cameraQueue.async {
|
||||||
@ -36,7 +36,7 @@ extension CameraSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let enableAudio = self.configuration?.audio != .disabled
|
let enableAudio = self.configuration?.audio != .disabled
|
||||||
|
|
||||||
// Callback for when new chunks are ready
|
// Callback for when new chunks are ready
|
||||||
let onChunkReady: (ChunkedRecorder.Chunk) -> Void = { chunk in
|
let onChunkReady: (ChunkedRecorder.Chunk) -> Void = { chunk in
|
||||||
guard let delegate = self.delegate else {
|
guard let delegate = self.delegate else {
|
||||||
@ -193,13 +193,18 @@ extension CameraSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func lockCurrentExposure(for session: AVCaptureSession) {
|
func lockCurrentExposure(for session: AVCaptureSession) {
|
||||||
guard let captureDevice = AVCaptureDevice.default(for: .video) else {
|
guard let captureDevice = AVCaptureDevice.default(for: .video) else {
|
||||||
print("No capture device available")
|
print("No capture device available")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard captureDevice.isExposureModeSupported(.custom) else {
|
||||||
|
ReactLogger.log(level: .info, message: "Custom exposure mode not supported")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// Lock the device for configuration
|
// Lock the device for configuration
|
||||||
try captureDevice.lockForConfiguration()
|
try captureDevice.lockForConfiguration()
|
||||||
|
Loading…
Reference in New Issue
Block a user