1

有没有办法截取在视频视图中播放的视频的屏幕截图。我在论坛上搜索但无法获得所需的信息。我试过了

 Bitmap bitmap = Bitmap.createBitmap(this.view.getWidth(), this.view.getHeight(), Config.ARGB_8888);
            Canvas canvas = new Canvas(bitmap);
            view.draw(canvas);

mCustomVideoView.setDrawingCacheEnabled(true);
Bitmap videoView = mCustomVideoView.getDrawingCache(false);

但是这些方法都没有帮助。

4

1 回答 1

0

只要做到这一点:

videoview.buildDrawingCache();

Bitmap bitmap = yourvideoview.getDrawingCache(); 
 java.io.ByteArrayOutputStream stream=new java.io.ByteArrayOutputStream();  

bitmap.compress(Bitmap.CompressFormat.WEBP, 90, stream); 

byte[] videoByteArray=stream.toByteArray(); String video_str = Base64.encodeToString(videoByteArray, 0);

输出是字符串 video_str 和 Bitmap 位图。

于 2018-03-14T19:04:27.380 回答