Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 视频截图_Java_Android_Cordova - Fatal编程技术网

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进行视频拍摄