I have implemented web speech api
Demo : Slackblitz
trying to capture transcript and confidence in an array
init() {
this.recognition.interimResults = true;
this.recognition.lang = 'en-US';
this.recognition.addEventListener('result', (e: any) => {
const transcript = Array.from(e.results)
.map((result: any) => result[0])
.map((result) => result.transcript)
.join('');
this.transcript_arr.push(transcript);
this.tempWords = transcript;
console.log(this.transcript_arr);
const confidence = Array.from(e.results)
.map((result: any) => result[0])
.map((result) => result.confidence)
.join('');
this.confidence_arr.push(confidence);
console.log(this.confidence_arr);
});
}
but when i log the output of this.transcript_arr and this.confidence_arr getting repeated output.
Any solution to resolve this issue