1

I am trying to run a simple flash video player on android. I can only a block with a question mark. Can someone tell what is wrong with this code?

    webview = (WebView) findViewById(R.id.webview);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            view.loadUrl(url);
            return true;
        }

        @Override 
        public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host,String realm){ 
                String[] up = view.getHttpAuthUsernamePassword(host, realm); 
                    if( up != null && up.length == 2 ) { 
                            handler.proceed(up[0], up[1]);     } 
   else Log.d("WebAuth","Could not find user/pass for domain :"+ host+" with realm =    "+realm); 

} 
    });



    webview.getSettings().setSupportZoom(true);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setAllowFileAccess(true);
    webview.getSettings().setPluginsEnabled(true);


    webview.loadUrl("http://tvforandroid.com/p/?p=1020");
Pinser
  • 1,898
  • 3
  • 29
  • 43
  • Are you able to view the flash video when you open the page in the build in webbrowser? – whlk Mar 20 '11 at 14:53

2 Answers2

1

webview.getSettings().setPluginsEnabled(true); is a deprecated method try targeting min SDK version 8 (2.2) and setting webview.getSettings().setPluginState(WebSettings.PluginState.ON);

See http://developer.android.com/reference/android/webkit/WebSettings.html#setPluginState(android.webkit.WebSettings.PluginState).

0

Are you sure flashplayer is available on the device you're testing on? Not all android devices support it.

  • Yes I have installed it on my device. the version number and all are correct. – Pinser Mar 03 '11 at 14:11
  • I am trying it on an emulator. – Pinser Mar 11 '11 at 09:59
  • I don't see how you could try it on an emulator, pretty sure you can't run flash on the droid device emulators as-is. Something to do with too many levels of virtualization or lack of support thereof. –  Mar 22 '11 at 12:57
  • But I can say that there's definitely substance to your issue as I myself have had issues getting the plugin to display properly and same with this guy on 3.0.1: http://stackoverflow.com/questions/5383364/flash-video-not-displaying-in-webview-for-android-3-0-1 –  Mar 22 '11 at 12:58