简体   繁体   中英

play interactive html5 content from swiffy converted swf locally in android webview

I have an interactive swf file I want to port to android. Since swf is not officially supported on android 4.0+, I use google swiffy to convert swf to html5 which I believe it is inline svg file. I put it in Assets and sdcard, and use

mWebView.loadUrl("file:///android_asset/converted.htm", null);

or

mWebView.loadUrl("file:///android_sdcard/converted.htm", null);

But nothing shows on screen. I also tried to read from asset file into a string and use

mWebView.loadDataWithBaseURL("null", buf.toString(), "text/html", "utf-8", "");

it also fails to show anything.

I tried different avds and devices, also tried set

webSettings.setJavaScriptEnabled(true);
webSettings.setPluginState(WebSettings.PluginState.ON); //this one seems deprecated

in code. and set

android:hardwareAccelerated="true"

in AndroidManifest.xml file. I saw some posts mention to use ActionScript3 to control interactive javascript code, but I am lost for those. Is there any tutorial to accomplish this simple task?

You probably need to include the swiffy runtime.

Try to enable web access in your manifest so that the webview can get to and load it. A default conversion will have a tag referencing the online version of this file.

Alternatively, download a local copy of runtime.js and point the tag to that file in your SD card.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM