Skip to content

Commit d204f91

Browse files
committed
update articles
1 parent 2cb18e4 commit d204f91

File tree

7 files changed

+75
-4
lines changed

7 files changed

+75
-4
lines changed

controls/speechtotextbutton/custom-recognizer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
2929

3030
<snippet id='speechtotext-mycustomrecognizer' />
3131

32-
**4.** Set the `SpeechRecognizer` property of the `RadSpeechToTextButton` to an instance of your custom recognizer:
32+
**4.** Set the `SpeechRecognizerCreator` property of the `RadSpeechToTextButton` to an instance of your custom recognizer:
3333

3434
<snippet id='speechtotext-speech-recognizer-creator' />
3535

controls/speechtotextbutton/events.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ The .NET MAUI SpeechToTextButton exposes the following events:
2626
* `Exception` (`System.Exception`) property that contains the exception associated with the speech recognizer error, if any.
2727
* `Handled` (`bool`) property that determines whether the error has been handled. Set this to `true` to prevent the default error handling behavior.
2828

29+
* `StateChanged`&mdash;Raaised when the state of the speech recognizer changes. The `StateChanged` event handler receives two parameters:
30+
* The `sender` argument which is of type `object` but can be cast to `RadSpeechToTextButton`.
31+
* An `System.EventArgs`.
32+
2933
## Example
3034

3135
Here is an example using the `SpeechRecognized` and `ErrorOccurred` events:

controls/speechtotextbutton/getting-started.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,35 @@ Before adding the SpeechToTextButton, you need to:
2424

2525
1. [Install Telerik UI for .NET MAUI]({%slug maui-getting-started %}#step-3-install-telerik-ui-for-net-maui).
2626

27+
## Required Permissions
28+
29+
Before adding the contol, ensure that you have the required permissions set up in your project:
30+
31+
### Android
32+
33+
Add the following permissions to your `AndroidManifest.xml` file:
34+
35+
```xml
36+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
37+
```
38+
39+
### iOS and MacCatalyst
40+
41+
Add the `NSMicrophoneUsageDescription` and `NSSpeechRecognitionUsageDescription` permissions to your `Info.plist` file:
42+
43+
```xml
44+
<key>NSMicrophoneUsageDescription</key>
45+
<string>The SpeechToTextButton requires access to microphone.</string>
46+
<key>NSSpeechRecognitionUsageDescription</key>
47+
<string>The SpeechToTextButton requires access to the Speech Recognition service.</string>
48+
```
49+
50+
### WinUI
51+
52+
There are limitations when using the SpeechToTextButton on WinUI. When clicking on the control, the InvalidOperationException occurs.
53+
54+
To turn speech recognition on WinUI, review the [WinUI Support]({%slug speechtotextbutton-winui-support%}) article.
55+
2756
## Define the Control
2857

2958
**1.** When your .NET MAUI application is set up, you are ready to add a SpeechToTextButton control to your page:
299 KB
Loading

controls/speechtotextbutton/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ When the user taps the button, the control uses a speech recognition service, li
1717

1818
## Key Features of the Telerik .NET MAUI SpeechToTextButton
1919

20-
* [Visual States]({%slug speechtotextbutton-visual-states%})&mdash;The SpeechToTextButton supports different visual states such as Normal, Listening, Error, and more, providing visual feedback to users during speech recognition.
2120
* [Language Configuration]({%slug speechtotextbutton-configuration%}#language)&mdash;The SpeechToTextButton allows you to set the language for speech recognition, ensuring accurate transcription of spoken words into text.
2221
* [Events]({%slug speechtotextbutton-events%})&mdash;The SpeechToTextButton emits a set of events that allow you to configure the component's behavior in response to speech recognition, including `SpeechRecognized` and `ErrorOccurred` events.
2322
* [Commands]({%slug speechtotextbutton-commands%})&mdash;The SpeechToTextButton supports command execution, allowing you to bind commands to the button's actions in an MVVM-friendly way.
2423
* [Custom Speech Recognizer]({%slug speechtotextbutton-custom-recognizer%})&mdash;Implement your own speech recognition logic by creating a custom recognizer that implements the `IRadSpeechRecognizer` interface.
24+
* [Visual States]({%slug speechtotextbutton-visual-states%})&mdash;The SpeechToTextButton supports different visual states such as Normal, Listening, Error, and more, providing visual feedback to users during speech recognition.
2525
* [Styling API]({%slug speechtotextbutton-styling%})&mdash;You can customize the appearance of the SpeechToTextButton using the styling API, which allows you to set properties like background color, border color, corner radius, and more.
2626

2727
## Next Steps

controls/speechtotextbutton/states.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ tags: .net maui, telerik speech to text button for .net maui, ui for .net maui
77
slug: speechtotextbutton-states
88
---
99

10-
# .NET MAUI SpeechToTextButton States
10+
# .NET MAUI SpeechToTextButton Architecture and States
1111

12+
The SpeechTextButton control provides visual feedback and handle user interactions. The button uses a speech recognition service. The service provides per platform implementation or an AI agent conenction. Almost all operations are asynconous.
1213

14+
The SpeechToTextButton control in .NET MAUI has several states that reflect its current operation and user interaction.
15+
16+
The image below explains how the control works and how the states are managed:
17+
18+
![.NET MAUI SpeechToTextButton States](images/speechtotext-architecture.png)
1319

1420
## See Also
1521

controls/speechtotextbutton/winui-support.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,37 @@ slug: speechtotextbutton-winui-support
1010

1111
The Telerik UI for .NET MAUI SpeechToTextButton control is designed to work seamlessly across all supported platforms, including WinUI.
1212

13-
However, there are some platform-specific considerations and limitations to be aware of when using the control on WinUI.
13+
The Speech Recognizer uses platform-specific speech recognition services. On WinUI, it relies on the [`Windows.Media.SpeechRecognition`](https://learn.microsoft.com/en-us/uwp/api/windows.media.speechrecognition?view=winrt-26100). However, there are specific considerations when using the control on WinUI due to platform limitations.
1414

15+
## Limitations in Windows.Media.SpeechRecognition
16+
17+
* The app crashes when trying to close the application via the "X" button and the app is **Packaged**. There is an open bug report: [Application crashes after using SpeechRecognizer in a Packaged App](https://github.com/microsoft/microsoft-ui-xaml/issues/10697)
18+
19+
* Based on this issue, the SpeechToTextButton control is not fully supported on WinUI. When you click the control, an `InvalidOperationException` is thrown.
20+
21+
## Solutions
22+
23+
To use the SpeechToTextButton on WinUI, you can use one of the following approaches:
24+
25+
* Set the `SpeechRecognizerCreator` property of the `RadSpeechToTextButton` to `RadSpeechRecognizer` for **Unpackaged** apps:
26+
27+
```csharp
28+
this.speechToTextButton.SpeechRecognizerCreator = () => new RadSpeechRecognizer();
29+
```
30+
31+
* Create a [custom recognizer]({%slug speechtotextbutton-custom-recognizer%}) for **Packaged** and **Unpackaged** apps.
32+
33+
* Use an **Unpackaged** app deployment model.
34+
35+
## Language Support
36+
37+
When setting the `LanguageTag` to a specific value, ensure that the language is supported by the `Windows.Media.SpeechRecognition.SpeechRecognizer` on WinUI.
38+
39+
For more details, review the [Microsoft documentation](https://learn.microsoft.com/en-us/windows/apps/design/input/speech-recognition#predefined-grammars).
40+
41+
## See Also
42+
43+
- [Visual States in the SpeechToTextButton]({%slug speechtotextbutton-visual-states%})
44+
- [Configure the SpeechToTextButton]({%slug speechtotextbutton-configuration%})
45+
- [Events]({%slug speechtotextbutton-events%})
46+
- [Execute Commands]({%slug speechtotextbutton-commands%})

0 commit comments

Comments
 (0)