fix: Fix torch not being reset after video recording (#2209)
This commit is contained in:
@@ -18,6 +18,13 @@ extension CameraView: AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureAud
|
||||
do {
|
||||
let options = try RecordVideoOptions(fromJSValue: options)
|
||||
|
||||
// If flash is on, just enable torch
|
||||
if options.flash != .off {
|
||||
cameraSession.configure { config in
|
||||
config.torch = options.flash
|
||||
}
|
||||
}
|
||||
|
||||
// Start Recording with success and error callbacks
|
||||
cameraSession.startRecording(
|
||||
options: options,
|
||||
@@ -40,6 +47,11 @@ extension CameraView: AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureAud
|
||||
|
||||
func stopRecording(promise: Promise) {
|
||||
cameraSession.stopRecording(promise: promise)
|
||||
|
||||
// If flash was used, we had the torch enabled. Now set it back to it's original state.
|
||||
cameraSession.configure { config in
|
||||
config.torch = try Torch(jsValue: torch)
|
||||
}
|
||||
}
|
||||
|
||||
func pauseRecording(promise: Promise) {
|
||||
|
||||
Reference in New Issue
Block a user