Android 如何解决颤振摄像方法的异常?

Android 如何解决颤振摄像方法的异常?,android,flutter,android-camera,Android,Flutter,Android Camera,我得到这个错误: Exception has occurred. PlatformException (PlatformException(error, stop failed., null, java.lang.RuntimeException: stop failed. at android.media.MediaRecorder.stop(Native Method) at io.flutter.plugins.camera.Camera.stopVideoRecordin

我得到这个错误:

Exception has occurred.
PlatformException (PlatformException(error, stop failed., null, java.lang.RuntimeException: stop failed.
    at android.media.MediaRecorder.stop(Native Method)
    at io.flutter.plugins.camera.Camera.stopVideoRecording(Camera.java:645)
    at io.flutter.plugins.camera.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:120)
    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
    at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:335)
    at android.os.Looper.loop(Looper.java:183)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)        
))
摄像头插件版本为
摄像头:^0.7.0+2

flatter版本:
flatter(Channel beta,1.26.0-17.3.pre,Linux上,locale en_US.UTF-8)

我在Ubuntu 20上。 它工作正常,但突然停止工作,也没有升级。
任何帮助都将不胜感激:)

尝试并使用此方法。它可以工作

try {
    // add your stopVideoRecording method here
} catch (e) {
   
}
示例

CameraController _controller;
bool _isRecordingMode = false;
bool _isRecording = false;
final _timerKey = GlobalKey<VideoTimerState>();
  
Future<void> stopVideoRecording() async {
    if (!_controller.value.isRecordingVideo) {
      return null;
    }
    _timerKey.currentState.stopTimer();
    setState(() {
      _isRecording = false;
    });

    try {
      await _controller.stopVideoRecording();
    } on CameraException catch (e) {
      print(e);
      return null;
    }
  }
CameraController\u控制器;
bool\u isRecordingMode=false;
bool _isRecording=false;
final_timerKey=GlobalKey();
将来的stopVideoRecording()异步{
if(!\u controller.value.isRecordingVideo){
返回null;
}
_timerKey.currentState.stopTimer();
设置状态(){
_isRecording=false;
});
试一试{
等待控制器停止录像();
}关于CameraException捕获(e){
印刷品(e);
返回null;
}
}

我已经有了类似这样的错误:`\u controller.stopVideoRecording()。然后((值)=>//Navigator.pushNamed(上下文,'/show\u recorded\u video',//参数:{'video_path':value.path});setState(()=>{videoPath=value.path})).catchError((onError)=>print(onError));},`不要打印错误,只需捕获它即可。试试我的例子没用<代码>尝试{final value=await{u controller.stopVideoRecording();setState(()=>{videoPath=value.path});}catch(e){}我用一个例子更新我的答案。请试一试那个视频状态是什么?系统找不到它。