接收网络传输的数据,并使用MediaCodec解码,解码之后,使用SurfaceView播放。
<MyGLSurfaceView
android:id="@+id/videoView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
定义Renderer渲染:
public class VideoRenderer implements GLSurfaceView.Renderer, SurfaceTexture.OnFrameAvailableListener{
private static final String TAG = "VideoRenderer";
private GLSurfaceViewHelper mHelper;
private int mWidth;
private int mHeight;
public VideoRenderer(int width, int height){
mWidth = width;
mHeight = height;
}
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
//Log.d(TAG, "onFrameAvailable");
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Log.d(TAG, &
|