Hi I have developed an Android application which load Html5 file, that contains .mp3 files. The html files are stored inside the android asset folder. But when I try to load, the file is not playing. This is my path. webView.loadUrl("file:///android_asset/kids_sample/baba.mp3");
Asked
Active
Viewed 451 times
0

user3068659
- 443
- 5
- 14
-
post your webview client class with full code. – Noorul Mar 07 '17 at 11:46
-
check this one http://stackoverflow.com/questions/10966245/android-playing-an-asset-sound-using-webview – vinod Mar 07 '17 at 11:54
1 Answers
1
instead of loading audio files in WebView
, load in MediaPlayer
class.
and if you really want to load audio files in webView
, then you have to code audio files in html file and load that html file in WebView
.
example
<html>
<body>
<audio controls>
<source src="kids_sample/baba.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
</body>
</html>

Learn Pain Less
- 2,274
- 1
- 17
- 24
-
but my file not only audio. i contains gif, text, images and audio. In this case how the MediaPlayer help us? – user3068659 Mar 07 '17 at 11:48
-
then code your file in html file and load that html file in webview – Learn Pain Less Mar 07 '17 at 11:49
-
for images you can use
etc and for so on. also check my updated answer. – Learn Pain Less Mar 07 '17 at 11:50
-
thanks bro this is working. and i need some customization that i will handle. thankyou.. – user3068659 Mar 07 '17 at 11:59
-