5
मैं एक एंड्रॉइड एप्लिकेशन विकसित कर रहा हूं जहां मैं यूआरएल से कुछ वीडियो गतिशील रूप से खेलना चाहता हूं। इसलिए मैंने लेआउट में एक वेब व्यू डाला और एक एचटीएमएल फाइल देखी जिसमें jwplayer कोड है लेकिन jwplayer वहां नहीं है, और वेब व्यू केवल "प्लेयर लोड हो रहा है ...." दिखा रहा है। मैं समझ नहीं पा रहा हूं कि समस्या कहां है।एंड्रॉइड ऐप में jwplayer का उपयोग नहीं कर सकता
मेरे यहाँ
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class VideoActivity extends Activity {
/** Called when the activity is first created. */
WebView sampleWeb;
String htmlText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.web);
sampleWeb=(WebView)findViewById(R.id.webView);
WebSettings webSettings=sampleWeb.getSettings();
sampleWeb.getSettings().setJavaScriptEnabled(true);
sampleWeb.getSettings().setBuiltInZoomControls(false);
sampleWeb.getSettings().setLoadsImagesAutomatically(true);
sampleWeb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
sampleWeb.getSettings().setAllowFileAccess(true);
sampleWeb.getSettings().setPluginsEnabled(true);
sampleWeb.setWebViewClient(new WebViewClient());
// sampleWeb.loadUrl("m.google.com");
htmlText="<!DOCTYPE html> ";
htmlText+="<html lang='en'>";
htmlText+="<head><meta charset='utf-8'>";
htmlText+="</head>";
htmlText+="<body style='margin:0; pading:0;background-color: #ffffff;'>";
htmlText+="<div style='color:black'>Loading the player ...</div>";
htmlText+="<script type='text/javascript' src='http://shourav.com/android/jwplayer.min.js'></script>";
htmlText+="<div id='mediaspace'>This text will be replaced</div>";
htmlText+="<script type='text/javascript'>";
htmlText+="jwplayer('mediaspace').setup({";
htmlText+="'flashplayer': 'http://developer.longtailvideo.com/svn/trunk/fl5/player.swf',";
htmlText+="'file': 'http://shourav.com/android/android.MP4',";
// htmlText+="'streamer': 'rtmp://b27i9s9t3.rtmphost.com/AndroidMedia',";
htmlText+="'controlbar': 'bottom',";
htmlText+="'width': '200',";
htmlText+="'height': '150'";
htmlText+="});";
htmlText+="</script>";
htmlText+="</body>";
sampleWeb.loadData(htmlText, "text/html", "utf-8");
}
}
कुछ कोड होगा VideoView code तारीफ़ लें। – meh
http://pastebin.com/874jHFLG – shourav
बाहरी साइटों से लिंक करने के बजाय आपको यहां कोड को अतीत करना चाहिए। – Qben