Java 视频截图
我正在制作一个我想截图的应用程序。在前台,我正在运行一些循环的视频,还有一组背景图片。问题是,当我拍摄截图时,我得到的是背景图片,而不是运行的视频图片Java 视频截图,java,android,cordova,Java,Android,Cordova,我正在制作一个我想截图的应用程序。在前台,我正在运行一些循环的视频,还有一组背景图片。问题是,当我拍摄截图时,我得到的是背景图片,而不是运行的视频图片 try { // image naming and path to include sd card appending name you choose for file String mPath = Environment.getExternalStora
try {
// image naming and path to include sd card appending name you choose for file
String mPath = Environment.getExternalStorageDirectory().toString() + "/app/" + fname + ".jpg";
// create bitmap screen capture
View v1 = getWindow().getDecorView().getRootView();
v1.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
Canvas canvas = new Canvas(bitmap);
canvas.drawColor(0, Mode.CLEAR);
File imageFile = new File(mPath);
FileOutputStream outputStream = new FileOutputStream(imageFile);
int quality = 90;
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
outputStream.flush();
outputStream.close();
Log.d("MainActivity","TakeScreenshot SUCCESS");
//openScreenshot(imageFile);
} catch (Throwable e) {
// Several error may come out with file handling or OOM
Log.d("MainActivity","TakeScreenshot ERROR ");
e.printStackTrace();
}
有人知道如何拍摄屏幕上运行的视频的快照吗?您能介绍一下用于显示视频的视图吗?我正在使用WebView进行视频拍摄