|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: Speech-to-Text With ##Platform_Name## Chat UI control | Syncfusion |
| 4 | +description: Checkout and learn about configuration of Speech-to-Text in ##Platform_Name## Chat UI control of Syncfusion Essential JS 2 and more. |
| 5 | +platform: ej2-javascript |
| 6 | +control: Chat UI |
| 7 | +publishingplatform: ##Platform_Name## |
| 8 | +documentation: ug |
| 9 | +domainurl: ##DomainURL## |
| 10 | +--- |
| 11 | + |
| 12 | +# Speech-to-Text in JavaScript Chat UI |
| 13 | + |
| 14 | +The Syncfusion JavaScript Chat UI control integrates `Speech-to-Text` functionality through the browser's [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API). This enables the conversion of spoken words into text using the device's microphone, allowing users to interact with the Chat UI through voice input. |
| 15 | + |
| 16 | +## Configure Speech-to-Text |
| 17 | + |
| 18 | +To enable Speech-to-Text functionality in the JavaScript Chat UI control, update the `index.js` file to incorporate the Web Speech API. |
| 19 | + |
| 20 | +The [SpeechToText](https://ej2.syncfusion.com/javascript/documentation/speech-to-text/es5-getting-started) control listens to audio input from the device’s microphone, transcribes spoken words into text, and updates the Chat UI’s editable footer using the [footerTemplate](https://ej2.syncfusion.com/javascript/documentation/api/chat-ui/#footertemplate) property to display the transcribed text. Once the transcription appears in the footer, users can send it as a message to others. |
| 21 | + |
| 22 | +### Configuration Options |
| 23 | + |
| 24 | +* **[`lang`](https://ej2.syncfusion.com/javascript/documentation/api/speech-to-text/#lang)**: Specifies the language for speech recognition. For example: |
| 25 | + |
| 26 | + * `en-US` for American English |
| 27 | + * `fr-FR` for French |
| 28 | + |
| 29 | +* **[`allowInterimResults`](https://ej2.syncfusion.com/javascript/documentation/api/speech-to-text/#allowinterimresults)**: Set to `true` to receive real-time (interim) recognition results, or `false` to receive only final results. |
| 30 | + |
| 31 | +{% tabs %} |
| 32 | +{% highlight js tabtitle="index.js" %} |
| 33 | +{% include code-snippet/chat-ui/stt/index.js %} |
| 34 | +{% endhighlight %} |
| 35 | +{% highlight html tabtitle="index.html" %} |
| 36 | +{% include code-snippet/chat-ui/stt/index.html %} |
| 37 | +{% endhighlight %} |
| 38 | +{% endtabs %} |
| 39 | + |
| 40 | +{% previewsample "page.domainurl/code-snippet/chat-ui/stt" %} |
| 41 | + |
| 42 | +## Error Handling |
| 43 | + |
| 44 | +The `SpeechToText` control provides events to handle errors that may occur during speech recognition. For more information, refer to the [Error Handling](https://ej2.syncfusion.com/javascript/documentation/speech-to-text/speech-recognition#error-handling) section in the documentation. |
| 45 | + |
| 46 | +## Browser Compatibility |
| 47 | + |
| 48 | +The `SpeechToText` control relies on the [Speech Recognition API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition), which has limited browser support. Refer to the [Browser Compatibility](https://ej2.syncfusion.com/javascript/documentation/speech-to-text/speech-recognition#browser-support) section for detailed information. |
| 49 | + |
| 50 | +## See Also |
| 51 | + |
| 52 | +* [Messages](../messages) |
0 commit comments