Advertisement
Guest User

Video View

a guest
Nov 8th, 2012
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.04 KB | None | 0 0
  1.  
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.Window;
  6. import android.webkit.WebChromeClient;
  7. import android.webkit.WebSettings;
  8. import android.webkit.WebView;
  9. import android.webkit.WebViewClient;
  10. import android.widget.Toast;
  11.  
  12. public class VideoActivity extends Activity {
  13.     /** Called when the activity is first created. */
  14.     WebView sampleWeb;
  15.     String htmlText;
  16.     @Override
  17.     public void onCreate(Bundle savedInstanceState) {
  18.         super.onCreate(savedInstanceState);
  19.        
  20.         setContentView(R.layout.web);
  21.        
  22.         sampleWeb=(WebView)findViewById(R.id.webView);
  23.         WebSettings webSettings=sampleWeb.getSettings();
  24.  
  25.         sampleWeb.getSettings().setJavaScriptEnabled(true);
  26.         sampleWeb.getSettings().setPluginsEnabled(true);
  27.         sampleWeb.setWebViewClient(new WebViewClient());
  28.        
  29.       //  sampleWeb.loadUrl("m.google.com");
  30.         htmlText="<!DOCTYPE html> ";
  31.         htmlText+="<html lang='en'>";
  32.         htmlText+="<head><meta charset='utf-8'>";
  33.        
  34.         htmlText+="</head>";
  35.         htmlText+="<body style='margin:0; pading:0;background-color: #000000;'>";
  36.         htmlText+="<div style='color:white'>Loading the player ...</div>";
  37.         htmlText+="<script type='text/javascript' src='http://shourav.com/android/jwplayer.min.js'></script>";
  38.  
  39.         htmlText+="<div id='mediaspace'>This text will be replaced</div>";
  40.  
  41.         htmlText+="<script type='text/javascript'>";
  42.         htmlText+="jwplayer('mediaspace').setup({";
  43.         htmlText+="'flashplayer': 'http://developer.longtailvideo.com/svn/trunk/fl5/player.swf',";
  44.         htmlText+="'file': 'http://shourav.com/android/android.MP4',";
  45.        // htmlText+="'streamer': 'rtmp://b27i9s9t3.rtmphost.com/AndroidMedia',";
  46.         htmlText+="'controlbar': 'bottom',";
  47.         htmlText+="'width': '200',";
  48.         htmlText+="'height': '150'";
  49.         htmlText+="});";
  50.         htmlText+="</script>";
  51.  
  52.         htmlText+="</body>";
  53.         sampleWeb.loadData(htmlText, "text/html", "utf-8");
  54.  
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement