How to show video in webView on Android -
i want show text, image , video in application. issue use webview
because should show image , video between texts.
for set webview
write codes:
websettings settings = post_content_web.getsettings(); post_content_web.setwebchromeclient(new webchromeclient()); settings.setpluginstate(websettings.pluginstate.on); settings.setjavascriptenabled(true); settings.setdefaulttextencodingname("utf-8"); string mycustomstylestring = "<style type=\"text/css\">@font-face {font-family: myfont;src: " + "url(\"file:///android_asset/fonts/iran_sans_mobile.ttf\")}body,* {font-family: myfont; font-size: " + "medium;text-align: justify;}</style>"; post_content_web.loaddatawithbaseurl("", mycustomstylestring + "<div style=\"direction:rtl\">" + title + "\n\n" + content + "</div>", "text/html", "utf-8", null);
i use embed code video, such :
<div id="14915658601813975"><script type="text/javascript" src="https://www.aparat.com/embed/hdvzs?data[rnddiv]=14915658601813975&data[responsive]=yes"></script></div>
my application shows video frame (border) , video thumbnail when click on video play, does't show video , show black screen!!!!
how can fix it?
to support video available in div tag(<div>
), have add properties webview settings.
webview.getsettings().setdomstorageenabled(true); webview.getsettings().setappcacheenabled(true); webview.getsettings().setappcachepath(getapplicationcontext().getfilesdir().getabsolutepath() + "/cache"); webview.getsettings().setdatabaseenabled(true); webview.getsettings().setdatabasepath(getapplicationcontext().getfilesdir().getabsolutepath() + "/databases");
i had same issue, , adding this snippet solved black screen.
may helps too!
Comments
Post a Comment