Called when a final recognition response is available.
A function that removes the listener when called.
const unsubscribe = onFinalResponse((response) => {
console.log('Recognized:', response.asrResult.text);
// Access word-level details
for (const word of response.asrResult.words) {
console.log(`${word.text} (${word.startTime}s - ${word.duration}s)`);
// GoP scores (if computeGoP was true)
if (word.phones) {
for (const phone of word.phones) {
console.log(` ${phone.text}: ${phone.pronunciationScore}`);
}
}
}
response.release();
});
// Later, remove the listener
unsubscribe();
Subscribe to final recognition responses.
This is the primary way to receive recognition results. The callback receives an ASRResponse object with the recognized text, word-level details, audio quality metrics, and methods for saving or uploading the response.
Important: Call response.release() when you are done with the response to free native memory.