fix: Disable precapture sequence by default (#2629)
This commit is contained in:
parent
e8dd1e0b2e
commit
3f1a7c9e32
@ -32,6 +32,7 @@ suspend fun CameraView.takePhoto(optionsMap: ReadableMap): WritableMap {
|
||||
val flash = options["flash"] as? String ?: "off"
|
||||
val enableAutoStabilization = options["enableAutoStabilization"] == true
|
||||
val enableShutterSound = options["enableShutterSound"] as? Boolean ?: true
|
||||
val enablePrecapture = options["enablePrecapture"] as? Boolean ?: false
|
||||
|
||||
// TODO: Implement Red Eye Reduction
|
||||
options["enableAutoRedEyeReduction"]
|
||||
@ -44,6 +45,7 @@ suspend fun CameraView.takePhoto(optionsMap: ReadableMap): WritableMap {
|
||||
flashMode,
|
||||
enableShutterSound,
|
||||
enableAutoStabilization,
|
||||
enablePrecapture,
|
||||
orientation
|
||||
)
|
||||
|
||||
|
@ -369,6 +369,7 @@ class CameraSession(private val context: Context, private val cameraManager: Cam
|
||||
flash: Flash,
|
||||
enableShutterSound: Boolean,
|
||||
enableAutoStabilization: Boolean,
|
||||
enablePrecapture: Boolean,
|
||||
outputOrientation: Orientation
|
||||
): CapturedPhoto {
|
||||
val photoOutput = photoOutput ?: throw PhotoNotEnabledError()
|
||||
@ -380,7 +381,8 @@ class CameraSession(private val context: Context, private val cameraManager: Cam
|
||||
enableAutoStabilization,
|
||||
photoOutput.enableHdr,
|
||||
outputOrientation,
|
||||
enableShutterSound
|
||||
enableShutterSound,
|
||||
enablePrecapture
|
||||
)
|
||||
|
||||
try {
|
||||
|
@ -145,7 +145,8 @@ class PersistentCameraCaptureSession(private val cameraManager: CameraManager, p
|
||||
enableAutoStabilization: Boolean,
|
||||
enablePhotoHdr: Boolean,
|
||||
orientation: Orientation,
|
||||
enableShutterSound: Boolean
|
||||
enableShutterSound: Boolean,
|
||||
enablePrecapture: Boolean
|
||||
): TotalCaptureResult {
|
||||
// Cancel any ongoing focus jobs
|
||||
focusJob?.cancel()
|
||||
@ -169,7 +170,8 @@ class PersistentCameraCaptureSession(private val cameraManager: CameraManager, p
|
||||
val outputs = outputs
|
||||
val repeatingOutputs = outputs.filter { it.isRepeating }
|
||||
|
||||
if (qualityPrioritization == QualityPrioritization.SPEED && flash == Flash.OFF) {
|
||||
val skipPrecapture = !enablePrecapture || qualityPrioritization == QualityPrioritization.SPEED
|
||||
if (skipPrecapture && flash == Flash.OFF) {
|
||||
// 0. We want to take a picture as fast as possible, so skip any precapture sequence and just capture one Frame.
|
||||
Log.i(TAG, "Using fast capture path without pre-capture sequence...")
|
||||
val singleRequest = photoRequest.createCaptureRequest(device, deviceDetails, outputs)
|
||||
|
@ -44,6 +44,14 @@ export interface TakePhotoOptions {
|
||||
* @default true
|
||||
*/
|
||||
enableShutterSound?: boolean
|
||||
/**
|
||||
* Whether to run the pre-capture sequence to properly lock AF, AE and AWB values.
|
||||
* Enabling this results in greater photos, but might not work on some devices.
|
||||
*
|
||||
* @platform Android
|
||||
* @default false
|
||||
*/
|
||||
enablePrecapture?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user