How to play video URL inside android webview

后端 未结 10 1483
谎友^
谎友^ 2020-12-10 12:51

I want to play video url inside my application webview but when i am run the application it showing only white screen . i had read some post on this and i have used that cod

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-10 13:24

    Add webview.setWebChromeClient(new WebChromeClient()); and to enable plugins for your video add:

      if (Build.VERSION.SDK_INT < 8) {
         webview.getSettings().setPluginsEnabled(true);
      }  
      else {
         webview.getSettings().setPluginState(PluginState.ON);
      }
    

    Hope this helps.

提交回复
热议问题