Videos and canvases are not drawn when drawing the Android system webview to a SurfaceTexture

714 views
Skip to first unread message

Iker Jamardo

unread,
Mar 25, 2017, 9:14:06 PM3/25/17
to Chromium-dev
Hello,

I am using the system WebView (android.webkit.WebView) and drawing its content to a SurfaceTexture overriding the dispatchDraw method and using the SurfaceTexture canvas instead of the one provided in the call. Then the SurfaceTexture is used to render the content of the webview in a OpenGL fragment shader using the external image texture extension.

Everything works fine but I when a page contains a video or a canvas (2D or webgl) am not able to see them. If I make the call to the regular super.dispatchDraw with the provided canvas apart from the call to using the canvas from the SurfaceTexture, I am able to render the WebView on top of the GLSurfaceView and I can see that the webview is correctly rendering the videos and canvases, but they never get to the SurfaceTexture for some reason. Other devs have been experiencing the same issue over the internet according to my search.

Am I doing something wrong? Is it possible to render the canvas and videos somehow using the system webview in Android 7.1.1 (based on Chromium)?

Thank you very much in advance.

NOTE: A fun fact is that if I create a canvas in my page and do not change its size and render using the 2d context, the canvas is shown in the SurfaceTexture! But if I change the canvas to any other size or get the webgl context from it, the canvas is no longer rendered in the surface texture. 

Bo Liu

unread,
Mar 26, 2017, 1:15:46 PM3/26/17
to ijam...@google.com, Chromium-dev
Sounds like this is falling into webview's special software draw path, so webview is just drawing a bitmap into the surfacetexture. And hardware features like webgl or video don't work in software draw path.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/f3d27d02-1236-4930-863e-c5ee057a9a91%40chromium.org.

Iker Jamardo

unread,
Mar 27, 2017, 1:47:07 AM3/27/17
to bo...@chromium.org, Chromium-dev
So, do you mean there is no way to resolve this?

Regards,
Ike

Bo Liu

unread,
Mar 27, 2017, 12:21:10 PM3/27/17
to Iker Jamardo, Chromium-dev
There is no way to resolve this. And webview hardware composite only works with android's libhwui (ie as an android view); there is no way readback an intermediate hardware result, and then composite it in some other way.

Yossi Elkrief

unread,
Jun 4, 2019, 11:31:51 AM6/4/19
to Chromium-dev
Did you find any solution for the issue? 
Reply all
Reply to author
Forward
0 new messages