I want display a YouTube video playlist in a webview in my application. When it loads, it displays on the entire screen of my phone instead of within the layout of my application, which includes a tabhost with three tabs, a title bar, and a status bar. Other links display fine. How do I load YouTube without it taking over my screen?
These are the setting of my webview…
newsfeed = (WebView) findViewById(R.id.webViewnews);
//Enables JavaScript (YouTube)
newsfeed.getSettings().setJavaScriptEnabled(true);
newsfeed.setVerticalScrollBarEnabled(false);
Here is the line of code in question…
} else
if(selectednewsfeed.contentEquals("4")){
try{
//This link display on entire screen
newsfeed.loadUrl("http://www.youtube.com/watch?v=_3PTjOdMKwY&list=UUBIwq18tUFrujiPd3HLPaGw&feature=plcp");
//This link displays within the layout of my application, but as
//title and headline followed by source code
//newsfeed.loadUrl("http://feeds2.feedburner.com/Maxkeisercom");
}
catch (Exception e){
e.printStackTrace();
}
I also want to know how to display content from FeedBurner in a webview. I want users to be able to read this feed and then access the podcast. How do I make a webview display full HTML?
I have added this as an answer in Video not playing in Android.
I hope this may help you in a YouTube video to only fill your screen.
VideoViewandMediaplayercan play only formats given in their documents named supported media formats.The YouTube link you gave is for an HTML page.
If you want only the video to be viewed from that link, leave all other details in the page. Suppose this is the YouTube link,
http://www.youtube.com/watch?v=ZC7ZOGpM2cU&feature=g-logo&context=G233b464FOAAAAAAABAA.If you parse the source of the YouTube HTML page, you may see this portion:
In this, extract the following.
In this, the
http://www.youtube.com/v/ZC7ZOGpM2cU?version=3&autohide=1link will show it fullscreen.Similarly, you must extract the part of HTML codes for playlist.
I hope this may help you.