Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android html5 game webview slow

I'm trying to insert an html5 game into a webview of an Android 4.2 app but the performances are weak. I've tried with "hardware acceleration" and to set the webview settings in many ways. I heard about the Chromium library but I don't know where to find and how to implement it. Pleae help me.

like image 873
user3361141 Avatar asked Aug 31 '25 10:08

user3361141


2 Answers

You can try the Crosswalk: https://github.com/crosswalk-project/crosswalk

it's a HTML5 runtime framework base on Chromium, it takes advantage of Chromium and has much better HTML5 performance (WebGL/Canvas/CSS3) than native WebView.

https://crosswalk-project.org/#documentation/samples/webgl

like image 124
Shouqun Avatar answered Sep 02 '25 22:09

Shouqun


If it is a html5 canvas game, try addig this to your canvas element in css (boosted performance in my game):

transform: translate3d(0,0,0);
-webkit-transform: translate3d(0,0,0);

This has been the only speedhack that really had a effect on my webview. But be careful not to overuse it! (you can read more about the hack in this article.)

And as Shouqon mentioned, check out crosswalk.

like image 23
Erex Avatar answered Sep 02 '25 23:09

Erex