Class AssistViewSpeechToText
Represents the AssistViewSpeechToText component that holds the speech-to-text settings properties.
Inherited Members
Namespace: Syncfusion.Blazor.InteractiveChat
Assembly: Syncfusion.Blazor.InteractiveChat.dll
Syntax
public class AssistViewSpeechToText : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
The AssistViewSpeechToText component provides comprehensive control over speech recognition behavior, including language selection, interim result handling, and UI customization options.
This component integrates with the browser's native speech recognition API and provides a user-friendly interface for capturing and transcribing speech input.
Examples
<AssistViewSpeechToText Enable="true" Language="en-US" AllowInterimResults="true" ShowTooltip="true">
</AssistViewSpeechToText>
Constructors
AssistViewSpeechToText()
Declaration
public AssistViewSpeechToText()
Properties
AllowInterimResults
Gets or sets a value indicating whether interim results should be captured during speech recognition.
Declaration
[Parameter]
public bool AllowInterimResults { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether to include intermediate recognition results. The default value is true. |
Remarks
When enabled, the TranscriptChanged event fires for each intermediate result, providing real-time feedback. When disabled, only final recognition results are reported.
CssClass
Gets or sets custom CSS classes applied to the speech-to-text component.
Declaration
[Parameter]
public string CssClass { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string containing one or more CSS class names. The default value is Empty. |
Remarks
Use this property to apply custom styling to the component. Multiple classes can be specified, separated by spaces. These classes are applied to the component's root element, allowing for flexible styling customization.
Enable
Gets or sets a value indicating whether speech-to-text functionality is enabled.
Declaration
[Parameter]
public bool Enable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether the speech-to-text feature is active. The default value is false. |
Remarks
When disabled, the speech recognition component will not respond to user interactions. Use this property to conditionally enable or disable the feature based on application requirements.
Language
Gets or sets the language code for speech recognition.
Declaration
[Parameter]
public string Language { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the ISO language code for speech recognition. The default value is |
Remarks
Specify the language using standard ISO language codes (e.g., "en-US" for English, "es-ES" for Spanish). This setting determines how the browser's speech recognition engine interprets the user's speech.
ListeningState
Gets the current listening state of the component.
Declaration
[Parameter]
public SpeechToTextState ListeningState { get; set; }
Property Value
| Type | Description |
|---|---|
| SpeechToTextState | A SpeechToTextState value indicating whether the component is currently listening for speech. The default value is Inactive. |
Remarks
This is a read-only property that is updated by the parent component to reflect the current speech recognition state. Check this property to determine if the component is actively listening or idle.
RecognitionError
Occurs when an error occurs during speech recognition.
Declaration
[Parameter]
public EventCallback<SpeechRecognitionErrorEventArgs> RecognitionError { get; set; }
Property Value
| Type |
|---|
| EventCallback<SpeechRecognitionErrorEventArgs> |
Remarks
This event is raised when the speech recognition process encounters an error, such as a network issue, microphone access denial, or recognition failure.
Inspect the event arguments to determine the specific error and implement appropriate error handling in your application.
RecognitionStart
Occurs when speech recognition starts.
Declaration
[Parameter]
public EventCallback<SpeechRecognitionStartedEventArgs> RecognitionStart { get; set; }
Property Value
| Type |
|---|
| EventCallback<SpeechRecognitionStartedEventArgs> |
Remarks
This event is raised when the user clicks the microphone button and the browser's speech recognition engine begins listening for speech input.
Use this event to perform UI updates or trigger other logic when speech recognition begins.
RecognitionStop
Occurs when speech recognition stops.
Declaration
[Parameter]
public EventCallback<SpeechRecognitionStoppedEventArgs> RecognitionStop { get; set; }
Property Value
| Type |
|---|
| EventCallback<SpeechRecognitionStoppedEventArgs> |
Remarks
This event is raised when the user clicks the microphone button and the browser's speech recognition engine stops listening for speech input.
Use this event to perform UI updates or trigger other logic when speech recognition ends.
Transcript
Gets the recognized speech transcript.
Declaration
[Parameter]
public string Transcript { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string containing the recognized speech text. The default value is Empty. |
Remarks
This is a read-only property that is updated automatically when speech recognition results are received. The parent component updates this property with recognized text from the speech recognition engine.
If AllowInterimResults is enabled, this property updates with interim results before the final result is received.
TranscriptChanged
Occurs when the transcript changes during speech recognition.
Declaration
[Parameter]
public EventCallback<TranscriptChangeEventArgs> TranscriptChanged { get; set; }
Property Value
| Type |
|---|
| EventCallback<TranscriptChangeEventArgs> |
Remarks
This event is raised for both interim results (if AllowInterimResults is enabled) and final recognition results.
Use this event to update the UI with real-time transcript changes or to implement custom handling of recognition results.
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
Dispose(bool)
Dispose unmanaged resources in the Syncfusion Blazor component.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | Boolean value to dispose the object. |
Overrides
OnInitialized()
Declaration
protected override void OnInitialized()
Overrides
OnParametersSetAsync()
Handles parameter updates for the AssistViewSpeechToText component.
Declaration
protected override Task OnParametersSetAsync()
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing any asynchronous operation. |