美文网首页
Flutter Android 13调用相机 Unhandled

Flutter Android 13调用相机 Unhandled

作者: Superman168 | 来源:发表于2024-05-16 14:34 被阅读0次

问题一:

Android 13调用相机 黑屏,报错如下:

image.png

原来是用的拍照插件wechat_camera_picker比较老,更新一下当前的Flutter版本又不支持了,只能改插件或者换插件了。

后来改了一下这里:

buildscript {
    ext.kotlin_version = '1.8.0'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

把ext.kotlin_version

  • ext.kotlin_version = '1.6.10'
    改成
  • ext.kotlin_version = '1.8.0'
    就没问题了。

问题二:

[core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)"" *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetReader startReading] cannot be called again after reading has already started'

拍摄视频保存直接崩溃,原因如上:。

startReading

flutter video_compress/video_compress-Swift.h' file not found'

解决链接:
https://github.com/jonataslaw/VideoCompress/issues/35

profile文件中加上这个:

use_frameworks!

问题三:

VideoCompress第一次压缩视频可以,第二次崩溃,报错

-[AVAssetWriterInputPixelBufferAdaptor appendPixelBuffer:withPresentationTime:] A pixel buffer cannot be appended when readyForMoreMediaData is NO

插件中这个地方代码的问题:

CVPixelBufferRef nextBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
      CMTime nextSampleTime = CMTimeSubtract(_lastVideoSampleTime, _videoTimeOffset);
      [_videoAdaptor appendPixelBuffer:nextBuffer withPresentationTime:nextSampleTime];

https://stackoverflow.com/questions/13730422/avassetwriterinputpixelbufferadaptor-appendpixelbuffer-exc-bad-access

改成这样:

CVPixelBufferRef nextBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
    CMTime nextSampleTime = CMTimeSubtract(_lastVideoSampleTime, _videoTimeOffset);
    if (nextBuffer != NULL) {
        [_videoAdaptor appendPixelBuffer:nextBuffer withPresentationTime:nextSampleTime];
    } else {
        NSLog(@"NULL PixelBuffer !");
    }

就可以了

相关文章

网友评论

      本文标题:Flutter Android 13调用相机 Unhandled

      本文链接:https://www.haomeiwen.com/subject/hebbfjtx.html