0

I am developing an application,where i am doing video call(videos are from Opentok).but when i try to take screenshot of my screen,videos are displaying black.

i used following link but dint work

Taking screenshot programmatically doesnt capture the contents of surfaceVIew

i have attached my screenshot screenshot is shown in imageview which is in black colour

i used following code to take screenshot but not working

public Bitmap getScreenShot() {
    View rootView = getWindow().getDecorView().findViewById(android.R.id.content);
    View screenView = rootView.getRootView();
    screenView.setDrawingCacheEnabled(true);
    Bitmap bitmap = Bitmap.createBitmap(screenView.getDrawingCache());
  //  bitmap=Bitmap.createScaledBitmap(bitmap,50,70,false);
    Log.e("new_bitmap","--->"+bitmap);
    screenView.setDrawingCacheEnabled(false);
    return bitmap;
}

plz help me to get solution Thanks.

Community
  • 1
  • 1
Catcaty
  • 63
  • 1
  • 8

1 Answers1

0

Grafika's "texture from camera" activity demonstrates manipulation of incoming video data with GLES. After rendering you can get the pixels with glReadPixels(). The performance of glReadPixels() can vary significantly between devices and different use cases. EglSurfaceBase#saveFrame() shows how to capture to a Bitmap and save as PNG.

Fathima km
  • 2,539
  • 3
  • 18
  • 26
  • 1
    Hi,can u explain me bit detail..actually i am not doing anything with camera.i am getting 2 videos i.e publisher and subscriber videos from tokbox. i just want to take screenshot of my view in which both the videos are dispalying.as of now in my code videos are black as shown in screenshot attached above. – Catcaty Apr 11 '17 at 12:36
  • Can anyone plz give me solution? – Catcaty Apr 11 '17 at 13:42