[英]I want to write a flutter video plug-in on Android. I want to write it on kotlin native by texture
I want to write a flutter video plug-in on Android.我想在Android上写一个flutter视频插件。 I want to write it on kotlin native by texture
我想按纹理写在 kotlin native 上
Rendering with texture widget on flutter在 flutter 上使用纹理小部件进行渲染
But I have some problems但是我有一些问题
He threw out some information他抛出了一些信息
call to OpenGL ES API with no current context (logged once per thread)
I called我打了电话
val texId=IntArray(1);
GLES20.glGenTextures(texId.size,texId,0)
he return texId is 0他返回 texId 为 0
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
print("call ${call.method}")
when(call.method){
"getPlatformVersion"->{
result.success("Android ${android.os.Build.VERSION.RELEASE}")
}
"playVideo"->{
val texId=IntArray(1);
GLES20.glGenTextures(texId.size,texId,0)
Log.d("autopcDev", "Tex Id : ${texId[0].toString()}")
val mp=MediaPlay( uri= Uri.fromFile(File((call.arguments as Map<*, *>)["path"] as String)),context = activity)
result.success(mp.tex[0])
}
}
}
glSurfaceView does not run on the OpenGL thread. glSurfaceView 不在 OpenGL 线程上运行。 The glSurfaceView should be on the main android thread.
glSurfaceView 应该在主 android 线程上。
The constructor for GLES20 methods , which could be causing the problem. GLES20 方法的构造函数,这可能会导致问题。 Try instantiating it after the call to "
setRenderer(render);
" or inside the " onSurfaceCreated
" method.尝试在调用“
setRenderer(render);
”之后或在“ onSurfaceCreated
”方法内实例化它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.