fix: Fix torch
not staying on while recording (#2249)
* fix: Fix `zoom` on native gesture * fix: Control `torch` from JS side * Update CameraView+RecordVideo.kt * Update CameraView+Zoom.swift
This commit is contained in:
@@ -18,13 +18,6 @@ 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,
|
||||
@@ -47,11 +40,6 @@ 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) {
|
||||
|
@@ -18,10 +18,9 @@ extension CameraView {
|
||||
return
|
||||
}
|
||||
|
||||
// Update zoom on Camera
|
||||
cameraSession.configure { configuration in
|
||||
configuration.zoom = scale
|
||||
}
|
||||
// Update zoom React prop
|
||||
zoom = NSNumber(value: scale)
|
||||
didSetProps(["zoom"])
|
||||
}
|
||||
|
||||
func addPinchGestureRecognizer() {
|
||||
|
@@ -43,14 +43,6 @@ extension CameraSession {
|
||||
self.deactivateAudioSession()
|
||||
}
|
||||
}
|
||||
// Reset flash
|
||||
if options.flash != .off {
|
||||
// Set torch mode back to what it was before if we used it for the video flash.
|
||||
self.configure { config in
|
||||
let torch = self.configuration?.torch ?? .off
|
||||
config.torch = torch
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.isRecording = false
|
||||
|
Reference in New Issue
Block a user