最近尝试用cameraX开发一个flutter插件,但是发现没有办法简单地将Preview绑定到flutter的Texture。
以前只需要使用camera.setPreviewTexture(surfaceTexture.surfaceTexture())来绑定相机和纹理,现在找不到api了。
camera.setPreviewTexture(surfaceTexture.surfaceTexture())
val previewConfig = PreviewConfig.Builder().apply {
setTargetAspectRatio(Rational(1, 1))
setTargetResolution(Size(640, 640))
}.build()
// Build the viewfinder use case
val preview = Preview(previewConfig).also{
}
preview.setOnPreviewOutputUpdateListener {
// it.surfaceTexture = this.surfaceTexture.surfaceTexture()
}
// how to bind the CameraX Preview surfaceTexture and flutter surfaceTexture?