0

I am aware that you can only request access to the browser's microphone in google chrome (and other browser's as far as I know) with either https or http. I have a node server and am using Annyang which works fine when I am connected to wifi as usual (requests access to microphone, does its thing after the user accepts).

My problem is that my application is meant to be used with a drone which means that I will be connected to the drone's wifi (which doesn't connect to the internet). I didn't think this would be a problem because I downloaded the annyang.min.js file and I don't need any internet connection for any other parts of my app. However, whenever I connect to the drone and fire up the server it will repeatedly ask for permission to use the microphone no matter how many times I press accept (unless I click deny at which point the app obviously stops working). The server is still using http and the page isn't continually reloading or anything (which would cause it to ask again) as far as I know. I don't have any other tabs open that are trying to use the microphone.

Is there any reason why this problem might be occurring and what would be the best way to fix it? I have a hunch that the problem is caused by the lack of internet connection but I can't find any information on why that would cause a problem. Has anybody experienced this issue (or a similar one before) and if so how did you fix it?

TL;DR:

my speech recognition code works when I am not connected to the drone's wifi and stops working after I connect to it.

All the code can be found on github. Let me know if I can clarify anything.

Kaiido
  • 123,334
  • 13
  • 219
  • 285
2016rshah
  • 671
  • 6
  • 19
  • 1
    What url are you using? Perhaps it's a problem with e.g. http://localhost/ perhaps it needs to be a fully qualified domain name? – Alex KeySmith Jan 07 '15 at 18:32
  • Do you have any log files? Can you see requests going out and being denied? – gmaniac Jan 08 '15 at 16:21
  • @AlexKey I am using `http://localhost:3000/` and I looked into fully qualified domain names but there doesn't seem to be anything in any relevant documentation about why the URL would need to be fully qualified. Have you seen something that would suggest otherwise that I could take a look at? – 2016rshah Jan 08 '15 at 16:32
  • @gmaniac I'm not sure what you mean, what log files and requests are you referring to? – 2016rshah Jan 08 '15 at 16:34
  • Are there log files for localhost? There should be logs on requests and the responses it is giving. Also, for pulling errors that `Annyang` is having check out this answer http://stackoverflow.com/a/25149861/1146562 – gmaniac Jan 08 '15 at 16:55
  • Not sure if this information will be useful but found some potentially relevant info [here](http://stackoverflow.com/questions/14318319/webrtc-browser-doesnt-ask-for-mic-access-permission-for-local-html-file) in another question. May also want to checkout the [NodeCopter project on Github](https://github.com/nodecopter/nodecopter.com). According to [this blog post](http://darrenhall.info/misc/nodecopter) they did some work with the microphone – davidcondrey Jan 09 '15 at 05:39
  • @2016rshah it was more of a general feeling than anything concrete so thought I'd put it as a comment rather than an answer, just in case it comes in useful. – Alex KeySmith Jan 09 '15 at 08:50

1 Answers1

0

The speech recognition library you use, is actually using Google Chrome's integration of the Web Speech API.

Based on this article from 2014 (and from different tests I made) you have to be connected to the internet in order to use Google's speech recognition :

Web Speech Recognition, as implemented here by Google, is a Hybrid solution in that it involves Client sidecode, built into browser, which captures the input audio and Server side code at Google which performs the actual speech recognition and returns the results.
The Web Speech API Specification is, at least in principle, a Browser API but here we see it communicating with a remote server with proprietary software owned by Google.

So maybe when it will be implemented by others than google, you'll be able to use it while not connected. As a workaround, maybe you can try to follow this thread, where it seems they're able to connect the drone to a router (might be possible to keep internet connection then).

Kaiido
  • 123,334
  • 13
  • 219
  • 285