New to Kendo UI for Angular? Start a free 30-day trial
SpeechToTextButton Events
The Kendo UI for Angular SpeechToTextButton emits a number of events which enable you to control its behavior upon user interaction.
The following events are available:
Event Name | Type | Description |
---|---|---|
start | EventEmitter<any> | Fires when the speech recognition service has begun listening to incoming audio. |
end | EventEmitter<any> | Fires when the speech recognition service has disconnected. |
error | EventEmitter<SpeechToTextErrorEvent> | Fires when a speech recognition error occurs. The event argument contains the error message. |
result | EventEmitter<SpeechToTextResultEvent> | Fires when the speech recognition service returns a result (a word or phrase is recognized). Contains recognition alternatives and indicates whether the result is final or interim. |
click | EventEmitter<any> | Fires when the user clicks the SpeechToTextButton. |
The following example demonstrates all events of the SpeechToTextButton.
Change Theme
Theme
Loading ...
Result Event Details
The result
event is the most important event for handling speech recognition output. It provides detailed information about the recognized speech through the SpeechToTextResultEvent
object.
Key Properties
alternatives
: An array of possible recognition results, each containing atranscript
andconfidence
score.isFinal
: Boolean indicating whether this is a final result (true
) or an interim result (false
).
Usage Example
The following example demonstrates how to handle the result
event from the Kendo UI for Angular SpeechToTextButton and process recognized speech transcripts.
typescript
public handleResult(event: SpeechToTextResultEvent): void {
if (event.alternatives && event.alternatives.length > 0) {
const transcript = event.alternatives[0].transcript;
const confidence = event.alternatives[0].confidence;
if (event.isFinal) {
// Handle final result
this.finalText += transcript + ' ';
} else {
// Handle interim result
this.interimText = transcript;
}
}
}
For more advanced usage with multiple alternatives and interim results, see the Speech Configurations documentation.