user3068659
user3068659

Reputation: 443

play html5 audio from android asset folder?

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");

Upvotes: 0

Views: 507

Answers (1)

Pawneshwer Gupta
Pawneshwer Gupta

Reputation: 2342

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>

Upvotes: 1

Related Questions