将ExoPlayer添加到GLSurfaceView时获取黑屏

时间:2015-04-21 09:00:32

标签: java android video exoplayer

当我将Surfaceview添加到GLSurfaceView以播放视频时,我有一个GLsurfaceview和视频SurfaceView,结果是我得到黑屏而不是视频屏幕。我正在正确地获取音频,但视频屏幕将无法显示,并且在整个视频期间它仍然是黑色的。

两者用于不同目的GLSurfaceView for Page turn for Video surfaceview for ExoPlayer。

GLSurfaceView:

    public class CurlView extends GLSurfaceView implements View.OnTouchListener,
        CurlRenderer.Observer {

        }

ExoPlayer的视频SurfaceView:

    public class VideoSurfaceView extends SurfaceView {


    }

1 个答案:

答案 0 :(得分:9)

试试这个VideoSurfaceView

surfaceView = (VideoSurfaceView) view.findViewById(R.id.surface_view);
surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
surfaceView.setZOrderOnTop(true);