title: Problem to load flv video in webview
body: <p>I want to <strong>load</strong> .flv video in webview.</p>
  
  <p>I have taken help from <a href="http://www.synesthesia.it/playing-flash-flv-videos-in-android-applications" rel="noreferrer">this link</a>, but the problem is I'm not able to view video in emulator.</p>
  
  <p>This is my code:</p>
  
  <pre><code>package com.FlvTester;
  
  import java.lang.reflect.InvocationTargetException;
  import java.lang.reflect.Method;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.webkit.WebView;
  import android.widget.FrameLayout;
  
  public class FlvTester extends Activity {
  
  WebView webView;
  String htmlPre = "&lt;!DOCTYPE html&gt;&lt;html lang=\"en\"&gt;&lt;head&gt;&lt;meta charset=\"utf-8\"&gt;&lt;/head&gt;&lt;body style='margin:0; pading:0; background-color: black;'&gt;";  
  String htmlCode = 
          " &lt;embed style='width:100%; height:100%'  src='http://www.platipus.nl/flvplayer/download/1.0/FLVPlayer.swf?fullscreen=true&amp;video=@VIDEO@' " +
          "  autoplay='true' " +
          "  quality='high' bgcolor='#000000' " +
          "  name='VideoPlayer' align='middle'" + // width='640' height='480' 
          "  allowScriptAccess='*' allowFullScreen='true'" +
          "  type='application/x-shockwave-flash' " +
          "  pluginspage='http://www.macromedia.com/go/getflashplayer' /&gt;" +
          "";
  String htmlPost = "&lt;/body&gt;&lt;/html&gt;";
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main); 
  
      webView = (WebView)findViewById(R.id.webview);
  
      webView.getSettings().setJavaScriptEnabled(true);
      webView.getSettings().setAllowFileAccess(true);
      webView.getSettings().setPluginsEnabled(true);
  
  
      htmlCode = htmlCode.replaceAll("@VIDEO@",  "file:///android_asset/expression_sad.flv");
      webView.loadDataWithBaseURL("file:///android_asset/expression_sad.flv",  htmlPre+htmlCode+htmlPost, "text/html", "UTF-8", null);  
  }
  
  
  
  
  @Override
  protected void onPause(){
      super.onPause();
  
      callHiddenWebViewMethod("onPause");
  
      webView.pauseTimers();
      if(isFinishing()){
          webView.loadUrl("about:blank");
          setContentView(new FrameLayout(this));
      }
  }
  
  @Override
  protected void onResume(){
      super.onResume();
  
      callHiddenWebViewMethod("onResume");
  
      webView.resumeTimers();
  }
  
  private void callHiddenWebViewMethod(String name){
      // credits: http://stackoverflow.com/questions/3431351/how-do-i-pause-flash- content-in-an-android-webview-when-my-activity-isnt-visible
      if( webView != null ){
          try {
              Method method = WebView.class.getMethod(name);
              method.invoke(webView);
          } catch (NoSuchMethodException e) {
              //Lo.g("No such method: " + name + e);
          } catch (IllegalAccessException e) {
              //Lo.g("Illegal Access: " + name + e);
          } catch (InvocationTargetException e) {
              //Lo.g("Invocation Target Exception: " + name + e);
          }
      }
    }
  
  }
  </code></pre>
  
  <p><strong>I got this error in log cat</strong>  </p>
  
  <pre><code> 07-06 12:00:48.567: WARN/dalvikvm(381): threadid=1: thread exiting with uncaught     exception (group=0x4001d800)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381): FATAL EXCEPTION: main
   07-06 12:00:48.597: ERROR/AndroidRuntime(381): java.lang.RuntimeException: Unable to  start activity ComponentInfo{com.FlvTester/com.FlvTester.FlvTester}:   java.lang.ClassCastException: android.widget.VideoView
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at android.os.Handler.dispatchMessage(Handler.java:99)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at android.os.Looper.loop(Looper.java:123)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at android.app.ActivityThread.main(ActivityThread.java:4627)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at java.lang.reflect.Method.invokeNative(Native Method)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at java.lang.reflect.Method.invoke(Method.java:521)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at dalvik.system.NativeStart.main(Native Method)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381): Caused by: java.lang.ClassCastException: android.widget.VideoView
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at com.FlvTester.FlvTester.onCreate(FlvTester.java:31)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
   07-06 12:00:48.597: ERROR/AndroidRuntime(381):     ... 11 more
  </code></pre>
  
  <p><strong>Main.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout android:layout_width="fill_parent"  android:layout_height="fill_parent"   xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  &lt;WebView android:layout_width="match_parent" android:id="@+id/webview"  android:layout_height="match_parent"&gt;&lt;/WebView&gt; 
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p><img src="https://i.stack.imgur.com/uP2fA.png" alt="this is new image"></p>