As the title describe, I'm trying to get MediaPlayer
frames (while playing) and pass them to my C++ native code (using JNI
).
So, I use MediaPlayer
and "setDisplay(SurfaceView)
" method to draw video pixels on the SurfaceView
.
During the video playback, I use the "getDrawingCache
" method of the SurfaceView
to get last video frame pixels. But i've read that it the Bitmap will always be black.
So my question is : Is it possible to get the last frame displayed by MediaPlayer
, in order to pass it to C++ code ?
PS : I have to use API level 8
Thanks
As of Android 4.1 they added a MediaCodec Api that allows you to access pretty much everything.
And in Android 4.3 they added the possibility to get the stream from a Surface.
http://developer.android.com/reference/android/media/MediaCodec.html
Before that, you are pretty much stuck. You can try to use the ffmpeg + JNI via NDK solution. It seems pretty hard to accomplish but the good news is if you make it, your frames will already be read at the C++ level.