How to play video URL inside android webview

后端 未结 10 1499
谎友^
谎友^ 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:11

    This may be an old question but this works:

        //Here Im loading the html file from disk
        String html_file = LoadData(file.getAbsolutePath());
    
        WebView myWebView = (WebView) view.findViewById(R.id.webView);
        myWebView.reload();
        myWebView.getSettings().setJavaScriptEnabled(true);
        myWebView.loadData(html_file, "text/html; charset="utf-8", "UTF-8");
    

    Use base64 encoded video data as your video source:

    //html_file
    
    

提交回复
热议问题