fix: Fix torch
not being reset after video recording (#2209)
This commit is contained in:
parent
717a3534bc
commit
bb3a42e6bc
@ -18,6 +18,13 @@ extension CameraView: AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureAud
|
|||||||
do {
|
do {
|
||||||
let options = try RecordVideoOptions(fromJSValue: options)
|
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
|
// Start Recording with success and error callbacks
|
||||||
cameraSession.startRecording(
|
cameraSession.startRecording(
|
||||||
options: options,
|
options: options,
|
||||||
@ -40,6 +47,11 @@ extension CameraView: AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureAud
|
|||||||
|
|
||||||
func stopRecording(promise: Promise) {
|
func stopRecording(promise: Promise) {
|
||||||
cameraSession.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) {
|
func pauseRecording(promise: Promise) {
|
||||||
|
@ -214,7 +214,7 @@ public final class CameraView: UIView, CameraSessionDelegate {
|
|||||||
// Side-Props
|
// Side-Props
|
||||||
config.fps = fps?.int32Value
|
config.fps = fps?.int32Value
|
||||||
config.enableLowLightBoost = lowLightBoost
|
config.enableLowLightBoost = lowLightBoost
|
||||||
config.torch = getTorch()
|
config.torch = try Torch(jsValue: torch)
|
||||||
|
|
||||||
// Zoom
|
// Zoom
|
||||||
config.zoom = zoom.doubleValue
|
config.zoom = zoom.doubleValue
|
||||||
|
@ -22,13 +22,6 @@ extension CameraSession {
|
|||||||
let start = DispatchTime.now()
|
let start = DispatchTime.now()
|
||||||
ReactLogger.log(level: .info, message: "Starting Video recording...")
|
ReactLogger.log(level: .info, message: "Starting Video recording...")
|
||||||
|
|
||||||
if options.flash != .off {
|
|
||||||
// use the torch as the video's flash
|
|
||||||
self.configure { config in
|
|
||||||
config.torch = options.flash
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Video Output
|
// Get Video Output
|
||||||
guard let videoOutput = self.videoOutput else {
|
guard let videoOutput = self.videoOutput else {
|
||||||
if self.configuration?.video == .disabled {
|
if self.configuration?.video == .disabled {
|
||||||
|
Loading…
Reference in New Issue
Block a user