使用opengles,android播放视频 [英] play video using opengles, android

查看:22
本文介绍了使用opengles,android播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在android中使用opengl播放视频?

how to play video using opengl es in android?

推荐答案

你的问题有点含糊.如果您只想在 GL 表面上播放视频,这是可能的.请参阅 媒体Dave 在他的示例中提到的播放器 示例代码.您所要做的就是在 MediaPlayerDemo_Video.java 文件以及相应的布局文件 (mediaplayer_2.xml) 中将 SurfaceView 替换为 GLSurfaceView.

Your question is a bit vague. If all you want to do is to play a video in a GL surface, it's possible. See the Media Player sample code that Dave was referring to in his sample. All you have to do there is to replace the SurfaceView with a GLSurfaceView in both the MediaPlayerDemo_Video.java file as well as in the corresponding layout file (mediaplayer_2.xml).

您还需要创建一个自定义 Renderer 类(实现 GLSurfaceView.Renderer 接口的类)并将其设置为您的 GLSurfaceView.

Also you need to create a custom Renderer class (one that implements the GLSurfaceView.Renderer interface) and set it to your GLSurfaceView.

完成所有这些操作后,您的视频将在 GL 表面上播放,但仅此而已.

After you do all this, you will have your video playing on a GL surface, but that would be all.

另一方面,如果您想操作视频,即在 GL 纹理中绘制视频帧并为其添加效果或变换(例如缩放、旋转等),那么我可以怕这个做不到.原因是您无权访问应用程序中的原始视频帧.

If, on the other hand, you want to manipulate the video, i.e. to draw the video frames in a GL texture and add effects to it or transform it (for example scale, rotate, etc.), then I'm afraid this can't be done. The reason is that you don't have access to the raw video frames in your application.

这篇关于使用opengles,android播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆