I need to take a screenshot programmatically from a youtube video. Unfortunately the code usually used for taking screenshots (see partially below) only returns black rectangles.
webView.setDrawingCacheEnabled(true);
webViewScreenshot = Bitmap.createBitmap(webView.getDrawingCache());
webView.setDrawingCacheEnabled(false);
FOS = new FileOutputStream(file);
webViewScreenshot.compress(Bitmap.CompressFormat.JPEG, 100, FOS);
FOS.flush();
FOS.close();
If I push the respective buttons (Power & Volume Down) I get a screenshot which actually shows the YouTube video. The best information I got about that so far is that for the programmatic screenshot, the video gets rendered on the GPU and for the hardware screenshot, the screen actually freezes and completely renders everything.
Any suggestions on how I could combine the two?