11

I tried to open an SWF file in webViewClient and it works on Android 2.1 and 2.3.3. But when I try to play the same SWF file on 4.0.4, it causes an error and a green screen appears in the videoPlayer page.

oWebView = (WebView) findViewById(R.id.wvhPlayer);
oWebView.setWebViewClient(new KhWebClient());
oWebView.getSettings().setJavaScriptEnabled(true);
oWebView.getSettings().setPluginsEnabled(true);
oWebView.getSettings().setAllowFileAccess(true);
oWebView.getSettings().setBuiltInZoomControls(true);

String html = " <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"100%\" height=\"100%\" id=\"vPlayer\" align=\"middle\">"
            + " <param name=\"movie\" value=\"http://mysite.com/sites/all/modules/player/player.swf?id=0CYj9tI0hpQ"
            + "\" />"
            + "  <param name=\"quality\" value=\"high\" />"
            + " <param name=\"bgcolor\" value=\"#000000\" />"
            + " <param name=\"play\" value=\"true\" />"
            + " <param name=\"loop\" value=\"true\" />"
            + " <param name=\"wmode\" value=\"window\" />"
            + " <param name=\"scale\" value=\"showall\" />"
            + " <param name=\"menu\" value=\"true\" />"
            + " <param name=\"devicefont\" value=\"false\" />"
            + " </object>";

oWebView.loadDataWithBaseURL("null", html, "text/html", "utf-8", null);
Darshan Rivka Whittle
  • 32,989
  • 7
  • 91
  • 109
Basbous
  • 3,927
  • 4
  • 34
  • 62
  • 1
    In case you missed the news, Adobe plans to drop support for Flash on Android. I'd recommend finding an alternative to Flash if you want this change to continue to work on JellyBean and later releases of Android. Please see (http://lifehacker.com/5922466/remains-of-the-day-adobe-dropping-flash-from-android) for more information. – Chris Walter Aug 01 '12 at 12:22

2 Answers2

1

according to this Question, i used to load the swf file instead of loading a html.

its work like a charm.

  1. Add to AndroidManifest.xml

android:hardwareAccelerated="true"

2.

oWebView = (WebView) findViewById(R.id.wvhPlayer);
oWebView.getSettings().setJavaScriptEnabled(true);
oWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
oWebView.loadUrl("http://mysite.com/sites/all/modules/player/player.swf?id=0CYj9tI0hpQ");
Community
  • 1
  • 1
Basbous
  • 3,927
  • 4
  • 34
  • 62
-1

I found a bug(one of them) in android 4.0 with hardware acceleration in WebViewClient. By default they set it to true, so try setting it to false in your manifest and tell me what happen.

*If this fix the problem please consider moving to Iphone...

Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216