When take a screenshot from the exoplayer using Instabug bug reporting feature it shows blank screen although the video is working fine

On
This depends on many factors, one of them is the content of the video itself. Take a look at this bug https://github.com/google/ExoPlayer/issues/1033
You can also try this Android Take Screenshot of Surface View Shows Black Screen
On
change surface type from SurfaceView to TextureView
fun getScreenShotFromView(view: View, activity: Activity) {
activity.window?.let { window ->
val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888)
val locationOfViewInWindow = IntArray(2)
view.getLocationInWindow(locationOfViewInWindow)
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
PixelCopy.request(
window,
Rect(
locationOfViewInWindow[0],
locationOfViewInWindow[1],
locationOfViewInWindow[0] + view.width,
locationOfViewInWindow[1] + view.height
), bitmap, { copyResult ->
if (copyResult == PixelCopy.SUCCESS) {
callback(bitmap)
}
},
Handler()
)
}
} catch (e: IllegalArgumentException) {
// PixelCopy may throw IllegalArgumentException, make sure to handle it
e.printStackTrace()
}
}
}
call method as below
getScreenShotFromView(binding.root,requireActivity())
Instabug doesn't support SurfaceView screenshot capturing at the time being, However, you can get the screenshot-capturing function work properly with the exoPlayer by changing the SurfaceType of the
PlayerViewtoTexture_viewinstead ofSurfaceView. You can do that using the following xml attribute.app:surface_type="texture_view"