0

I have a HTML file in assets folder of my project. And I load this file using webview as:

WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(true);
webView.setWebChromeClient(new WebChromeClient());

webView.loadUrl("file:///android_asset/index.html");

every thing works good.

But in some cases if I put some data in html with different character case then it not works in default webview but works in device browser (E.g Chrome):

E.g: I am trying to play a audio file using html as:

<html> . . <audio id="mysound1" src="item/sounds/apple.mp3" autoplay></audio> . . </html>

But in assets folder I have file name as: Apple.mp3

If I load this html file in device browser then audio is playable, regardless there case in name. But if I try to load this html content in webview then this file is not playing. And I see a error in DDMS:

02-23 16:03:36.091: E/AndroidProtocolHandler(23303): Unable to open asset URL: file:///android_asset/item/sounds/apple.mp3

Can any one know about this behavior, how device browser load this file as there case in name is different. What should I do in webview to avoid this case sensitivity issue?

Mca Dc
  • 11
  • 6
  • maybe insufficient privilages –  Feb 23 '16 at 11:49
  • @Kilanny How can I check, if there are any privileges issue? – Mca Dc Feb 23 '16 at 11:51
  • Try to put your two files in sdcard and load it. Maybe the mp3 file is corrupt or unsupported to run by browser –  Feb 23 '16 at 11:53
  • mp3 file is OK. If I rename the file, then it also works in webview. – Mca Dc Feb 23 '16 at 11:54
  • please check this SOLVED answer http://stackoverflow.com/q/10966245/1835231 – Jatinkumar Patel Feb 23 '16 at 12:12
  • @JatinPatel But I don't want to play that mp3 file with MediaPlayer. That file is working fine with webview. I just want to know why "apple.mp3" working and why not "Apple.mp3". As in device browser both are working. – Mca Dc Feb 23 '16 at 12:22

0 Answers0