views:

402

answers:

3

i tried to load the url ww.youtube.com on my app in a webview. but it cant be load completely. it loads just like below image. in the browser it loads comfortably. why? Any Idea?

image

+1  A: 

It might be a problem with WebViews - WebViews aren't fully fledged browsers, and have limited functionality. For example, the reference page specifically says that WebViews don't handle JavaScripts. If JavaScripts, Flash or something like that is required to properly load YouTube, then that could be why the WebView doesn't handle it properly.

Steve H
thats acceptable. there must be a solution. right? what is that?
Praveen Chandrasekaran
myWebView = (WebView) findViewById(R.id.webview); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); myWebView.loadUrl("http://www.youtube.com");
Jorgesys
thanks a lot. it works. but can't play the video like browser. is there any possibles??
Praveen Chandrasekaran
Some Videos can't play in a mobile device, check the youtube API! http://code.google.com/intl/en-US/apis/youtube/2.0/reference.html
Jorgesys
its playing in the browser. why it cant be in web view.
Praveen Chandrasekaran
some videos cannot be played in mobile phones because ... ***limitedSyndication*** - The video is not and, based on the content owner's current preferences, will not be available to play in non-browser devices, such as mobile phones.http://code.google.com/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:state(btw check my response about enable javascript if was the correct =) hehe)
Jorgesys
+1  A: 

Enable JavaScript! =)

myWebView = (WebView) findViewById(R.id.webview); 
WebSettings webSettings = myWebView.getSettings(); 
webSettings.setJavaScriptEnabled(true); 
myWebView.loadUrl("http://www.youtube.com"); 
Jorgesys
A: 

the simple answer is to call the youtube app thats loaded on every phone with your webview. check out the code on http://fluxkore.com/index.php/android-apps/ to call the youtube app.....

Donny D