I am new to android. Now I am facing two problems 1 . I parsed the xml file and showed it in a webview that contains video and text. When I click on the video, it will not play. In the xml video you embed youtube.
Why is this so?
1. First problem: code and image
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.web_view); Intent intent=getIntent(); String urlsting=intent.getStringExtra("str"); mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setPluginState(PluginState.ON); mWebView.getSettings().setPluginsEnabled(true); mWebView.setInitialScale(100); mWebView.getSettings().setBuiltInZoomControls(true); mWebView.loadDataWithBaseURL(null, urlsting,"text/html", "utf-8", null); }
When I clcik to the video, it starts watching and shows only a black screen, then nothing will happen.
! [] [one]
2. I have a url-embedded video, which I gave in the html tag and am trying to download it. They also do not work for me. I checked the number of questions and blogs, and also did not make any settings, and then could not show the video. Help will be appreciated. Thanks in advance.
String video= "<table bgcolor=\"#666666\"><tr><td><iframe width=\"300\" height=\"260\" frameborder=\"0\" id=\"player\" type=\"text/html\"src=\"http://www.youtube.com/embed/iiLepwjBhZE?enablejsapi=1&origin=example.com\"></iframe></td></tr><tr><td><iframe width=\"300\" height=\"260\" frameborder=\"0\" id=\"player\" type=\"text/html\"src=\"http://www.youtube.com/embed/lBMMTeuJ_UQ?enablejsapi=1&origin=example.com\"></iframe></td></tr><tr><td><iframe width=\"300\" height=\"260\" frameborder=\"0\" id=\"player\" type=\"text/html\"src=\"http://www.youtube.com/embed/BZMkY3y7nM0?enablejsapi=1&origin=example.com\"></iframe></td></tr><tr><td></table>"; mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setPluginState(PluginState.ON); mWebView.getSettings().setPluginsEnabled(true); //mWebView.loadDataWithBaseURL(null,load,"text/html","UTF-8",null); mWebView.loadData(video,"text/html","UTF-8");
In this case, I upload youtube embedded videos to webview, but they also don't work.
! [] [2]
I use android 2.3.3version.I also want to clarify that there are any requirements to install Adobe Flash Player on the emulator, but I think not, because the videos work in the browser. can anyone say that i am right or wrong? try to give me a solution because I have long been stuck in this problem ..
I also tried using the object tag as follows:
String obj="<object width=\"300\" height=\"260\"><param name=\"movie\" value=\"http://www.youtube.com/embed/iiLepwjBhZE?enablejsapi=1&origin=example.com\"?version=3&hl=pt_BR&rel=0\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/embed/iiLepwjBhZE?enablejsapi=1&origin=example.com\" ?version=3&hl=pt_BR&rel=0\" type=\"application/x-shockwave-flash\" width=\"480\" height=\"330\" allowscriptaccess=\"always\" allowfullscreen=\"true\" /></object>";
android youtube video android-webview embed
The iCoder Nov 14 '11 at 13:30 2011-11-14 13:30
source share