12
I want to load .flv video in webview.
I have taken help from this link, but the problem is I'm not able to view video in emulator.
This is my 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 = "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"></head><body style='margin:0; pading:0; background-color: black;'>";
String htmlCode =
" <embed style='width:100%; height:100%' src='http://www.platipus.nl/flvplayer/download/1.0/FLVPlayer.swf?fullscreen=true&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' />" +
"";
String htmlPost = "</body></html>";
@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.onPau