A component that lets users start/stop speech recognition and receive transcribed text. Supports Web Speech or custom integration via SpeechToTextButtonIntegrationMode, events for lifecycle (OnStart, OnEnd, OnError), transcription results through OnResult, and configuration of Lang, Continuous, InterimResults, and MaxAlternatives. Provides programmatic control with StartAsync(), StopAsync(), and AbortAsync().
Definition
Namespace:Telerik.Blazor.Components
Assembly:Telerik.Blazor.dll
Syntax:
public class TelerikSpeechToTextButton : ButtonBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Inheritance: objectComponentBaseBaseComponentButtonBaseTelerikSpeechToTextButton
Implements:
Inherited Members
Constructors
public TelerikSpeechToTextButton()
Methods
Aborts the speech recognition process.
public Task AbortAsync()
A task that represents the asynchronous operation.
If the IntegrationMode is set to None, the method invokes the OnEnd event.
Otherwise, it ends the speech recognition using the specified mode without returning a result.
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Overrides:
public override void Dispose()
Overrides:
Forces the component to re-render.
public void Refresh()
public override Task SetParametersAsync(ParameterView parameters)
Overrides:
Starts the speech-to-text recognition process.
public Task StartAsync()
A task that represents the asynchronous operation.
If the IntegrationMode is set to None, the method invokes the OnStart event.
Otherwise, it start speech recognition using the specified mode.
Stops the speech recognition process.
public Task StopAsync()
A task that represents the asynchronous operation.
If the IntegrationMode is set to None, the method invokes the OnEnd event.
Otherwise, it ends the speech recognition using the specified mode.
Properties
Whether continuous results are returned for each recognition, or only a single result. Defaults value is false.
[Parameter]
public bool Continuous { get; set; }
The speech recognition engine or integration the component should use. This allows the component to operate in different environments or use alternative implementations. If unset, WebSpeech will be used.
[Parameter]
public SpeechToTextButtonIntegrationMode IntegrationMode { get; set; }
Whether interim results should be returned. Interim results are results that are not yet final. Defaults value is false.
[Parameter]
public bool InterimResults { get; set; }
Gets a value indicating whether the button is actively listening for incoming audio.
public bool IsListening { get; }
Gets a value indicating whether web speech functionality is supported.
public bool IsWebSpeechSupported { get; }
BCP 47 language tag (e.g., 'en-US', 'bg-BG'). Defaults to browser/system language.
[Parameter]
public string Lang { get; set; }
The maximum returned alternatives for each result. Defaults value is 1.
[Parameter]
public int MaxAlternatives { get; set; }
The Click handler of the button.
[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }
Event that fires when the speech recognition service has disconnected.
[Parameter]
public EventCallback OnEnd { get; set; }
Event that fires when a speech recognition error occurs, providing error details.
[Parameter]
public EventCallback<string> OnError { get; set; }
Event that fires when the speech recognition service returns a result - a word or phrase has been positively recognized.
[Parameter]
public EventCallback<SpeechToTextButtonResultEventArgs> OnResult { get; set; }
Event that fires when the speech recognition service has begun listening to incoming audio.
[Parameter]
public EventCallback OnStart { get; set; }