Hello!
There are files that I download dynamically (Before the program starts, they do not exist). Files I write to the internal storage of the program ( internal storage ), that is, in data/data/-packageName--/files/someFile.someExtention
After writing the file, I take its name and upload the following HTML code to the webview :

 someMethod (String someFile.someExtention){ .... String html = "<video x-webkit-airplay=\"allow\" controls=\"\" alt=\"Live Stream\" width=\"100%\" height=\"100%\" src=\"FILENAME\"></video>"; mWebView.loadData(html,"text/html", "UTF-8"); ... } 

If in src , instead of FILENAME , you specify an external file (stored on the Internet, for example http://www.someSite.com/someFile.someExtention), everything works as it should. And how to point to the downloaded file? (visited instead of FILENAME - file:///data/data/-packageName--/files/someFile.someExtention , someFile.someExtention ,files/someFile.someExtention, data/data/-packageName--/files/someFile.someExtention , file:///files/someFile.someExtention, file:///someFile.someExtention — neither option works. someFile.someExtention added through

  "+ someFile.someExtention +" 

    1 answer 1

    You need to use the loadDataWithBaseURL method when you need access to files or run scripts from the pages:

      mWebView.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null); 

    And the path to your file can be obtained as follows:

      yourDownloadedFile.toURI.toString(); 

    get a string like:

      file:/data/data/-packageName--/files/someFile.someExtention