Android WebView - code that can display and play a podcast can't play a YouTube video -


i have code works display webview , use it:

webview webview = null;  @override public void oncreate(bundle savedinstancestate)   {   //settheme(r.style.theme_sherlock_light);   super.oncreate(savedinstancestate);   //setcontentview(r.layout.podcasts);     webview = new webview(this);   webview.getsettings().setappcacheenabled(false);   webview.getsettings().setjavascriptenabled(true);   webview.setinitialscale(1);   webview.getsettings().setpluginstate(pluginstate.on);    webview.setwebviewclient(new webviewclient() {      @override      public boolean shouldoverrideurlloading(webview view, string url) {          view.loadurl(url);          return true;      } });       //websettings.setbuiltinzoomcontrols(true);     websettings websettings = webview.getsettings();   websettings.setjavascriptenabled(true);   websettings.setbuiltinzoomcontrols(true);   //websettings.getmediaplaybackrequiresusergesture();   websettings.setallowcontentaccess(true);   websettings.setenablesmoothtransition(true);   websettings.setloadsimagesautomatically(true);   websettings.setloadwithoverviewmode(true);   websettings.setsupportzoom(true);   websettings.setusewideviewport(true);    setcontentview(webview);   webview.loadurl("url_to_go_to");          

but when try use code point youtube channel, shows blank screen. idea why happen?

thanks!

in order html5 videos show need enable following things in webview:

webview view; ... //initialize webview websettings webviewsettings = view.getsettings(); view.setwebchromeclient(new webchromeclient(){}); //just added webviewsettings.setdomstorageenabled(true); webviewsettings.setappcacheenabled(true); webviewsettings.setappcachepath(getapplicationcontext().getfilesdir().getabsolutepath() + "/cache"); webviewsettings.setdatabaseenabled(true); webviewsettings.setdatabasepath(getapplicationcontext().getfilesdir().getabsolutepath() + "/databases"); 

you need put android:hardwareaccelerated="true" in androidmanifest. otherwise, html5 stuff youtube videos won't work.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -