修复闪光灯模式切换不生效问题
This commit is contained in:
@@ -360,6 +360,23 @@ private fun CameraContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 闪光灯模式变化时更新 ImageCapture
|
||||||
|
LaunchedEffect(flashMode, imageCapture) {
|
||||||
|
imageCapture?.let {
|
||||||
|
try {
|
||||||
|
it.flashMode = flashMode
|
||||||
|
Log.d("CameraScreen", "Flash mode updated to: $flashMode")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("CameraScreen", "Failed to update flash mode", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 强制重组:当 flashMode 变化时触发
|
||||||
|
LaunchedEffect(flashMode) {
|
||||||
|
// 闪光灯变化时确保相机已绑定
|
||||||
|
}
|
||||||
|
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
// 相机预览
|
// 相机预览
|
||||||
AndroidView(
|
AndroidView(
|
||||||
|
|||||||
Reference in New Issue
Block a user