我正在Android应用程序中使用H264视频渲染SurfaceView.它有一个功能,可以在表面视图上渲染视频时拍摄快照.每当我拍摄快照时,我只会获得透明/黑屏.我使用getDrawingCache()方法来捕获仅返回空值的屏幕.我使用下面的代码来捕获屏幕.
SurfaceView mSUrfaceView = new SurfaceView(this); //Member variable
if(mSUrfaceView!=null)
mSUrfaceView.setDrawingCacheEnabled(true); // After video render on surfaceview i enable the drawing cache
Bitmap bm = mSUrfaceView.getDrawingCache(); // return null
Run Code Online (Sandbox Code Playgroud)