Reset flash state when switching to back camera in video mode

This commit is contained in:
Matéo Duparc 2021-12-23 19:10:13 +01:00
parent a9d4284b43
commit 80c5277936
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E

View File

@ -24,7 +24,6 @@ import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.camera.camera2.interop.Camera2CameraInfo
import androidx.camera.core.*
//import androidx.camera.core.VideoCapture
import androidx.camera.extensions.ExtensionMode
import androidx.camera.extensions.ExtensionsManager
import androidx.camera.lifecycle.ProcessCameraProvider
@ -242,6 +241,11 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
false
} else {
binding.imageCameraSwitch.setImageResource(R.drawable.icon_camera_front)
if (isInVideoMode) {
//reset flash state
imageCapture?.flashMode = ImageCapture.FLASH_MODE_OFF
binding.imageFlash.setImageResource(R.drawable.icon_flash_off)
}
true
}
setupCamera()