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:
@@ -9,9 +9,7 @@ import com.mrousavy.camera.core.MicrophonePermissionError
|
||||
import com.mrousavy.camera.core.RecorderError
|
||||
import com.mrousavy.camera.core.RecordingSession
|
||||
import com.mrousavy.camera.core.code
|
||||
import com.mrousavy.camera.types.Flash
|
||||
import com.mrousavy.camera.types.RecordVideoOptions
|
||||
import com.mrousavy.camera.types.Torch
|
||||
import com.mrousavy.camera.utils.makeErrorMap
|
||||
import java.util.*
|
||||
|
||||
@@ -23,14 +21,6 @@ suspend fun CameraView.startRecording(options: RecordVideoOptions, onRecordCallb
|
||||
}
|
||||
}
|
||||
|
||||
val enableFlash = options.flash == Flash.ON
|
||||
if (enableFlash) {
|
||||
// overrides current torch mode value to enable flash while recording
|
||||
cameraSession.configure { config ->
|
||||
config.torch = Torch.ON
|
||||
}
|
||||
}
|
||||
|
||||
val callback = { video: RecordingSession.Video ->
|
||||
val map = Arguments.createMap()
|
||||
map.putString("path", video.path)
|
||||
@@ -57,8 +47,4 @@ suspend fun CameraView.resumeRecording() {
|
||||
@SuppressLint("RestrictedApi")
|
||||
suspend fun CameraView.stopRecording() {
|
||||
cameraSession.stopRecording()
|
||||
// Set torch back to it's original value in case we just used it as a flash for the recording.
|
||||
cameraSession.configure { config ->
|
||||
config.torch = torch
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user