问题描述
这是 Flutter 插件代码的一部分,该插件使用 Flutter 纹理通过 OpenGL 渲染某些内容
private FlutterVideoPlugin(Registrar registrar,MethodChannel channel) {
this.registrar = registrar;
this.channel = channel;
this.textures = registrar.textures();
}
@Override
public void onMethodCall(MethodCall call,Result notSafeResult) {
final AnyThreadResult result = new AnyThreadResult(notSafeResult);
if (call.method.equals("createVideoRenderer")) {
TextureRegistry.SurfaceTextureEntry entry = textures.createSurfaceTexture();
//do anything with the texture
如您所见,它使用 Flutter 方法调用。
是否可以用 C++ 中的 FFI 做同样的事情?我不想依赖 onMethodCall
,它必须是 FFI 或 Flutter 方法调用,因为我认为 FFI 以不同的方式做所有事情,类似这样。
但是,由于 Flutter 引擎,特别是 Texture 部分是用 Java 编写的,所以看起来我需要一些 Java 代码。问题是 FFI 和 java 不混合。看起来我要么必须对我的应用程序中的所有内容使用 onMethodCall
,要么必须使用 FFI,但 FFI 似乎不支持获取纹理
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)