accessibility – To address the issue of the microphone picking up both the user’s voice and the NVDA (Nonvisual Desktop Access) voice output while recording
I have implemented a voice-to-text feature in my application, and I am utilizing the connected earphone microphone for voice input using navigator.mediaDevices.getUserMedia({audio: true}) API. The accessibility tool NVDA is also running in the background. Now, the issue I am facing is that the microphone is picking up the NVDA (Nonvisual Desktop Access) voice output along with the user’s voice while I am recording with the microphone. Since NVDA provides auditory feedback, it is being captured by the microphone along with the user’s voice input, resulting in interference.
I am expecting only user voice to be recorded while filtering out voice output from accessibility tool (for ex: NVDA).
I tried to solve the problem using the deviceId property in Angular.
Here is the sample code:
const devices = await navigator.mediaDevices.enumerateDevices();
const microphone = devices.find(device =\> device.kind === 'audioinput');
if (microphone) {
const stream = await navigator.mediaDevices.getUserMedia({audio: { deviceId: {exact:
microphone.deviceId}}});
// Use the obtained stream for recording
} else {
console.error('Microphone not found');
}
Read more here: Source link
