android - Vimeo embed showing white screen/missing progressbar -


i'm using vimeo webview in 1 of apps, in devices isn't working well. on xaiomi(api-19) doesn't show video progressbar , on s4(api-21) first time watch video display correctly, @ second time shows white screen, not on video watch in others vimeos videos try play. knows i'm doing wrong? or way works?. here's vimeoplayer activity.

public class vimeoplayer extends activity { private html5webview mwebview;  private modelvideo video;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         mwebview = new html5webview(this);          video = getintent().getparcelableextra("video");          //auto playing vimeo videos in android webview         mwebview.getsettings().setjavascriptenabled(true);         mwebview.getsettings().setallowfileaccess(true);         mwebview.getsettings().setappcacheenabled(true);         mwebview.getsettings().setdomstorageenabled(true);         mwebview.getsettings().setpluginstate(pluginstate.off);         mwebview.getsettings().setallowfileaccess(true);          string html = "<iframe src=\"https://player.vimeo.com/video/" + video.getvideourl() +                 "?title=0&byline=0&portrait=0&color=000000\" width=\"" + mwebview.getwidth() + "\" height=\"" +                 mwebview.getheight() + "\" frameborder=\"0\" webkitallowfullscreen=\"\" mozallowfullscreen=\"\" allowfullscreen=\"\"" +                 "style=\"margin-top:-8px;margin-bottom:-8px;margin-left:-8px;margin-right:-8px;padding:0;width:105%;height:100%;background-color:#000000;\"></iframe>";         string mime = "text/html";         string encoding = "utf-8";         mwebview.loaddatawithbaseurl(null, html, mime, encoding, null);          setcontentview(mwebview.getlayout());          //esconder status bar         view decorview = getwindow().getdecorview();         // hide status bar.         int uioptions = view.system_ui_flag_fullscreen;         decorview.setsystemuivisibility(uioptions);         // remember should never show action bar if         // status bar hidden, hide if necessary.         actionbar actionbar = getactionbar();         if(actionbar!=null) {             actionbar.hide();         }     }      @override     public void onpause() {         super.onpause();     }      @override     protected void ondestroy() {         super.ondestroy();         mwebview.destroy();     }      @override     public boolean onkeydown(int keycode, keyevent event) {         if ((keycode == keyevent.keycode_back) && mwebview.cangoback()) {             mwebview.goback();             return true;         }         return super.onkeydown(keycode, event);     }      @override     public void onbackpressed() {         super.onbackpressed();         mwebview.destroy();         finish();     }    } 

i offer slight alternative approach you. have hardcoded html iframe in code above, dynamic snippets. vimeo provides html iframe networking api , included on each video object. example included in readme on how make request video, play in webview. full disclosure, 1 of authors of library.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -