how to play video using opengl es in android?
I'm not sure why you're metioning OpenGL here, but probably the easiest way to play video is using the VideoView class. You'll want to have a look at the MediaPlayer class too.
You might find the Audio and Video page in the Android Developer Documentation helpful.
There's VideoView sample code and MediaPlayer sample code in the API demos provided with the Android SDK.
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).
Also you need to create a custom Renderer class (one that implements the GLSurfaceView.Renderer
interface) and set it to your GLSurfaceView
.
After you do all this, you will have your video playing on a GL surface, but that would be all.
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.