title: Is it possible to use html5 speech API into android webview in kitkat?
body: <p>I have a very simple website that uses the html5 speech recognition API to convert audio to text. 
  My goal is to make it work inside a webview in Android, but i get this error: </p>
  
  <p>"Uncaught TypeError: Cannot set property 'lang' of undefined", source: <a href="https://example.com/(216)" rel="nofollow noreferrer">https://example.com/(216)</a> </p>
  
  <p>Any ideas?</p>
  
  <p><strong>Here is my MainActivity:</strong></p>
  
  <pre><code>import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.webkit.WebSettings;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          WebView webView = (WebView) findViewById(R.id.webView);
          webView.getSettings().setJavaScriptEnabled(true);
          webView.setWebViewClient(new WebViewClient());
          webView.loadUrl("https://example.com/");
      }
  }
  </code></pre>
  
  <p><strong>Here is my javascript:</strong></p>
  
  <pre><code>var final_transcript = '';
  var recognizing = false;
  
  if ('webkitSpeechRecognition' in window) {
  
    var recognition = new webkitSpeechRecognition();
  
    recognition.continuous = true;
    recognition.interimResults = true;
  
    recognition.onstart = function() {
      recognizing = true;
    }
    recognition.onerror = function(event) {
      console.log(event.error);
    };
  
    recognition.onend = function() {
      recognizing = false;
    }
  
  
    recognition.onresult = function(event) {
      var interim_transcript = '';
      for (var i = event.resultIndex; i &lt; event.results.length; ++i) {
        if (event.results[i].isFinal) {
          final_transcript += event.results[i][0].transcript;
          document.getElementById("textresult").innerHTML = linebreak(interim_transcript);
        } else {
          interim_transcript += event.results[i][0].transcript;
          document.getElementById("textresult").innerHTML = linebreak(interim_transcript);
        }
      }
      final_transcript = capitalize(final_transcript);
  
      document.getElementById("textresult").innerHTML = linebreak(interim_transcript);
      document.getElementById("textresult").innerHTML = linebreak(final_transcript);
  
    };
  }
  
  var two_line = /\n\n/g;
  var one_line = /\n/g;
  function linebreak(s) {
    return s.replace(two_line, '&lt;p&gt;&lt;/p&gt;').replace(one_line, '&lt;br&gt;');
  }
  
  function capitalize(s) {
    return s.replace(s.substr(0,1), function(m) { return m.toUpperCase(); });
  }
  
  function startDictation(event) {
    if (recognizing) {
      recognition.stop();
      return;
    }
    final_transcript = '';
    recognition.lang = 'en-US';
    recognition.start();
    final_span.innerHTML = '';
    interim_span.innerHTML = '';
  }
  
      &lt;/script&gt;
  </code></pre>