简体   繁体   English

为什么我在使用颤振相机时得到 CAMERA_ERROR (3)

[英]Why i get CAMERA_ERROR (3) when using flutter camera

the following error occurs when using flutter camera plugin, I've added the permission to the manifest file, and still not working.使用flutter相机插件时出现以下错误,我已将权限添加到清单文件,但仍然无法正常工作。

Launching lib\main.dart on sdk gphone x86 in debug mode...
Parameter format not correct -
✓ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
Connecting to VM Service at ws://127.0.0.1:64116/dm5AqTZrDK0=/ws
I/CameraManagerGlobal(20232): Connecting to camera service
W/Gralloc4(20232): allocator 3.x is not supported
E/CameraCaptureSession(20232): Session 0: Exception while stopping repeating:
E/CameraCaptureSession(20232): android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
E/CameraCaptureSession(20232):  at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2231)
E/CameraCaptureSession(20232):  at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1241)
E/CameraCaptureSession(20232):  at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:578)
E/CameraCaptureSession(20232):  at io.flutter.plugins.camera.Camera.closeCaptureSession(Camera.java:480)
E/CameraCaptureSession(20232):  at io.flutter.plugins.camera.Camera.close(Camera.java:486)
E/CameraCaptureSession(20232):  at io.flutter.plugins.camera.Camera$2.onError(Camera.java:187)
E/CameraCaptureSession(20232):  at android.hardware.camera2.impl.CameraDeviceImpl.notifyError(CameraDeviceImpl.java:1629)
E/CameraCaptureSession(20232):  at android.hardware.camera2.impl.CameraDeviceImpl.lambda$oDs27OTfKFfK18rUW2nQxxkPdV0(Unknown Source:0)
E/CameraCaptureSession(20232):  at android.hardware.camera2.impl.-$$Lambda$CameraDeviceImpl$oDs27OTfKFfK18rUW2nQxxkPdV0.accept(Unknown Source:8)
E/CameraCaptureSession(20232):  at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:278)
E/CameraCaptureSession(20232):  at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:201)
E/CameraCaptureSession(20232):  at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
E/CameraCaptureSession(20232):  at android.os.Handler.handleCallback(Handler.java:938)
E/CameraCaptureSession(20232):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/CameraCaptureSession(20232):  at android.os.Looper.loop(Looper.java:223)
E/CameraCaptureSession(20232):  at android.app.ActivityThread.main(ActivityThread.java:7656)
E/CameraCaptureSession(20232):  at java.lang.reflect.Method.invoke(Native Method)
E/CameraCaptureSession(20232):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/CameraCaptureSession(20232):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/flutter (20232): CameraException(Previous capture has not returned yet., takePicture was called before the previous capture returned.)

You can also now use this plugin : CamerAwesome您现在也可以使用这个插件: CamerAwesome

Official plugin has been quite abandonned.官方插件已经相当废弃了。 This plugin includes flash, zoom, auto focus... and no initialisation required.这个插件包括闪光、缩放、自动对焦……并且不需要初始化。

I also received this error when using Flutter camera plugin example when I changed it from CameraController.startVideoRecording() to CameraController.startImageStream(Function<CameraImage>) .当我将 Flutter 相机插件示例CameraController.startVideoRecording()更改为CameraController.startImageStream(Function<CameraImage>)时,我也收到了此错误。

To resolve this issue I commented/removed imageFormatGroup: ImageFormatGroup.jpeg at CameraController instantiation:为了解决这个问题,我在 CameraController 实例化中评论/删除了imageFormatGroup: ImageFormatGroup.jpeg

controller = CameraController(
  cameraDescription,
  ResolutionPreset.medium,
  enableAudio: enableAudio,
  //imageFormatGroup: ImageFormatGroup.jpeg, //remove or comment this line
);

This may happen because CameraImage received at startImageStream uses YUV image encoding .这可能是因为在CameraImage接收的startImageStream使用 YUV 图像编码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM