Skip to content

Conversation

@anuj-adobe
Copy link
Owner

Problem
Video screenshots are not getting captured, appear as black screen.

Cause
Bitmap computation logic fails for video
Currently it is done like this

        View view = webView.getView();//.getRootView();
        view.setDrawingCacheEnabled(true);
        bitmap = Bitmap.createBitmap(view.getDrawingCache());
        view.setDrawingCacheEnabled(false);

Two problem in this -

view.getDrawingCache() is deprecated from API 28
it fails to capture bitmap for video as they are not cached
Fix
Updated getScreenshotAsURI() method of cordova-screenshot plugin
Changing bitmap computation logic.
I have used PixelCopy API to get the bitmap.

@anuj-adobe anuj-adobe changed the title Dev video screenshot gives a black screen Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants