Reputation: 3069
I'm using SpeechRecognizer API for my app, and everytime it starts, it plays "beep" sound.
I'd like to know how to mute it, So I could implement one of my own.
Thanks.
Upvotes: 1
Views: 3513
Reputation: 1652
If you are using a button to activate and deactivate the recognizer you can mute sound onclick. This doesnt work fantastically if you have it listening constantly, however for button clicks it should be fine :)
private AudioManager manager;
manager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if (isChecked)
{
manager.setStreamMute(AudioManager.STREAM_MUSIC, true);
speech.startListening(recognizerIntent);
}
else
{
manager.setStreamMute(AudioManager.STREAM_MUSIC, false);
speech.stopListening();
speech.cancel();
}
Hope this helps (sorry if this is abit of a necrothread)
Upvotes: 2