Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Keep microphone #34

Open
Cheyenne55 opened this issue Oct 1, 2017 · 6 comments
Open

Keep microphone #34

Cheyenne55 opened this issue Oct 1, 2017 · 6 comments

Comments

@Cheyenne55
Copy link

Hi there,

Great work and Bing is very good at speech recognition.

However I found that this SDK lacks an option to keep the mic active.
If running with Firefox, it keeps prompting for the user's mic (yes you can tick the box to tell Firefox to remember the agreement but hey..).

Would be a nice little option.

@raaaar
Copy link
Contributor

raaaar commented Oct 2, 2017

Hi. This seems to be Firefox specific (Chrome, for instance, remembers the choice if an app is served over HTTPS. FF provides a checkbox instead). I don't see an easy fix for this (apart from redirecting the mic output to /dev/null when it's not being used, which is not really nice). If you find a solution, a PR would be appreciated.

@Cheyenne55
Copy link
Author

Hi,

Well in fact there's a solution in here (search for "keepMic").
Would a similar solution also work ?

@raaaar
Copy link
Contributor

raaaar commented Oct 2, 2017

https://github.com/watson-developer-cloud/speech-javascript-sdk/blob/0c3a8794af14ac1abbf13bf4e931aab6de5de688/dist/watson-speech.js#L8726 -- that's what I meant by" redirecting mic output to /dev/null" (they pull the audio off the microphone and then ignore it). This is not exactly efficient -- it puts additional load on the system (it keeps the browser interacting with the audio system and then garbage collecting generated chunks). As an alternative to asking a user tick a checkbox, it's a little wasteful, don't you think? Also, not sure if this will play nice with concurrent mic clients.

@Cheyenne55
Copy link
Author

Cheyenne55 commented Oct 2, 2017

Well that's why it's an option I though, you're not forced to use it but you the option to.
On my smartphone I don't see any performance difference whether this is active or not.
However I have just checked now and Firefox in mobile does not propose the checkbox to remember the agreement the checkbox so it's very annoying.

They say that the option is made for Firefox : https://github.com/watson-developer-cloud/speech-javascript-sdk/blob/0c3a8794af14ac1abbf13bf4e931aab6de5de688/dist/watson-speech.js#L8743

@rcollette
Copy link

I don't get prompted to allow mic access multiple times unless I am opening the example using the file:// protocol. It seems to work fine if you open the example through a host, even localhost.

@compulim
Copy link

Hosting on localhost, both Edge and Firefox will prompt multiple times. And Chrome didn't.

I investigated the problem in MicAudioSource.ts. But can someone give explain some designs to me?

I saw the logic is Attach -> Listen -> TurnOn? I understand why Attach need to be public. But why TurnOn/TurnOff is a public method? Is it supposed to be called by the user?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants