HTML5 <audio> tag not working in Android Webview

JavascriptWeb DevelopmentFront End Scripts

Use Mediaplayer of Android for playing audio. You need to call function of Android from JavaScript that you have written in HTML file.

WebView wv = (WebView) findViewById(;
wv.addJavascriptInterface(new WebAppInterface(this), "Android");

public class WebAppInterface {
   Context mContext;
   WebAppInterface(Context c) {
      mContext = c;

   public void showToast(String toast) {
      Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();

The following is my JavaScript:

<input type = "button" value = "Demo" onClick = "showAndroidToast('Hello Android!')" />
   function showAndroidToast(toast) {
Published on 10-Apr-2018 11:44:15